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

ext/intl: Fix for the issue where strlen could potentially become negative (#18477)

This commit is contained in:
Saki Takamachi
2025-05-02 15:10:16 +09:00
committed by GitHub
parent dd5733202d
commit f1d259a07b

View File

@@ -994,6 +994,10 @@ PHP_FUNCTION(grapheme_levenshtein)
int32_t strlen_1, strlen_2;
strlen_1 = grapheme_split_string(ustring1, ustring1_len, NULL, 0);
strlen_2 = grapheme_split_string(ustring2, ustring2_len, NULL, 0);
if (UNEXPECTED(strlen_1 < 0 || strlen_2 < 0)) {
RETVAL_FALSE;
goto out_ustring2;
}
if (strlen_1 == 0) {
RETVAL_LONG(strlen_2 * cost_ins);