Bug #66625 [Com]: imagescale() segmentation fault on 64bits environment
Edit report at https://bugs.php.net/bug.php?id=66625&edit=1
ID: 66625
Comment by: mwanat at forall dot pl
Reported by: yoya at awm dot jp
Summary: imagescale() segmentation fault on 64bits
environment
Status: Open
Type: Bug
Package: GD related
Operating System: Any
PHP Version: 5.5.8
Block user comment: N
Private report: N
New Comment:
Confirmed on 64Bit CentOS & PHP 5.5.10
Previous Comments:
------------------------------------------------------------------------
[2014-02-02 03:50:22] yoya at awm dot jp
Description:
------------
* ext/gd.c
----
PHP_FUNCTION(imagescale)
{
zval *IM;
gdImagePtr im;
gdImagePtr im_scaled;
int new_width, new_height = -1;
gdInterpolationMethod method = GD_BILINEAR_FIXED;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|ll", &IM,
&new_width, &new_height, &method) == FAILURE) {
----
On 64 bits environment ,'l'(long) have 64 bits width, int and gdInterpolationMethod type
have 32 bits, so IM pointer be destroyed by value of other variables.
This problem related to id:65171, I guess.
- https://bugs.php.net/bug.php?id=65171
Test script:
---------------
<?php
$data = file_get_contents($argv[1]);
$im = ImageCreateFromString($data);
$im2 = imagescale($im, 256, 192, IMG_NEAREST_NEIGHBOUR);
imagepng($im2, 'output.png');
Actual result:
--------------
Segmentation fault
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66625&edit=1
Thread (4 messages)