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

Merge branch 'PHP-8.3'

* PHP-8.3:
  Fix memory leak in tidy_repair_file()
This commit is contained in:
Niels Dossche
2024-07-08 13:31:25 +02:00
2 changed files with 13 additions and 1 deletions

View File

@@ -47,6 +47,12 @@ try {
} catch (\Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
tidy_repair_file($path);
} catch (\Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--CLEAN--
<?php
@@ -58,3 +64,4 @@ int(0)
ValueError: Input string is too long
ValueError: Input string is too long
ValueError: Input string is too long
ValueError: tidy_repair_file(): Argument #1 ($filename) Input string is too long

View File

@@ -304,7 +304,12 @@ static void php_tidy_quick_repair(INTERNAL_FUNCTION_PARAMETERS, bool is_file)
}
if (ZEND_SIZE_T_UINT_OVFL(ZSTR_LEN(data))) {
zend_argument_value_error(1, "is too long");
if (is_file) {
zend_string_release_ex(data, false);
zend_argument_value_error(1, "Input string is too long");
} else {
zend_argument_value_error(1, "is too long");
}
RETURN_THROWS();
}