[php-src] master: Merge branch 'PHP-8.5' into PHP-8.6
| From: | David Carlier | Date: | Fri, 13 Nov 2026 04:59:16 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.5' into PHP-8.6 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143671@lists.php.net to get a copy of this message | ||
Author: David Carlier (devnexen)
Date: 2026-11-13T04:58:16Z
Commit: https://github.com/php/php-src/commit/018c5329d73096ee4b164a16e1659197e9a994df
Raw diff: https://github.com/php/php-src/commit/018c5329d73096ee4b164a16e1659197e9a994df.diff
Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
ext/gd: Fix imagecreatefromstring() continuing after the length error
Changed paths:
A ext/gd/tests/imagecreatefromstring_too_long.phpt
M ext/gd/gd.c
Diff:
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index df4b97cdf505..91d69deb9d73 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -1488,6 +1488,7 @@ PHP_FUNCTION(imagecreatefromstring)
if (ZSTR_LEN(data) > INT_MAX) {
zend_argument_value_error(1, "is too long");
+ RETURN_THROWS();
}
imtype = _php_image_type(data);
diff --git a/ext/gd/tests/imagecreatefromstring_too_long.phpt
b/ext/gd/tests/imagecreatefromstring_too_long.phpt
new file mode 100644
index 000000000000..97ab5c9e495d
--- /dev/null
+++ b/ext/gd/tests/imagecreatefromstring_too_long.phpt
@@ -0,0 +1,24 @@
+--TEST--
+imagecreatefromstring(): a string longer than INT_MAX throws without decoding it
+--EXTENSIONS--
+gd
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die('skip 64-bit only');
+if (getenv("SKIP_SLOW_TESTS")) die('skip slow test');
+?>
+--INI--
+memory_limit=-1
+--FILE--
+<?php
+$s = str_repeat("x", 2147483648);
+try {
+ imagecreatefromstring($s);
+} catch (ValueError $e) {
+ echo $e->getMessage(), "\n";
+}
+echo "Done\n";
+?>
+--EXPECT--
+imagecreatefromstring(): Argument #1 ($data) is too long
+Done