[php-src] master: Merge branch 'PHP-8.6'

From: Date: Fri, 13 Nov 2026 04:59:18 +0000
Subject: [php-src] master: Merge branch 'PHP-8.6'
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-143672@lists.php.net to get a copy of this message
Author: David Carlier (devnexen) Date: 2026-11-13T04:58:21Z Commit: https://github.com/php/php-src/commit/48e34bf6348b0e9c5818218aeb06f8121cde3e24 Raw diff: https://github.com/php/php-src/commit/48e34bf6348b0e9c5818218aeb06f8121cde3e24.diff Merge branch 'PHP-8.6' * PHP-8.6: 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 68e62d9a1e29..2d3191cf62dd 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

« previous php.cvs (#143672) next »