Fix bug #71952: Corruption inside imageaffinematrixget

This commit is contained in:
Stanislav Malyshev 2016-04-18 23:31:03 -07:00
parent ffc697ac27
commit f061867fd3
3 changed files with 21 additions and 1 deletions

3
NEWS
View File

@ -16,6 +16,9 @@ PHP NEWS
- Date:
. Fixed bug #71889 (DateInterval::format Segmentation fault). (Thomas Punt)
- GD:
. Fixed bug #71952 (Corruption inside imageaffinematrixget). (Stas)
- OCI8:
. Fixed bug #71422 (Fix ORA-01438: value larger than specified precision
allowed for this column). (Chris Jones)

View File

@ -5362,7 +5362,10 @@ PHP_FUNCTION(imageaffinematrixget)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number is expected as option");
RETURN_FALSE;
}
convert_to_double_ex(&options);
if(Z_TYPE_P(options) != IS_DOUBLE) {
Z_ADDREF_P(options);
convert_to_double_ex(&options);
}
angle = Z_DVAL_P(options);
if (type == GD_AFFINE_SHEAR_HORIZONTAL) {

View File

@ -0,0 +1,14 @@
--TEST--
Bug #71952 (Corruption inside imageaffinematrixget)
--SKIPIF--
<?php
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
?>
--FILE--
<?php
$vals=[str_repeat("A","200"),0,1,2,3,4,5,6,7,8,9];
imageaffinematrixget(4,$vals[0]);
var_dump($vals[0]);
?>
--EXPECTF--
string(200) "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"