From: Christoph M. Becker Date: Fri, 9 Feb 2018 23:25:29 +0000 (+0100) Subject: Align overflow error messages with upstream X-Git-Tag: php-7.3.0alpha1~465 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=70fec8a1cc0efbc36e4d302d280f2f08ab05bab6;p=php Align overflow error messages with upstream This particularly fixes two tests (bug66356.phpt and bug72339.phpt) if PHP has been build with an external libgd. --- diff --git a/ext/gd/gd_compat.c b/ext/gd/gd_compat.c index aa1d51700d..2ea1bc4d0c 100644 --- a/ext/gd/gd_compat.c +++ b/ext/gd/gd_compat.c @@ -49,11 +49,11 @@ int overflow2(int a, int b) { if(a <= 0 || b <= 0) { - php_error_docref(NULL, E_WARNING, "gd warning: one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully\n"); + php_error_docref(NULL, E_WARNING, "one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully\n"); return 1; } if(a > INT_MAX / b) { - php_error_docref(NULL, E_WARNING, "gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully\n"); + php_error_docref(NULL, E_WARNING, "product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully\n"); return 1; } return 0; diff --git a/ext/gd/libgd/gd_security.c b/ext/gd/libgd/gd_security.c index 3813707ade..2a7d4a032a 100644 --- a/ext/gd/libgd/gd_security.c +++ b/ext/gd/libgd/gd_security.c @@ -21,11 +21,11 @@ int overflow2(int a, int b) { if(a <= 0 || b <= 0) { - gd_error("gd warning: one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully\n"); + gd_error("one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully\n"); return 1; } if(a > INT_MAX / b) { - gd_error("gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully\n"); + gd_error("product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully\n"); return 1; } return 0; diff --git a/ext/gd/tests/bug66356.phpt b/ext/gd/tests/bug66356.phpt index 583d74942c..fc4a60439f 100644 --- a/ext/gd/tests/bug66356.phpt +++ b/ext/gd/tests/bug66356.phpt @@ -38,12 +38,12 @@ Array [height] => 10 ) -Warning: imagecrop(): gd warning: one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully +Warning: imagecrop(): one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully in %sbug66356.php on line %d bool(false) resource(%d) of type (gd) resource(%d) of type (gd) -Warning: imagecrop(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully +Warning: imagecrop(): product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully in %sbug66356.php on line %d bool(false) \ No newline at end of file diff --git a/ext/gd/tests/bug72339.phpt b/ext/gd/tests/bug72339.phpt index c886283346..20daea8106 100644 --- a/ext/gd/tests/bug72339.phpt +++ b/ext/gd/tests/bug72339.phpt @@ -32,7 +32,7 @@ unlink($fname); ?> --EXPECTF-- -Warning: imagecreatefromgd2(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully +Warning: imagecreatefromgd2(): product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully in %sbug72339.php on line %d Warning: imagecreatefromgd2(): '%sbug72339.gd' is not a valid GD2 file in %sbug72339.php on line %d diff --git a/ext/gd/tests/createfromwbmp2.phpt b/ext/gd/tests/createfromwbmp2.phpt index 9e7ef12dac..bbb475c423 100644 --- a/ext/gd/tests/createfromwbmp2.phpt +++ b/ext/gd/tests/createfromwbmp2.phpt @@ -42,7 +42,7 @@ $im = imagecreatefromwbmp($filename); unlink($filename); ?> --EXPECTF-- -Warning: imagecreatefromwbmp(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully +Warning: imagecreatefromwbmp(): product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully in %s on line %d Warning: imagecreatefromwbmp(): '%s' is not a valid WBMP file in %s on line %d diff --git a/ext/gd/tests/imageloadfont_invalid.phpt b/ext/gd/tests/imageloadfont_invalid.phpt index 6cf0e336b6..871d1510f0 100644 --- a/ext/gd/tests/imageloadfont_invalid.phpt +++ b/ext/gd/tests/imageloadfont_invalid.phpt @@ -19,7 +19,7 @@ imagestring($image, $font, 0, 0, "Hello", $black); unlink($filename); ?> --EXPECTF-- -Warning: imageloadfont(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully +Warning: imageloadfont(): product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully in %simageloadfont_invalid.php on line %d Warning: imageloadfont(): Error reading font, invalid font header in %simageloadfont_invalid.php on line %d diff --git a/ext/gd/tests/libgd00101.phpt b/ext/gd/tests/libgd00101.phpt index 1c6623d2e0..4154012fbd 100644 --- a/ext/gd/tests/libgd00101.phpt +++ b/ext/gd/tests/libgd00101.phpt @@ -11,7 +11,7 @@ $im = imagecreatefromgd(dirname(__FILE__) . '/libgd00101.gd'); var_dump($im); ?> --EXPECTF-- -Warning: imagecreatefromgd(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully +Warning: imagecreatefromgd(): product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully in %slibgd00101.php on line %d Warning: imagecreatefromgd(): '%slibgd00101.gd' is not a valid GD file in %slibgd00101.php on line %d