Skip to content

Commit 5bb0ba4

Browse files
committed
Add sanity checks to avoid segfaults in Mapscript pointObj::draw() (updated)
1 parent 8ff7bb2 commit 5bb0ba4

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

Diff for: mapdraw.c

+3-8
Original file line numberDiff line numberDiff line change
@@ -2253,13 +2253,8 @@ int msDrawPoint(mapObj *map, layerObj *layer, pointObj *point, imageObj *image,
22532253
}
22542254
theclass = layer->class[classindex];
22552255

2256-
if(labeltext) {
2257-
if(theclass->numlabels > 0) {
2258-
label = theclass->labels[0];
2259-
} else {
2260-
msSetError(MS_MISCERR, "Label missing for layer: %s", "msDrawPoint()", layer->name);
2261-
return MS_FAILURE;
2262-
}
2256+
if(labeltext && theclass->numlabels > 0) {
2257+
label = theclass->labels[0];
22632258
}
22642259

22652260
switch(layer->type) {
@@ -2277,7 +2272,7 @@ int msDrawPoint(mapObj *map, layerObj *layer, pointObj *point, imageObj *image,
22772272
return MS_FAILURE;
22782273
}
22792274
}
2280-
if(labeltext && *labeltext) {
2275+
if(label && labeltext && *labeltext) {
22812276
textSymbolObj *ts = msSmallMalloc(sizeof(textSymbolObj));
22822277
initTextSymbol(ts);
22832278
msPopulateTextSymbolForLabelAndString(ts, label, msStrdup(labeltext), layer->scalefactor, image->resolutionfactor, layer->labelcache);

0 commit comments

Comments
 (0)