Opened 21 years ago

Closed 21 years ago

Last modified 20 years ago

#470 closed defect (fixed)

msCopyMap causes segfault in absence of fontset

Reported by: sgillies@… Owned by: sgillies@…
Priority: high Milestone:
Component: MapScript Version: 4.0
Severity: normal Keywords:
Cc: gsibilio@…

Description

For a mapObj created from a map file with no fontset definition, the msCopyMap
function used in mapObj::clone() segfaults.

A work around may be to declare an empty fontset file.  This works for me, 
but I only tested with a MapServer with truetype support enabled.  Will 
check to see if the bug can be avoided when there is no truetype support.

The fix shouldn't be too much, just check to see if there is a fontset 
beforing calling the msCopyFontSet function.

Attachments (1)

mapserver_patch_bug470.txt (375 bytes ) - added by sgillies@… 21 years ago.
Patch to mapcopy.c fixing bug 470

Download all attachments as: .zip

Change History (4)

by sgillies@…, 21 years ago

Attachment: mapserver_patch_bug470.txt added

Patch to mapcopy.c fixing bug 470

comment:1 by sgillies@…, 21 years ago

Resolution: fixed
Status: newclosed
This bug is fixed in main CVS and branch-4-0.  A patch is also attached and 
should be applied to the 4.0.1 mapserver release.  Two lines in mapcopy.c
are replaced by one line.

If for some reason a user cannot or does not want to patch and recompile, the
bug can be avoided by executing one extra statement in the mapscript application.
Before calling the clone() method of a mapObj with no defined fontset, simply
set the mapObj's fontset.filename to something other than a NULL value.  
For example:

    mapobj = mapObj('nofontset.map')
    mapobj.fontset.filename = ''
    clone_mapobj = mapobj.clone()

If the map file defines a fontset, mapobj.fontset.filename begins with a
non-NULL value and the bug will not occur, so do not bind a new value to 
the fontset.filename.

comment:2 by gsibilio@…, 20 years ago

op_sys: AllWindows XP
rep_platform: AllPC

comment:3 by gsibilio@…, 20 years ago

Cc: gsibilio@… added
rep_platform: PCAll
Note: See TracTickets for help on using tickets.