[php-src] PR #12409: Fix GH-12392: Segmentation fault on SoapClient::__getTypes
| From: | nielsdos | Date: | Tue, 10 Oct 2023 22:28:34 +0000 |
| Subject: | [php-src] PR #12409: Fix GH-12392: Segmentation fault on SoapClient::__getTypes | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-23856@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/12409
Author: nielsdos
There are two issues:
- UAF because the hashmap resized while being iterated over, yet the local variables used internally
in the macros are not updated.
- The hashmap being iterated over is modified: entries are deleted after other entries have been
added. This causes the deletion to fail sometimes because indices of buckets have shifted.
Fix it by using a while loop iteration and HashPosition position tracker instead.
Issue exists on PHP 8.1 too, but is much harder to trigger. The test file reproduces the issue
reliably on PHP 8.2 and up.