Opened 21 years ago

Closed 14 years ago

#447 closed defect (fixed)

MapServer crashes if LABELITEM does not exist

Reported by: warmerdam Owned by: sdlime
Priority: high Milestone:
Component: MapServer C Library Version: 4.1
Severity: normal Keywords:
Cc:

Description (last modified by sdlime)

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 (1)

newbug.map (541 bytes ) - added by fwarmerdam 21 years ago.
Simple Mapfile demonstrating problem.

Download all attachments as: .zip

Change History (3)

by fwarmerdam, 21 years ago

Attachment: newbug.map added

Simple Mapfile demonstrating problem.

comment:1 by sdlime, 21 years ago

Status: newassigned

comment:2 by sdlime, 14 years ago

Description: modified (diff)
Resolution: fixed
Status: assignedclosed

Fixed eons ago... Steve

Note: See TracTickets for help on using tickets.