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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: d0sboots at gmail dot com
New email:
PHP Version: OS:

 

 [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: Wed May 29 08:01:32 2024 UTC