Skip to content

Commit b54c75c

Browse files
committedFeb 21, 2013
Protect point and line pattern symbol layer from eating too much memory
1 parent eea57cf commit b54c75c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
 

‎src/core/symbology-ng/qgsfillsymbollayerv2.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,13 @@ void QgsLinePatternFillSymbolLayer::startRender( QgsSymbolV2RenderContext& conte
747747
int dx = 0;
748748
int dy = 0;
749749

750+
if ( width > 10000 || height > 10000 ) //protect symbol layer from eating too much memory
751+
{
752+
QImage img;
753+
mBrush.setTextureImage( img );
754+
return;
755+
}
756+
750757
QImage patternImage( width, height, QImage::Format_ARGB32 );
751758
patternImage.fill( 0 );
752759
QPainter p( &patternImage );
@@ -1049,6 +1056,13 @@ void QgsPointPatternFillSymbolLayer::startRender( QgsSymbolV2RenderContext& cont
10491056
double width = context.outputPixelSize( mDistanceX ) * 2.0;
10501057
double height = context.outputPixelSize( mDistanceY ) * 2.0;
10511058

1059+
if ( width > 10000 || height > 10000 ) //protect symbol layer from eating too much memory
1060+
{
1061+
QImage img;
1062+
mBrush.setTextureImage( img );
1063+
return;
1064+
}
1065+
10521066
QImage patternImage( width, height, QImage::Format_ARGB32 );
10531067
patternImage.fill( 0 );
10541068

2 commit comments

Comments
 (2)

gioman commented on Feb 21, 2013

@gioman
Contributor

mhugent commented on Feb 21, 2013

@mhugent
ContributorAuthor
Please sign in to comment.