OPENGL GAL: Fixed the iteration condition when drawing triangulated polyset

The loop used an incorrect variable size as the loop limit,
occasionally causing out of bounds accesses.

Fixes: lp:1778288
* https://bugs.launchpad.net/kicad/+bug/1778288
This commit is contained in:
Maciej Suminski 2018-06-23 02:02:49 +02:00
parent 1751e4631c
commit 73a8d2a9d5
2 changed files with 4 additions and 1 deletions

View File

@ -805,7 +805,7 @@ void OPENGL_GAL::drawTriangulatedPolyset( const SHAPE_POLY_SET& aPolySet )
if( isFillEnabled )
{
for( int j = 0; j < aPolySet.OutlineCount(); ++j )
for( unsigned int j = 0; j < aPolySet.TriangulatedPolyCount(); ++j )
{
auto triPoly = aPolySet.TriangulatedPolygon( j );

View File

@ -548,6 +548,9 @@ class SHAPE_POLY_SET : public SHAPE
*/
bool IsSelfIntersecting();
///> Returns the number of triangulated polygons
unsigned int TriangulatedPolyCount() const { return m_triangulatedPolys.size(); }
///> Returns the number of outlines in the set
int OutlineCount() const { return m_polys.size(); }