Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zero-size SVG rendering : mapserv.fcgi crashes #6967

Closed
FilipGh opened this issue Nov 14, 2023 · 0 comments
Closed

Zero-size SVG rendering : mapserv.fcgi crashes #6967

FilipGh opened this issue Nov 14, 2023 · 0 comments
Assignees

Comments

@FilipGh
Copy link

FilipGh commented Nov 14, 2023

Actual behavior

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):

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);

Expected behavior

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) {
   ...
}

Steps to reproduce the problem.

With the data in the attached ZIP, run the following command :
mapcache_seed -c /var/www/html/geo/mapcache_seed_G4D-506.xml -t G4D-506_meta -v -b -f -n8 -e 20.9068,32.5112,20.9104,32.5139 -z 1,17

Attached simple test case

The attached ZIP contains G4D-506.zip:

  • G4D-506.gpkg : contains the vector layer to be rendered
  • WMS_G4D-506.map : map file with the rendering parameters (especially the SVG symbol)
  • P00067_Dk-Brown1815_Tick.svg : SVG symbol
  • mapcache_seed_G4D-506.xml : map cache file for mapcache_seed executable

You can modify symbol size to make the test OK or NOK (see WMS_G4D-506.map):

STYLE
   SYMBOL "P00067_Dk-Brown1815_Tick.svg"
   # If SIZE=40: no bug
   # If SIZE=4: bug in mapcairo.c:1074
   SIZE 4
   GAP -7.5
   INITIALGAP 3.75
END #STYLE

Operating system

Centos Linux release 7.2.1511

MapServer version and installation method

  • Mapserver 7.6.3
  • MapCache : 1.12.0
PROMPT > mapserv -v
MapServer version 7.6.3 OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO SUPPORTS=SVG_SYMBOLS SUPPORTS=RSVG SUPPORTS=ICONV SUPPORTS=XMP SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS SUPPORTS=POINT_Z_M SUPPORTS=PBF INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE
PROMPT >
@rouault rouault self-assigned this Nov 17, 2023
rouault added a commit that referenced this issue Nov 21, 2023
Remove assert() triggered on a 0-pixel SVG symbol (fixes #6967)
rouault added a commit that referenced this issue Nov 24, 2023
[Backport branch-8-0] Remove assert() triggered on a 0-pixel SVG symbol (fixes #6967)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants