-
Notifications
You must be signed in to change notification settings - Fork 602
safer cleanup when failing to compile regexps #21683
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
Merged
Merged
Conversation
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
mauke
reviewed
Feb 18, 2024
mauke
reviewed
Feb 18, 2024
mauke
reviewed
Feb 18, 2024
mauke
reviewed
Feb 18, 2024
mauke
reviewed
Feb 18, 2024
72efebc to
2016cd1
Compare
khwilliamson
approved these changes
Feb 25, 2024
|
@tonycoz looks like this can be merged? |
|
@tonycoz, this p.r. has had merge conflicts for close to 5 months. Do you intend to go forward with it? If not, please consider closing it. Thanks. |
Prior to this commit when producing a warning the regexp compiler
would check if the warning category was marked as FATAL, and if it was
it would add clean up to the save stack to release buffers used during
compilation and to release the working REGEXP SV.
This causes two type of problems:
- if an error was already queued, Perl_ck_warner() returns even if
the warning is fatal, this meant that the normal clean up code
Perl_re_op_compile() would also run, resulting in a double free
of the buffers.
- without fatal warnings, if a $SIG{__WARN__} handler died, the
buffers and the working REGEXP SV would leak.
Avoid this by using SAVEDESTRUCTOR_X() to release the memory and
optionally the SV at the end of scope.
Fixes #21661
These can be simpler, and since we allow use of __VA_ARGS__ we can consolidate Simple_vFAIL[1-4]() into Simple_vFAILn()
We are now always prepared for death.
2016cd1 to
ce34730
Compare
|
I've rebased the PR on top of blead and removed the conflicts. Unless someone objects (or beats me to the punch), I intend on merging this within a day or two. |
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.
Prior to this commit when producing a warning the regexp compiler would check if the warning category was marked as FATAL, and if it was it would add clean up to the save stack to release buffers used during compilation and to release the working REGEXP SV.
This causes two type of problems:
if an error was already queued, Perl_ck_warner() returns even if the warning is fatal, this meant that the normal clean up code Perl_re_op_compile() would also run, resulting in a double free of the buffers.
without fatal warnings, if a $SIG{WARN} handler died, the buffers and the working REGEXP SV would leak.
Avoid this by using SAVEDESTRUCTOR_X() to release the memory and optionally the SV at the end of scope.
Fixes #21661