Ticket #447 (assigned defect)

Opened 5 years ago

Last modified 5 years ago

MapServer crashes if LABELITEM does not exist

Reported by: warmerdam Assigned to: sdlime (accepted)
Priority: high Milestone:
Component: MapServer C Library Version: 4.1
Severity: normal Keywords:
Cc:

Description

This came up while creating a minimal map file to reproduce another bug.  
Basically, if I have a label layer with an inline feature and a LABELITEM
which does not exist then MapServer crashes.

I am attaching a mapfile which should reproduce the problem using the command
"shp2img -m <mapfile> -o out.png".   You will need to modify the font path to
a valid font list file with something resolving the "default" name.


The crash looks like:
(gdb) where
#0  0x080589d7 in msShapeGetAnnotation (layer=0x80d9124, shape=0xbfffd110)
    at maputil.c:190
#1  0x0805fb45 in msDrawVectorLayer (map=0x416bf008, layer=0x80d9124, 
    image=0x810ff30) at mapdraw.c:659
#2  0x0805f751 in msDrawLayer (map=0x416bf008, layer=0x80d9124, 
    image=0x810ff30) at mapdraw.c:515
#3  0x0805edb1 in msDrawMap (map=0x416bf008) at mapdraw.c:269
#4  0x0804dc92 in main (argc=5, argv=0xbffff0a4) at shp2img.c:159
#5  0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6

Crashes on this line:
    tmpstr = strdup(shape->values[layer->labelitemindex]);

layer->labelitemindex is 0, but shape->values is NULL since there are no
attributes on this inline feature. 

I am not sure where the fix should be.

Attachments

newbug.map (0.5 kB) - added by fwarmerdam on 09/30/03 09:30:07.
Simple Mapfile demonstrating problem.

Change History

09/30/03 09:30:07 changed by fwarmerdam

  • attachment newbug.map added.

Simple Mapfile demonstrating problem.

10/01/03 15:57:50 changed by sdlime

  • status changed from new to assigned.