From: php at eder dot us Operating system: FC 4, FreeBSD 5.3 PHP version: 5.0.5 PHP Bug Type: GD related Bug description: ImageTrueColorToPalette crashes when ncolors is zero
Description: ------------ When ImageTrueColorToPalette is called with ncolors = to zero (or an uninitialized variable), it segfaults. Note: if $img is not loaded with a valid jpg, it will not crash, simply error on bad image resource. So make sure 'test.jpg' points to a valid jpeg. Reproduce code: --------------- <?php $img = imagecreatefromjpeg('test.jpg'); ImageTrueColorToPalette($img, false, 0); ?> Expected result: ---------------- No expected output, simply $img should be an indexed image. Actual result: -------------- Segmentation fault -- Edit bug report at http://bugs.php.net/?id=34996&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34996&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34996&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34996&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34996&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34996&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34996&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34996&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34996&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34996&r=support Expected behavior: http://bugs.php.net/fix.php?id=34996&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34996&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34996&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34996&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34996&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34996&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34996&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34996&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34996&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34996&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34996&r=mysqlcfg