Skip to content

ext/gd/tests: external gd-2.3.3 compatibility. #11262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ext/gd/tests/bug38212-mb.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Bug #38212 (Seg Fault on invalid imagecreatefromgd2part() parameters)
--EXTENSIONS--
gd
--SKIPIF--
<?php
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.3', '>=')) {
die("skip test requires GD 2.3.2 or older");
Copy link
Member

@Girgias Girgias May 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
die("skip test requires GD 2.3.2 or older");
die("skip test requires a version of GD older than 2.3.3");

As the current wording is kinda weird IMHO

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few pull requests open with this wording and the underlying issue (#11252) isn't quite done yet. Should I change them all now, or would it be easier to sed them afterwards?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's easy for you to do now, that would be convenient.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, it looks like I chose this wording to match the existing version-based "skip" messages. For example, https://github.com/php/php-src/blob/master/ext/gd/tests/bug43121.phpt#L8

That same phrase (with various version triplets) already appears 25 times in ext/gd/tests. I'm still happy to change it though if this doesn't change anyone's mind.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. IMO if it's already this way anyway, it can be kept. It's not that important after all.
If we end up disliking the wording I can simply amend it later.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, if it's already liek this leave it then

}
?>
--FILE--
<?php
require __DIR__ . '/func.inc';
Expand Down
6 changes: 6 additions & 0 deletions ext/gd/tests/bug38212.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Bug #38212 (Seg Fault on invalid imagecreatefromgd2part() parameters)
--EXTENSIONS--
gd
--SKIPIF--
<?php
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.3', '>=')) {
die("skip test requires GD 2.3.2 or older");
}
?>
--FILE--
<?php
require __DIR__ . '/func.inc';
Expand Down
4 changes: 4 additions & 0 deletions ext/gd/tests/bug41442.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Bug #41442 (imagegd2() under output control)
gd
--SKIPIF--
<?php
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.3', '>=')) {
die("skip test requires GD 2.3.2 or older");
}

if (!function_exists("imagegd2")) {
die("skip GD2 support unavailable");
}
Expand Down
8 changes: 8 additions & 0 deletions ext/gd/tests/bug71912-mb.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ Bug #71912 (libgd: signedness vulnerability)
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--
Expand Down
9 changes: 7 additions & 2 deletions ext/gd/tests/bug71912.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ Bug #71912 (libgd: signedness vulnerability)
gd
--SKIPIF--
<?php
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.0', '<')) {
die("skip test requires GD 2.2.0 or higher");
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');
?>
Expand Down
10 changes: 8 additions & 2 deletions ext/gd/tests/bug72339.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@ gd
--SKIPIF--
<?php
if (!function_exists("imagecreatefromgd2")) print "skip";
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.2', '<')) {
die("skip test requires GD 2.2.2 or higher");

if (!GD_BUNDLED) {
if (version_compare(GD_VERSION, '2.2.2', '<')) {
die("skip test requires GD 2.2.2 or higher");
}
if (version_compare(GD_VERSION, '2.3.3', '>=')) {
die("skip test requires GD 2.3.2 or older");
}
}
?>
--FILE--
Expand Down
6 changes: 6 additions & 0 deletions ext/gd/tests/bug73161.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Bug #73161 (imagecreatefromgd2() may leak memory)
We're testing for a memory leak that might not even show up with valgrind.
--EXTENSIONS--
gd
--SKIPIF--
<?php
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.3', '>=')) {
die("skip test requires GD 2.3.2 or older");
}
?>
--FILE--
<?php
$im = imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . 'bug73161.gd2');
Expand Down
6 changes: 6 additions & 0 deletions ext/gd/tests/bug73868.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Bug 73868 (DOS vulnerability in gdImageCreateFromGd2Ctx())
--EXTENSIONS--
gd
--SKIPIF--
<?php
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.3', '>=')) {
die("skip test requires GD 2.3.2 or older");
}
?>
--FILE--
<?php
var_dump(imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . 'bug73868.gd2'));
Expand Down
6 changes: 6 additions & 0 deletions ext/gd/tests/bug73869.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Bug #73869 (Signed Integer Overflow gd_io.c)
--EXTENSIONS--
gd
--SKIPIF--
<?php
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.3', '>=')) {
die("skip test requires GD 2.3.2 or older");
}
?>
--FILE--
<?php
var_dump(imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . 'bug73869a.gd2'));
Expand Down
6 changes: 6 additions & 0 deletions ext/gd/tests/crafted_gd2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Test max colors for a gd image.
--EXTENSIONS--
gd
--SKIPIF--
<?php
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.3', '>=')) {
die("skip test requires GD 2.3.2 or older");
}
?>
--FILE--
<?php
imagecreatefromgd(__DIR__ . '/crafted.gd2');
Expand Down
3 changes: 3 additions & 0 deletions ext/gd/tests/createfromgd2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ imagecreatefromgd2
gd
--SKIPIF--
<?php
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.3', '>=')) {
die("skip test requires GD 2.3.2 or older");
}
if (!function_exists('imagecreatefromgd2')) die("skip gd extension not available\n");
?>
--FILE--
Expand Down
4 changes: 4 additions & 0 deletions ext/gd/tests/gif2gd.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ gif --> gd1/gd2 conversion test
gd
--SKIPIF--
<?php
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.3', '>=')) {
die("skip test requires GD 2.3.2 or older");
}

if (!function_exists("imagecreatefromgif")) {
die("skip gif read support unavailable");
}
Expand Down
4 changes: 4 additions & 0 deletions ext/gd/tests/jpg2gd-mb.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ jpeg <--> gd1/gd2 conversion test
gd
--SKIPIF--
<?php
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.3', '>=')) {
die("skip test requires GD 2.3.2 or older");
}

if (!function_exists("imagecreatefromjpeg") || !function_exists("imagejpeg")) {
die("skip jpeg support unavailable");
}
Expand Down
4 changes: 4 additions & 0 deletions ext/gd/tests/jpg2gd.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ jpeg <--> gd1/gd2 conversion test
gd
--SKIPIF--
<?php
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.3', '>=')) {
die("skip test requires GD 2.3.2 or older");
}

if (!function_exists("imagecreatefromjpeg") || !function_exists("imagejpeg")) {
die("skip jpeg support unavailable");
}
Expand Down
4 changes: 4 additions & 0 deletions ext/gd/tests/png2gd.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ png <--> gd1/gd2 conversion test
gd
--SKIPIF--
<?php
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.3', '>=')) {
die("skip test requires GD 2.3.2 or older");
}

if (!function_exists("imagecreatefrompng") || !function_exists("imagepng")) {
die("skip png support unavailable");
}
Expand Down
4 changes: 4 additions & 0 deletions ext/gd/tests/xpm2gd.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ xpm --> gd1/gd2 conversion test
gd
--SKIPIF--
<?php
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.3.3', '>=')) {
die("skip test requires GD 2.3.2 or older");
}

if (!function_exists("imagecreatefromxpm")) {
die("skip xpm read support unavailable");
}
Expand Down