php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34996 ImageTrueColorToPalette crashes when ncolors is zero
Submitted: 2005-10-26 23:05 UTC Modified: 2005-10-26 23:37 UTC
From: php at eder dot us Assigned:
Status: Closed Package: GD related
PHP Version: 5.0.5 OS: FC 4, FreeBSD 5.3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php at eder dot us
New email:
PHP Version: OS:

 

 [2005-10-26 23:05 UTC] 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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-26 23:37 UTC] tony2001@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC