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:
3
NEWS
3
NEWS
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user