Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#2144 closed defect (fixed)

msAddLabel causes segfault when passed a NULL labelObj

Reported by: dmorissette Owned by: dmorissette
Priority: normal Milestone: 5.0 release
Component: MapServer C Library Version:
Severity: normal Keywords:
Cc: tamas, sdlime

Description

Tamas reported via mapserver-dev that in msEmbedScalebar msAddLabel is invoked with the following parameters:

msAddLabel(map, l, 0, -1, -1, &point, NULL, " ", 1.0, NULL);

the last parameter causes a segfault in the msAddLabel function.

Change History (4)

comment:1 by dmorissette, 17 years ago

Resolution: fixed
Status: newclosed

Fixed in r6276

This is related to the recent changes to implement label priority. I didn't know that msAddLabel() could be called with a NULL labelObj.

I just found out that msAddLabel() already contained code to use the class label if the label arg is NULL. The fix for the current bug was simply to make sure this is run before the code that looks up the priority level.

With respect to the embedded scalebar and legend, I've also made a change to set their priority level to MS_MAX_PRIORITY_LEVEL in the temporary layerObj that is used to render them so that they take precedence over any map label.

comment:2 by dmorissette, 17 years ago

Steve, I added you to CC to ask if you knew of cases other than embedded scalebars and legends that use the labelcache this way and that should be set to MS_MAX_LABEL_PRIORITY

comment:3 by tamas, 17 years ago

Ok, that's working by now.

comment:4 by sdlime, 17 years ago

There is a POSTLABELCACHE option for layers so that you can draw things like copyrights after all labels render but that is independent of the cache. So *I think* all is well.

Steve

Note: See TracTickets for help on using tickets.