Opened 17 years ago

Closed 17 years ago

#1959 closed enhancement (invalid)

Bug with msInsertLayer function

Reported by: kwegezeder@… Owned by: sdlime
Priority: high Milestone:
Component: MapServer C Library Version: 4.8
Severity: minor Keywords:
Cc:

Description

The msLayerInsert function could not handle to insert a new layerObj at the last
position of the mapObj's layer array. Like an append. Problem is, that the
msInsertLayer function try to free the layerObj at the new array position. But
this layerObj at the new array position where never initialised and no old
LayerObj was there. The Null-pointer guard in the msFree function fails, because
the pointers of  the layerObj are undefined and not NULL. msFree try to free
uninitialied pointers.

Change History (3)

comment:1 by kwegezeder@…, 17 years ago

Severity: trivialminor

comment:2 by kwegezeder@…, 17 years ago

Severity: minormajor

comment:3 by kwegezeder@…, 17 years ago

Resolution: invalid
Severity: majorenhancement
Status: newclosed
Sorry this isn't bug. I haven't seen, that the code:

if (nIndex < 0) { /* Insert at the end by default */
        initLayer(&(map->layers[map->numlayers]), map);
        msCopyLayer(&(map->layers[map->numlayers]), layer);
        map->layerorder[map->numlayers] = map->numlayers;
        map->layers[map->numlayers].index = map->numlayers;
        map->numlayers++;
        return map->numlayers-1;
}

some lines befor protect this problem.

Note: See TracTickets for help on using tickets.