com php-src: Merge branch 'PHP-7.4': ext/gd/tests/imagegd2_ nullbyte_injection.phpt ext/gd/tests/imagegd_nullbyte _injection.phpt

From: Date: Wed, 12 Jun 2019 10:06:24 +0000
Subject: com php-src: Merge branch 'PHP-7.4': ext/gd/tests/imagegd2_ nullbyte_injection.phpt ext/gd/tests/imagegd_nullbyte _injection.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-106709@lists.php.net to get a copy of this message
Commit: be73ae31324f7f3294a9467c0646dba4324c78ef Author: Christoph M. Becker <cmbecker69@gmx.de> Wed, 12 Jun 2019 12:06:24 +0200 Parents: 477d1e02ae53ba2adeebe8193f90b6d980613312 37d0c7b0e4072889ed05e7d631ee47a6bedf8ef5 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=be73ae31324f7f3294a9467c0646dba4324c78ef Log: Merge branch 'PHP-7.4' * PHP-7.4: Simplify GD null byte injection tests Changed paths: MM ext/gd/tests/imagegd2_nullbyte_injection.phpt MM ext/gd/tests/imagegd_nullbyte_injection.phpt Diff: diff --cc ext/gd/tests/imagegd2_nullbyte_injection.phpt index 537535b,2fc3050..856acae --- a/ext/gd/tests/imagegd2_nullbyte_injection.phpt +++ b/ext/gd/tests/imagegd2_nullbyte_injection.phpt @@@ -7,30 -7,8 +7,9 @@@ Testing null byte injection in imagegd --FILE-- <?php $image = imagecreate(1,1);// 1px image - - $tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); - if (!is_dir($tempdir)) { - mkdir ($tempdir, 0777, true); - } - - $userinput = "1\0"; // from post or get data - $temp = $tempdir. "/test" . $userinput .".tmp"; - - echo "\nimagegd2 TEST\n"; - try { - imagegd2($image, $temp); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - var_dump(file_exists($tempdir. "/test1")); - var_dump(file_exists($tempdir. "/test1.tmp")); + var_dump(imagegd2($image, "./foo\0bar")); + ?> ---EXPECTF-- +?> +--EXPECT-- - imagegd2 TEST - imagegd2() expects parameter 2 to be a valid path, string given - bool(false) - bool(false) + Warning: imagegd2() expects parameter 2 to be a valid path, string given in %s on line %d + NULL diff --cc ext/gd/tests/imagegd_nullbyte_injection.phpt index dbfff3b,f5479a0..6bcc0ee --- a/ext/gd/tests/imagegd_nullbyte_injection.phpt +++ b/ext/gd/tests/imagegd_nullbyte_injection.phpt @@@ -7,30 -7,8 +7,8 @@@ Testing null byte injection in imageg --FILE-- <?php $image = imagecreate(1,1);// 1px image - - $tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__)); - if (!is_dir($tempdir)) { - mkdir ($tempdir, 0777, true); - } - - $userinput = "1\0"; // from post or get data - $temp = $tempdir. "/test" . $userinput .".tmp"; - - echo "\nimagegd TEST\n"; - try { - imagegd($image, $temp); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - var_dump(file_exists($tempdir. "/test1")); - var_dump(file_exists($tempdir. "/test1.tmp")); + var_dump(imagegd($image, "./foo\0bar")); ?> ---EXPECTF-- +--EXPECT-- - imagegd TEST - imagegd() expects parameter 2 to be a valid path, string given - bool(false) - bool(false) + Warning: imagegd() expects parameter 2 to be a valid path, string given in %s on line %d + NULL

« previous php.cvs (#106709) next »