com php-src: remove the huge test file, generate it on the fly instead: ext/gd/tests/bug72339.gd ext/gd/tests/bug72339.phpt

From: Date: Tue, 21 Jun 2016 07:57:39 +0000
Subject: com php-src: remove the huge test file, generate it on the fly instead: ext/gd/tests/bug72339.gd ext/gd/tests/bug72339.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-92555@lists.php.net to get a copy of this message
Commit: fa8e1c026ae6db322b724c23811ec20c5bb9df05 Author: Anatol Belski <ab@php.net> Tue, 21 Jun 2016 09:42:38 +0200 Parents: 7dde353ee79fcee73873cc19e1124704b94bd366 Branches: PHP-5.6.23 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fa8e1c026ae6db322b724c23811ec20c5bb9df05 Log: remove the huge test file, generate it on the fly instead Changed paths: D ext/gd/tests/bug72339.gd M ext/gd/tests/bug72339.phpt Diff: diff --git a/ext/gd/tests/bug72339.gd b/ext/gd/tests/bug72339.gd deleted file mode 100644 index 0634c99..0000000 Binary files a/ext/gd/tests/bug72339.gd and /dev/null differ diff --git a/ext/gd/tests/bug72339.phpt b/ext/gd/tests/bug72339.phpt index 763ae71..2c30ee8 100644 --- a/ext/gd/tests/bug72339.phpt +++ b/ext/gd/tests/bug72339.phpt @@ -3,7 +3,29 @@ Bug #72339 Integer Overflow in _gd2GetHeader() resulting in heap overflow --SKIPIF-- <?php if (!function_exists("imagecreatefromgd2")) print "skip"; ?> --FILE-- -<?php imagecreatefromgd2(dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug72339.gd"); ?> +<?php +$fname = dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug72339.gd"; + +$fh = fopen($fname, "w"); +fwrite($fh, "gd2\x00"); +fwrite($fh, pack("n", 2)); +fwrite($fh, pack("n", 1)); +fwrite($fh, pack("n", 1)); +fwrite($fh, pack("n", 0x40)); +fwrite($fh, pack("n", 2)); +fwrite($fh, pack("n", 0x5AA0)); // Chunks Wide +fwrite($fh, pack("n", 0x5B00)); // Chunks Vertically +fwrite($fh, str_repeat("\x41\x41\x41\x41", 0x1000000)); // overflow data +fclose($fh); + +$im = imagecreatefromgd2($fname); + +if ($im) { + imagedestroy($im); +} +unlink($fname); + +?> --EXPECTF-- Warning: imagecreatefromgd2(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully in %sbug72339.php on line %d

« previous php.cvs (#92555) next »