[MapServer-dev] Zero-size SVG rendering : mapserv.fcgi crashes

Jeff McKenna jmckenna at gatewaygeomatics.com
Fri Nov 10 09:40:34 PST 2023


Hi Philippe,

Your dimensions test makes sense to me.  Are you willing to submit a 
pull request for this, against the main branch?  Also, it would be great 
if you can include a test for this in msautotest (follow steps at 
https://mapserver.org/development/tests/autotest.html ) as part of your 
pull request.

Thanks,

-jeff





-- 
Jeff McKenna
GatewayGeo: Developers of MS4W, & offering MapServer Consulting/Dev
co-founder of FOSS4G
http://gatewaygeo.com/



On 2023-11-10 11:40 a.m., Philippe Ghesquiere via MapServer-dev wrote:
> Hi all,
> 
> My mapserver installation is based on :
> 
>   * Mapserver 7.6.3
>   * MapCache : 1.12.0
> 
> I bumped into a configuration (zoom, orientation, ...) where an SVG 
> symbol has one null dimension (height or width).
> The rendering process crashes with the following error message 
> (mapcairo.c 
> <https://github.com/MapServer/MapServer/blob/rel-7-6-3/mapcairo.c>) :
> mapserv.fcgi: /builds/i4d/datacenter/mapserver/MapServer/mapcairo.c:1074:
> msRenderRasterizedSVGSymbol: Assertion `svg_cache->pixmap_buffer->height 
> && svg_cache->pixmap_buffer->width' failed.
> 
> The code snippet  shows :
> //already rendered at the right size and scale? return
> if(svg_cache->scale != style->scale || svg_cache->rotation != 
> style->rotation) {
> ...
> }
> assert(svg_cache->pixmap_buffer->height && svg_cache->pixmap_buffer->width);
> 
> Instead of crashing the rendering process, wouldn't it be more 
> appropriate to test buffer dimensions beforehands.
> Something like :
> if ( (svg_cache->pixmap_buffer->height == 0 || 
> (svg_cache->pixmap_buffer->width == 0) )
>     return MS_FAILURE;
> 
> //already rendered at the right size and scale? return
> if(svg_cache->scale != style->scale || svg_cache->rotation != 
> style->rotation) {
> ...
> }
> 
> Philippe
> The information in this e-mail is confidential. The contents may not be 
> disclosed or used by anyone other than the addressee. Access to this 
> e-mail by anyone else is unauthorised.
> If you are not the intended recipient, please notify Airbus immediately 
> and delete this e-mail.
> Airbus cannot accept any responsibility for the accuracy or completeness 
> of this e-mail as it has been sent over public networks. If you have any 
> concerns over the content of this message or its Accuracy or Integrity, 
> please contact Airbus immediately.
> All outgoing e-mails from Airbus are checked using regularly updated 
> virus scanning software but you should take whatever measures you deem 
> to be appropriate to ensure that this message and any attachments are 
> virus free.
> 


More information about the MapServer-dev mailing list