From: bduclaux at yahoo dot com
Operating system: Linux
PHP version: 5.1.4
PHP Bug Type: GD related
Bug description: Segmentation fault in imagecreatefromgif
Description:
------------
imagecreatefromgif segfaults when broken gif images are loaded
Reproduce code:
---------------
<?php
$im=imagecreatefromgif("http://www.compuworldfrance.com/boutique/images_produits/26HEBOITIER0010_1.gif");
?>
Expected result:
----------------
Should not segfault !
Actual result:
--------------
The bug comes from the file php-5.1.4/ext/gd/libgd/gd_gif_in.c:394
Here is the full trace :
(gdb) bt
#0 LWZReadByte (fd=0x856c96c, flag=Variable "flag" is not available.
) at /home/sysop/php-5.1.4/ext/gd/libgd/gd_gif_in.c:394
#1 0x080ead3c in ReadImage (im=0x8569604, fd=0x856c96c, len=130,
height=130, cmap=0xbfffcd80, interlace=0)
at /home/sysop/php-5.1.4/ext/gd/libgd/gd_gif_in.c:520
#2 0x080eb008 in php_gd_gdImageCreateFromGifCtx (fd=0x856c96c) at
/home/sysop/php-5.1.4/ext/gd/libgd/gd_gif_in.c:199
#3 0x080d25fb in _php_image_create_from (ht=Variable "ht" is not
available.
) at /home/sysop/php-5.1.4/ext/gd/gd.c:1608
#4 0x080d281b in zif_imagecreatefromgif (ht=292440,
return_value=0x4000000, return_value_ptr=0x0, this_ptr=0x0,
return_value_used=1) at /home/sysop/php-5.1.4/ext/gd/gd.c:1674
#5 0x0822df8c in zend_do_fcall_common_helper_SPEC
(execute_data=0xbfffd510) at
/home/sysop/php-5.1.4/Zend/zend_vm_execute.h:200
#6 0x0822d971 in execute (op_array=0x85674e4) at
/home/sysop/php-5.1.4/Zend/zend_vm_execute.h:92
#7 0x08216252 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
at /home/sysop/php-5.1.4/Zend/zend.c:1109
#8 0x081e25d0 in php_execute_script (primary_file=0xbffffa10) at
/home/sysop/php-5.1.4/main/main.c:1732
#9 0x08290111 in main (argc=2, argv=0xbffffae4) at
/home/sysop/php-5.1.4/sapi/cli/php_cli.c:1092
--
Edit bug report at http://bugs.php.net/?id=38112&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=38112&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=38112&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=38112&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38112&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=38112&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38112&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38112&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38112&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38112&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38112&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=38112&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=38112&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38112&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38112&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38112&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38112&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38112&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38112&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38112&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38112&r=mysqlcfg