Skip to content

pp_split: assign to temp AV in @ary = split(...) optimisation #18090

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

richardleach
Copy link
Contributor

@richardleach richardleach commented Aug 26, 2020

The @ary = split(...) optimisation uses SWITCHSTACK to make @ary masquerade as the value stack. However, code that is not aware of this could modify @ary during the split and cause perl to segfault/panic/catch fire. (e.g. see added tests)

This commit makes SWITCHSTACK operate on a temporary AV instead, then swap over the relevant pointers towards the end of the function.

No user-visible changes - besides perl not crashing - are intended.

Note: this PR is standalone but comes from the discussion in #18014

@richardleach
Copy link
Contributor Author

As discussed in #18014, a different approach will be taken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant