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

Merge branch 'PHP-8.3' into PHP-8.4

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

3
NEWS
View File

@@ -22,6 +22,9 @@ PHP NEWS
- GD:
. Fixed bug GH-20622 (imagestring/imagestringup overflow). (David Carlier)
- Intl:
. Fix leak in umsg_format_helper(). (ndossche)
- LDAP:
. Fix memory leak in ldap_set_options(). (ndossche)

View File

@@ -457,6 +457,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, 1);
efree(message);
delete text;

View File

@@ -14,6 +14,12 @@ $mf = new MessageFormatter('en_US', $fmt);
var_dump($mf->format(array("foo" => 7, "\x80" => "bar")));
var_dump($mf->format(array("foo" => "\x80")));
var_dump($mf->format(array("foo" => new class {
function __toString(): string {
return str_repeat("\x80", random_int(1, 1));
}
})));
?>
--EXPECTF--
Warning: MessageFormatter::format(): Invalid UTF-8 data in argument key: '€' in %s on line %d
@@ -21,3 +27,6 @@ bool(false)
Warning: MessageFormatter::format(): Invalid UTF-8 data in string argument: '€' in %s on line %d
bool(false)
Warning: MessageFormatter::format(): Invalid UTF-8 data in string argument: '€' in %s on line %d
bool(false)