pcre2test: improve expand and its use of buffers#773
Draft
carenas wants to merge 2 commits intoPCRE2Project:mainfrom
Draft
pcre2test: improve expand and its use of buffers#773carenas wants to merge 2 commits intoPCRE2Project:mainfrom
expand and its use of buffers#773carenas wants to merge 2 commits intoPCRE2Project:mainfrom
Conversation
expand and its use of buffersexpand and its use of buffers
NWilson
reviewed
Aug 28, 2025
src/pcre2test.c
Outdated
| size_t pp_offset = pp - buffer; | ||
| size_t pt_offset = pt - pbuffer8; | ||
| expand_input_buffers(); | ||
| expand_input_buffers(m); |
Member
There was a problem hiding this comment.
This thing with m can't be correct, can it? It looks like m is being set to the size of the current expansion, not the size of what's in the buffer plus the new content.
What happens for this: /[a]{1000}[b]{1000}/expand
Allow for a nicer fallback in case of syntax errors in the pattern implementation while avoiding negative values masquerading as positive ones. While at it, make sure that in non LP64 environments UINT32_MAX is still considered valid. Update the data implementation to behave similarly and cleanup fixes that had accumlated unorganically.
Use realloc() for exponential resize of all buffers, which has the advantage of potentially not needing to copy. Add a parameter to `expand_input_buffers()` to indicate the minimum size required and allow a smarter fallback when the buffer can't be doubled.
Member
|
I apologize, I think I have created a ton of conflicts in this branch after my splitting of I will rebase your changes if you would like, just ask. |
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.
Mainly as a way to clean the code and make it more resilient.
It changes the behavior of the pattern
/\[]{-1}/expandwhich will now be treated as a literal instead of triggering a bogus syntax error and clarifies that no pattern or buffer could be larger than SIZE_MAX bytes.Improves error checking for 32-bit platforms and even 64-bit ones that are not LP64.