[php-src] PR #19995: Fix double-free of EG(errors)/persistent_script->warnings on persist of already persisted file
| From: | iluuu1994 | Date: | Mon, 29 Sep 2025 22:59:23 +0000 |
| Subject: | [php-src] PR #19995: Fix double-free of EG(errors)/persistent_script->warnings on persist of already persisted file | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-33395@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/19995
Author: iluuu1994
Both processes race to compile warning_replay.inc. Whichever is first will get to persist the
script. The loser will use the script that is already persisted, and the script that was just
compiled is freed.
However, EG(errors) and persistent_script->warnings still refer to the same allocation, and
EG(errors) becomes a dangling pointer. To solve this, we simply set EG(errors) and EG(num_errors) to
NULL and 0, respectively.
Furthermore, we need to adjust some calls to zend_emit_recorded_errors() that would previously use
EG(errors), even when persistent_script has been swapped out.
Fixes GH-19984