- Notifications
You must be signed in to change notification settings - Fork239
pcre2test: improveexpand and its use of buffers#773
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
expand and its use of buffersexpand and its use of buffersUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
src/pcre2test.c Outdated
| size_tpp_offset=pp-buffer; | ||
| size_tpt_offset=pt-pbuffer8; | ||
| expand_input_buffers(); | ||
| expand_input_buffers(m); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This thing withm can't be correct, can it? It looks likem 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 thepattern implementation while avoiding negative valuesmasquerading as positive ones. While at it, make sure that in nonLP64 environments UINT32_MAX is still considered valid.Update the data implementation to behave similarly and cleanupfixes that had accumlated unorganically.
Use realloc() for exponential resize of all buffers, which has theadvantage of potentially not needing to copy.Add a parameter to `expand_input_buffers()` to indicate the minimumsize required and allow a smarter fallback when the buffer can'tbe doubled.
NWilson commentedSep 26, 2025
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. |
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.