Skip to content
Permalink
Browse files
Add sanity checks to avoid segfaults in Mapscript pointObj::draw() (u…
…pdated)
  • Loading branch information
bragef committed Dec 19, 2019
1 parent 8ff7bb2 commit 5bb0ba48982ec205ad582c5e866947d0b07d6245
Showing 1 changed file with 3 additions and 8 deletions.
@@ -2253,13 +2253,8 @@ int msDrawPoint(mapObj *map, layerObj *layer, pointObj *point, imageObj *image,
}
theclass = layer->class[classindex];

if(labeltext) {
if(theclass->numlabels > 0) {
label = theclass->labels[0];
} else {
msSetError(MS_MISCERR, "Label missing for layer: %s", "msDrawPoint()", layer->name);
return MS_FAILURE;
}
if(labeltext && theclass->numlabels > 0) {
label = theclass->labels[0];
}

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

0 comments on commit 5bb0ba4

Please sign in to comment.