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

Merge branch 'PHP-8.2' into PHP-8.3

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

3
NEWS
View File

@@ -50,6 +50,9 @@ PHP NEWS
. Fix 32-bit wordwrap test failures. (orlitzky)
. Fixed bug GH-14774 (time_sleep_until overflow). (David Carlier)
- Tidy:
. Fix memory leak in tidy_repair_file(). (nielsdos)
- Treewide:
. Fix compatibility with libxml2 2.13.2. (nielsdos)

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();
}