#29349 [Opn->Fbk]: imagecreatefromstring segfaults (fix included)
| From: | tony2001@php.net | Date: | Fri, 23 Jul 2004 11:50:22 +0000 |
| Subject: | #29349 [Opn->Fbk]: imagecreatefromstring segfaults (fix included) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-63414@lists.php.net to get a copy of this message | ||
ID: 29349
Updated by: tony2001@php.net
Reported By: k at ailis dot de
-Status: Open
+Status: Feedback
Bug Type: GD related
Operating System: Linux
PHP Version: 4CVS-2004-07-23 (stable)
New Comment:
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php
Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
Please, provide a gdb backtrace.
Previous Comments:
------------------------------------------------------------------------
[2004-07-23 12:01:03] k at ailis dot de
Description:
------------
imagecreatefromstring segfaults when using the external GD library. The
bundled one works. As far as I understood this problem the
imagecreatefromstring function calls gdNewDynamicCTX and this function
frees some memory which don't have to be freed. Maybe this function was
changed in the bundled GD library. But this is not needed. Instead of
gdNewDynamicCtx the function gdNewDynamicCtxEx can be used. The
additional third parameter must be 0 so the function doesn't free the
memory. Doing in in that way imagecreatefromstring works again in the
external GD library and also in the bundled one. Here is a small patch,
but please take it with care. I don't really know what you are doing
there with all these memory freeing hacks. Maybe my patch creates a
memory leak. Don't know.
--- gd.c.orig 2004-07-23 11:24:51.000000000 +0200
+++ gd.c 2004-07-23 11:31:10.000000000 +0200
@@ -1274,7 +1274,7 @@
gdImagePtr im;
gdIOCtx *io_ctx;
- io_ctx = gdNewDynamicCtx (Z_STRLEN_PP(data), Z_STRVAL_PP(data));
+ io_ctx = gdNewDynamicCtxEx (Z_STRLEN_PP(data), Z_STRVAL_PP(data),
0);
if (!io_ctx) {
return NULL;
Reproduce code:
---------------
Can't provide one. The bug seems to be very system dependend. It works
on some machines. On others it don't. It works for some image files.
With others it don't.
Expected result:
----------------
No segfault.
Actual result:
--------------
segfault ;-)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29349&edit=1