@@ -576,10 +576,10 @@ const unsigned char* QgsLabel::labelPoint( labelpoint& point, const unsigned cha
576576 QGis::WkbType wkbType;
577577#ifndef QT_NO_DEBUG
578578 const unsigned char *geomend = geom + geomlen;
579+ Q_ASSERT ( geom + 1 + sizeof ( wkbType ) <= geomend );
579580#else
580581 Q_UNUSED ( geomlen );
581582#endif
582- Q_ASSERT ( geom + 1 + sizeof ( wkbType ) <= geomend );
583583
584584 geom++; // skip endianness
585585 memcpy ( &wkbType, geom, sizeof ( wkbType ) );
@@ -592,7 +592,9 @@ const unsigned char* QgsLabel::labelPoint( labelpoint& point, const unsigned cha
592592 case QGis::WKBPoint25D:
593593 case QGis::WKBPoint:
594594 {
595+ #ifndef QT_NO_DEBUG
595596 Q_ASSERT ( geom + 2 *sizeof ( double ) <= geomend );
597+ #endif
596598 double *pts = ( double * )geom;
597599 point.p .set ( pts[0 ], pts[1 ] );
598600 point.angle = 0.0 ;
@@ -605,11 +607,15 @@ const unsigned char* QgsLabel::labelPoint( labelpoint& point, const unsigned cha
605607 // intentional fall-through
606608 case QGis::WKBLineString: // Line center
607609 {
610+ #ifndef QT_NO_DEBUG
608611 Q_ASSERT ( geom + sizeof ( int ) <= geomend );
612+ #endif
609613 int nPoints = *( unsigned int * )geom;
610614 geom += sizeof ( int );
611615
616+ #ifndef QT_NO_DEBUG
612617 Q_ASSERT ( geom + nPoints*sizeof ( double )*dims <= geomend );
618+ #endif
613619
614620 // get line center
615621 double *pts = ( double * )geom;
@@ -652,17 +658,23 @@ const unsigned char* QgsLabel::labelPoint( labelpoint& point, const unsigned cha
652658 // intentional fall-through
653659 case QGis::WKBPolygon: // centroid of outer ring
654660 {
661+ #ifndef QT_NO_DEBUG
655662 Q_ASSERT ( geom + sizeof ( int ) <= geomend );
663+ #endif
656664 int nRings = *( unsigned int * )geom;
657665 geom += sizeof ( int );
658666
659667 for ( int i = 0 ; i < nRings; ++i )
660668 {
669+ #ifndef QT_NO_DEBUG
661670 Q_ASSERT ( geom + sizeof ( int ) <= geomend );
671+ #endif
662672 int nPoints = *( unsigned int * )geom;
663673 geom += sizeof ( int );
664674
675+ #ifndef QT_NO_DEBUG
665676 Q_ASSERT ( geom + nPoints*sizeof ( double )*dims <= geomend );
677+ #endif
666678
667679 if ( i == 0 )
668680 {
0 commit comments