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

Merge branch 'PHP-8.4' into PHP-8.5

* PHP-8.4:
  intl: Fix leak in umsg_format_helper()
This commit is contained in:
Niels Dossche
2025-12-22 12:18:14 +01:00
3 changed files with 17 additions and 0 deletions

3
NEWS
View File

@@ -19,6 +19,9 @@ PHP NEWS
. Fixed bug GH-20631 (Integer underflow in exif HEIF parsing
when pos.size < 2). (Oblivionsage)
- Intl:
. Fix leak in umsg_format_helper(). (ndossche)
- LDAP:
. Fix memory leak in ldap_set_options(). (ndossche)

View File

@@ -455,6 +455,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo,
char *message;
spprintf(&message, 0, "Invalid UTF-8 data in string argument: "
"'%s'", ZSTR_VAL(str));
zend_tmp_string_release(tmp_str);
intl_errors_set(&err, err.code, message);
efree(message);
delete text;

View File

@@ -25,9 +25,22 @@ try {
var_dump($e::class === 'IntlException');
var_dump("MessageFormatter::format(): Invalid UTF-8 data in string argument: '\x80'" === $e->getMessage());
}
try {
var_dump($mf->format(array("foo" => new class {
function __toString(): string {
return str_repeat("\x80", random_int(1, 1));
}
})));
} catch (Throwable $e) {
var_dump($e::class === 'IntlException');
var_dump("MessageFormatter::format(): Invalid UTF-8 data in string argument: '\x80'" === $e->getMessage());
}
?>
--EXPECT--
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)