mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
0aaad46c15
* ext/gd/tests/bug45799.phpt: tweak to work with external gd. The expected output from this test contains an extra newline with gd-2.3.3 from the system (Gentoo). Adding a whitespace wildcard takes care of it, and the test still passes with the bundled version of gd. * ext/gd/tests: external gd-2.3.3 compatibility. Support for the legacy "gd" image format was removed from gd-2.3.3 upstream: https://github.com/libgd/libgd/blob/master/CHANGELOG.md#233---2021-09-12 Several tests for the gd extension utilize that format, and naturally fail when gd-2.3.3 from the system is used. This commit skips those tests when the version of gd is at least 2.3.3. * ext/gd/tests/bug73159.phpt: skip with external gd >= 2.3.3 This test uses the imagegd2() function to check that https://github.com/libgd/libgd/issues/289 is fixed. When an external gd without support for the "gd" format is used, no error is thrown, but a nonsense result is printed: this is normal. The corresponding upstream test is disabled in that situation; it's not expected to work. This commit skips the corresponding PHP test under the same circumstances to fix a test failure with external gd >= 2.3.3. * ext/gd/tests/bug73155.phpt: skip with external gd >= 2.3.3 This test uses the imagegd2() function to check that https://github.com/libgd/libgd/issues/309 is fixed. When an external gd without support for the "gd" format is used, no error is thrown, but a nonsense result is printed: this is normal. The corresponding upstream test is disabled in that situation; it's not expected to work. This commit skips the corresponding PHP test under the same circumstances to fix a test failure with external gd >= 2.3.3. * ext/gd/tests/bug73157.phpt: skip with external gd >= 2.3.3 This test ensures that the third (chunk_size) parameter to imagegd2() is respected when a fourth parameter is also given. However, when an external gd without support for the "gd" format is used, the call to imagegd2() does not really work at all. It doesn't fail, but it produces an "image" with a nonsense chunk size. To avoid failures when an external gd >= 2.3.3 is used, we skip the test entirely in that case. * ext/gd/tests/bug77973.phpt: accept lowercase "Invalid" This test fails with an external gd because the test expects "Invalid" where upstream gd says "invalid". This commit tweaks the expected output to accept an arbitrary character in the i/I position. * ext/gd/tests/bug39780_extern.phpt: update for external gd-2.3.3. Since there are no CI runs with external gd, I can only assume that this test has fallen out-of-date due to changes in PHP itself. I've tweaked the expected output (only slightly) so that the test passes with both gd-2.3.2 and gd-2.3.3. * ext/gd/tests/bug66356.phpt: update expected output for external gd. Newer (external) versions of GD start their error messages with lowercase characters, whereas this test is expecting them in uppercase. A single-character wildcard now supports both formats. * ext/gd/tests/imagegd_truecolor.phpt: skip with external gd >= 2.3.3. This test uses the imagegd() function, but the "gd" format has been disabled by default in upstream gd-2.3.3. We still get some kind of image data back from the call to imagegd(), but its "signature", "truecolor", and "size" no longer match the expected values. This commit skips the test when an external gd >= 2.3.3 is used. * ext/gd/tests/createfromwbmp2_extern.phpt: update for external gd-2.3.3. * ext/gd/tests/libgd00086_extern.phpt: update for external gd-2.3.3. Since there are no CI runs with external gd, I can only assume that this test has fallen out-of-date due to changes in PHP itself. I've tweaked the expected output (only slightly) so that the test passes with both gd-2.3.2 and gd-2.3.3. * ext/gd/tests/bug77272.phpt: update expected output for external gd. Newer (external) versions of GD start their error messages with lowercase characters, whereas this test is expecting them in uppercase. A single-character wildcard now supports both formats. * ext/gd/tests/bug77479.phpt: update for newer external gd. This test fails with gd-2.3.3 (at least) due to minor capitalization and whitespace issues. We add some wildcards to account for the difference. Closes GH-11257. Closes GH-11262. Closes GH-11264. Closes GH-11280.
25 lines
727 B
PHP
25 lines
727 B
PHP
--TEST--
|
|
Bug #71912 (libgd: signedness vulnerability)
|
|
--EXTENSIONS--
|
|
gd
|
|
--SKIPIF--
|
|
<?php
|
|
if (!GD_BUNDLED) {
|
|
if (version_compare(GD_VERSION, '2.2.0', '<')) {
|
|
die("skip test requires GD 2.2.0 or higher");
|
|
}
|
|
if (version_compare(GD_VERSION, '2.3.3', '>=')) {
|
|
die("skip test requires GD 2.3.2 or older");
|
|
}
|
|
}
|
|
if(!function_exists('imagecreatefromgd2')) die('skip imagecreatefromgd2() not available');
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . "invalid_neg_size.gd2");
|
|
?>
|
|
OK
|
|
--EXPECTF--
|
|
Warning: imagecreatefromgd2(): "%s%einvalid_neg_size.gd2" is not a valid GD2 file in %s%ebug71912.php on line %d
|
|
OK
|