Repository navigation
Fix leak of a hooked property value when the get hook throws in var_export() and get_object_vars() - #25830
Closed
lacatoire wants to merge 2 commits into
Closed
Fix leak of a hooked property value when the get hook throws in var_export() and get_object_vars()#25830lacatoire wants to merge 2 commits into
lacatoire wants to merge 2 commits into
Conversation
The value read from a hooked property was not released when an exception was pending after the read, as json_encode() already does.
The get hook can publish its return value into tmp and then throw while its frame is freed, for example from the destructor of one of its locals. Destroy it on the exception exit, as json_encode() does.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
var_export()andget_object_vars()read a hooked property into a local zval and bail out when an exception is pending, without releasing it. The get hook can fill that zval and still throw while its frame is freed, for example from the destructor of one of its locals. GH-22919 fixed the same leak injson_encode(); this applies the same fix to the two other readers.To reproduce
Before (8.4.28, 8.5.13):
After: