Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[perl #119051] Fix crash with \&$glob_copy
$ref = *Foo::nosub; \&$ref; The assignment creates a glob copy (coercible glob; one that down- grades back to a simple scalar when assigned to). \&$ref autovivifies a stub in that glob. The CvGV pointer ends up pointing to $ref, rather than *Foo::nosub. $ref can easily cease being a glob. So crashes happen. Stub autovivification used to stringify the glob, look it up again by name, and then vivify the stub in the glob. In commit 186a5ba I removed what seemed like a waste of CPU cycles, but apparently it served some purpose. The lookup caused CvGV to point to *Foo::nosub, rather than $x. This commit restores the stringfy-and-lookup if the glob is coercible (SvFAKE). It goes a little further and turns off the SvFAKE flag if the glob just looked up is also FAKE. It turns out this bug is old, and has been triggerable via glob copies in stash elements for a long time. 186a5ba made it easier to trigger the bug (so it is a regression from 5.16).
- Loading branch information