Opened 18 years ago

Closed 17 years ago

#1854 closed defect (fixed)

saveimage crash

Reported by: brage@… Owned by: jmckenna@…
Priority: high Milestone: 5.0 release
Component: MapScript-PHP Version: 4.8
Severity: normal Keywords:
Cc: jmckenna@…

Description

I have been experiencing the exact same bug as described in bug #1269, with
mapscript terminating in saveimage() while writing to sdout. The httpd process
give the warning "httpd in free(): error: modified (page-) pointer" and exits. 

After some debugging, i found that the problematic call is the call to gdFree()
in saveImage().

My setup has php loading both gd.so and php_mapscript.so at startup in
php/extensions.ini.

The problem seems to be a mismatch of gd versions. The php gd module compiles
its own version of libgd, and if the gd library is loaded before the mapscript
library, mapscript will use the php-spesific version. This should not be a
problem, except that the php version of gd.so doesn't export gdFree(). In the
php version of libgd, gdFree() is defined as a macro to efree(). The gdFree()
called by mapscript then belongs to the gd linked to mapscript and the
alloc-code used by msSaveImageBufferGD() and gdFree() does not match.

A workaround is to load the php_mapscript module before the gd module.

Change History (9)

comment:1 by dmorissette, 18 years ago

Cc: jmckenna@… added
I don't think there is much we can do about this except reminding users that
they should not use the PHP bundled GD with PHP MapScript but instead they
should use a gd.so built with the same GD as PHP MapScript.

What do you suggest brage? Perhaps add something about this to the FAQ?

comment:2 by brage@…, 18 years ago

Adding a note to the FAQ seems like a good idea. It should perhaps be noted that
it is only a problem if gd.so is dynamically loaded prior to mapscript.so.

I suspect I was lucky having BSD malloc issue a warning and killing the process,
I guess the effects might be more subtle on others systems.

comment:3 by dmorissette, 18 years ago

Jeff: Do you want to take this one to add a FAQ?

comment:4 by dmorissette, 18 years ago

Milestone: 4.10 release

comment:5 by jmckenna@…, 18 years ago

Owner: changed from mapserverbugs to jmckenna@…
ok.

comment:6 by dmorissette, 18 years ago

Cc: dmorissette@… added

comment:7 by assefa, 18 years ago

Milestone: 4.10 releaseFUTURE

comment:8 by assefa, 18 years ago

Milestone: FUTURE4.10 release
I accidently set the bug target to FUTURE. ressetting to 4.10

comment:9 by jmckenna, 17 years ago

Resolution: fixed
Status: newclosed

I have added a note regarding this in the FAQ section of http://mapserver.gis.umn.edu/docs/howto/phpmapscript-install

Note: See TracTickets for help on using tickets.