com php-src: Fixed Bug #66890 imagescale segfault: ext/gd/gd.c
| From: | Remi Collet | Date: | Wed, 12 Mar 2014 12:44:58 +0000 |
| Subject: | com php-src: Fixed Bug #66890 imagescale segfault: ext/gd/gd.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-76458@lists.php.net to get a copy of this message | ||
Commit: dada2f550f7f805cb4e111c0e13cf1da98e711be
Author: Remi Collet <remi@php.net> Wed, 12 Mar 2014 13:44:58 +0100
Parents: f8252aa537e9a31d9b910f724cc5606b388ca0fb
Branches: PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=dada2f550f7f805cb4e111c0e13cf1da98e711be
Log:
Fixed Bug #66890 imagescale segfault
zend_parse_parameters "l" expect long, not int
Bugs:
https://bugs.php.net/66890
Changed paths:
M ext/gd/gd.c
Diff:
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 1058eae..1b8366d 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -5102,12 +5102,16 @@ PHP_FUNCTION(imagescale)
zval *IM;
gdImagePtr im;
gdImagePtr im_scaled;
- int new_width, new_height = -1;
- gdInterpolationMethod method = GD_BILINEAR_FIXED;
+ int new_width, new_height;
+ long tmp_w, tmp_h=-1, tmp_m = GD_BILINEAR_FIXED;
+ gdInterpolationMethod method;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|ll", &IM, &new_width,
&new_height, &method) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|ll", &IM, &tmp_w,
&tmp_h, &tmp_m) == FAILURE) {
return;
}
+ method = tmp_m;
+ new_width = tmp_w;
+ new_height = tmp_h;
ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd);
im_scaled = gdImageScale(im, new_width, new_height);