php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59326 recolorimage is implemented wrong and leads to segfaults
Submitted: 2010-07-29 01:37 UTC Modified: 2010-07-29 03:28 UTC
From: d0sboots at gmail dot com Assigned:
Status: Closed Package: imagick (PECL)
PHP Version: 5.3.1 OS: Debian Linux
Private report: No CVE-ID: None
 [2010-07-29 01:37 UTC] d0sboots at gmail dot com
Description:
------------
In RecolorImage, the underlying call is:

1394: status = MagickRecolorImage(intern->magick_wand, 
num_elements, array);

However, MagickRecolorImage expects the 2nd parameter to be 
the number of *rows* in the matrix, i.e. the square root of 
the number of elements in the array. This causes ImageMagick 
to read off the end of the array and segfault and/or cause 
garbage transformations.

Reproduce code:
---------------
image.recolorImage(array(1.0, 0.0, 0.0, 1.0));

Expected result:
----------------
The image will not be perturbed. The 2x2 matrix given is a 
subset of the identity matrix.

Actual result:
--------------
An arbitrary transformation occurs and/or php crashes.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-29 03:28 UTC] mkoppanen@php.net
This bug has been fixed in SVN.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.

Fixed in trunk now. The same issue was present for convolveimage as well.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 12:01:32 2024 UTC