[php-src] PR #18606: Fix GH-18597: Heap-buffer-overflow in zend_alloc.c when assigning string with UTF-8 bytes
| From: | nielsdos | Date: | Tue, 20 May 2025 18:49:35 +0000 |
| Subject: | [php-src] PR #18606: Fix GH-18597: Heap-buffer-overflow in zend_alloc.c when assigning string with UTF-8 bytes | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-31734@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/18606
Author: nielsdos
xmlSave() also can flush in some cases. When the encoding is not available this can fail for short
inputs, resulting in an empty string which is interned but then wrongly tagged by RETURN_NEW_STR.
Fix this by checking the error condition and switching to RETURN_STR for defense-in-depth.
This issue also exists on 8.3, but does not crash; however, due to the different API usage
internally I cannot easily fix it on 8.3. There it gives a partial output.