#34996 [Opn->Csd]: ImageTrueColorToPalette crashes when ncolors is zero

From: Date: Wed, 26 Oct 2005 21:37:29 +0000
Subject: #34996 [Opn->Csd]: ImageTrueColorToPalette crashes when ncolors is zero
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-87114@lists.php.net to get a copy of this message
ID: 34996 Updated by: tony2001@php.net Reported By: php at eder dot us -Status: Open +Status: Closed Bug Type: GD related Operating System: FC 4, FreeBSD 5.3 PHP Version: 5.0.5 New Comment: This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2005-10-26 23:05:48] php at eder dot us 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 this bug report at http://bugs.php.net/?id=34996&edit=1

« previous php.bugs (#87114) next »