1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.2'

* PHP-8.2:
  Fix most external GD 2.3.3 compatibility
This commit is contained in:
Niels Dossche
2023-07-06 21:44:00 +02:00
28 changed files with 126 additions and 17 deletions

View File

@@ -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';

View File

@@ -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';

View File

@@ -13,7 +13,9 @@ $im = imagecreatefrompng(__DIR__ . '/bug39780.png');
var_dump($im);
?>
--EXPECTF--
gd-png: fatal libpng error: Read Error: truncated data
gd-png error: setjmp returns error condition 2
Warning: imagecreatefrompng(): v%sbug39780.png" is not a valid PNG file in /%s on line %d
Warning: imagecreatefrompng(): gd-png: fatal libpng error: Read Error: truncated data%win %s on line %d
Warning: imagecreatefrompng(): gd-png error: setjmp returns error condition %d%win %s on line %d
Warning: imagecreatefrompng(): "%sbug39780.png" is not a valid PNG file in %s on line %d
bool(false)

View File

@@ -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");
}

View File

@@ -9,4 +9,4 @@ imagepng($img);
imagedestroy($img);
?>
--EXPECTF--
Warning: imagepng(): gd-png error: no colors in palette in %s on line %d
Warning: imagepng(): gd-png error: no colors in palette%win %s on line %d

View File

@@ -38,7 +38,7 @@ Array
[height] => 10
)
Warning: imagecrop(): One parameter to a memory allocation multiplication is negative or zero, failing operation gracefully
Warning: imagecrop(): %cne parameter to a memory allocation multiplication is negative or zero, failing operation gracefully
in %s on line %d
bool(false)
object(GdImage)#2 (0) {
@@ -46,6 +46,6 @@ object(GdImage)#2 (0) {
object(GdImage)#2 (0) {
}
Warning: imagecrop(): Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
Warning: imagecrop(): %croduct of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
in %s on line %d
bool(false)

View File

@@ -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--

View File

@@ -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');
?>

View File

@@ -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--

View File

@@ -2,6 +2,12 @@
Bug #73155 (imagegd2() writes wrong chunk sizes on boundaries)
--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 = imagecreate(64, 64);

View File

@@ -2,6 +2,12 @@
Bug #73157 (imagegd2() ignores 3rd param if 4 are given)
--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 = imagecreate(8, 8);

View File

@@ -2,6 +2,12 @@
Bug #73159 (imagegd2(): unrecognized formats may result in corrupted files)
--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 = imagecreatetruecolor(10, 10);

View File

@@ -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');

View File

@@ -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'));

View File

@@ -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'));

View File

@@ -16,6 +16,6 @@ $img = imagecreate(2**28, 1);
var_dump(imagescale($img, 1, 1, IMG_TRIANGLE));
?>
--EXPECTF--
Warning: imagescale():%S Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
Warning: imagescale():%S %croduct of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
in %s on line %d
bool(false)

View File

@@ -15,10 +15,10 @@ imagecolorallocate($im, 0, 0, 0);
imagewbmp($im, __DIR__ . '/77479.wbmp');
?>
--EXPECTF--
Warning: imagewbmp():%S Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
Warning: imagewbmp():%S %croduct of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
in %s on line %d
Warning: imagewbmp(): Could not create WBMP in %s on line %d
Warning: imagewbmp(): Could not create WBMP%win %s on line %d
--CLEAN--
<?php
@unlink(__DIR__ . '/77479.wbmp');

View File

@@ -15,7 +15,7 @@ $im = imagecreatefromxbm($filepath);
var_dump($im);
?>
--EXPECTF--
Warning: imagecreatefromxbm(): Invalid XBM in %s on line %d
Warning: imagecreatefromxbm(): %cnvalid XBM in %s on line %d
Warning: imagecreatefromxbm(): "%s" is not a valid XBM file in %s on line %d
bool(false)

View File

@@ -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');

View File

@@ -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--

View File

@@ -43,6 +43,6 @@ $im = imagecreatefromwbmp($filename);
unlink($filename);
?>
--EXPECTF--
gd warning: Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
Warning: imagecreatefromwbmp(): %croduct of memory allocation multiplication would exceed INT_MAX, failing operation gracefully%win %s on line %d
Warning: imagecreatefromwbmp(): "%s_tmp.wbmp" is not a valid WBMP file in %s on line %d

View File

@@ -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");
}

View File

@@ -2,6 +2,12 @@
imagegd() writes truecolor images without palette conversion
--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_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';

View File

@@ -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");
}

View File

@@ -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");
}

View File

@@ -13,8 +13,9 @@ $im = imagecreatefrompng(__DIR__ . '/libgd00086.png');
var_dump($im);
?>
--EXPECTF--
gd-png: fatal libpng error: Read Error: truncated data
gd-png error: setjmp returns error condition 1
Warning: imagecreatefrompng(): gd-png: fatal libpng error: Read Error: truncated data%win %s on line %d
Warning: imagecreatefrompng(): gd-png error: setjmp returns error condition %d%win %s on line %d
Warning: imagecreatefrompng(): "%slibgd00086.png" is not a valid PNG file in %s on line %d
bool(false)

View File

@@ -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");
}

View File

@@ -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");
}