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

Fix memory leak in tidy output handler on error

Closes GH-18649.
This commit is contained in:
Niels Dossche
2025-05-25 10:17:19 +02:00
parent ff2c7dc0f8
commit b39e17b06c
2 changed files with 8 additions and 5 deletions

3
NEWS
View File

@@ -18,6 +18,9 @@ PHP NEWS
- Soap:
. Fix memory leaks in php_http.c when call_user_function() fails. (nielsdos)
- Tidy:
. Fix memory leak in tidy output handler on error. (nielsdos)
05 Jun 2025, PHP 8.3.22
- Core:

View File

@@ -965,6 +965,11 @@ static int php_tidy_output_handler(void **nothing, php_output_context *output_co
TidyBuffer inbuf, outbuf, errbuf;
if (TG(clean_output) && (output_context->op & PHP_OUTPUT_HANDLER_START) && (output_context->op & PHP_OUTPUT_HANDLER_FINAL)) {
if (ZEND_SIZE_T_UINT_OVFL(output_context->in.used)) {
php_error_docref(NULL, E_WARNING, "Input string is too long");
return status;
}
doc = tidyCreate();
tidyBufInit(&errbuf);
@@ -972,11 +977,6 @@ static int php_tidy_output_handler(void **nothing, php_output_context *output_co
tidyOptSetBool(doc, TidyForceOutput, yes);
tidyOptSetBool(doc, TidyMark, no);
if (ZEND_SIZE_T_UINT_OVFL(output_context->in.used)) {
php_error_docref(NULL, E_WARNING, "Input string is too long");
return status;
}
TIDY_SET_DEFAULT_CONFIG(doc);
tidyBufInit(&inbuf);