Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Protect point and line pattern symbol layer from eating too much memory
  • Loading branch information
mhugent committed Feb 21, 2013
1 parent eea57cf commit b54c75c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/core/symbology-ng/qgsfillsymbollayerv2.cpp
Expand Up @@ -747,6 +747,13 @@ void QgsLinePatternFillSymbolLayer::startRender( QgsSymbolV2RenderContext& conte
int dx = 0;
int dy = 0;

if ( width > 10000 || height > 10000 ) //protect symbol layer from eating too much memory
{
QImage img;
mBrush.setTextureImage( img );
return;
}

QImage patternImage( width, height, QImage::Format_ARGB32 );
patternImage.fill( 0 );
QPainter p( &patternImage );
Expand Down Expand Up @@ -1049,6 +1056,13 @@ void QgsPointPatternFillSymbolLayer::startRender( QgsSymbolV2RenderContext& cont
double width = context.outputPixelSize( mDistanceX ) * 2.0;
double height = context.outputPixelSize( mDistanceY ) * 2.0;

if ( width > 10000 || height > 10000 ) //protect symbol layer from eating too much memory
{
QImage img;
mBrush.setTextureImage( img );
return;
}

QImage patternImage( width, height, QImage::Format_ARGB32 );
patternImage.fill( 0 );

Expand Down

2 comments on commit b54c75c

@gioman
Copy link
Contributor

@gioman gioman commented on b54c75c Feb 21, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mhugent
Copy link
Contributor Author

@mhugent mhugent commented on b54c75c Feb 21, 2013 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.