1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/gettext/tests/gh17400.phpt
David Carlier e975c27e12 Fix GH-17400: bindtextdomain segfault with UTF-16 domain value.
The provided domain could be a non ascii value even if not supposed to,
in the error reported case was of 4 code points long but domain is "empty" leading to
a NULL return. It worked up to 8.3 "by accident" before the zend_string
conversion and check prior for emptiness.

close GH-17402
2025-01-09 13:45:59 +00:00

20 lines
436 B
PHP

--TEST--
GH-17400 bindtextdomain segfaults with invalid domain/domain with null bytes.
--EXTENSIONS--
gettext
--CREDITS--
YuanchengJiang
--FILE--
<?php
$utf16_first_le = pack("H*", "00d800dc");
$utf16le_char_bad = pack("H*", "00dc00dc");
try {
bindtextdomain($utf16le_char_bad,$utf16_first_le);
} catch (\ValueError $e) {
echo $e->getMessage();
}
?>
--EXPECT--
bindtextdomain(): Argument #1 ($domain) must not contain any null bytes