Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Draft
carenas wants to merge2 commits intoPCRE2Project:main
base:main
Choose a base branch
Loading
fromcarenas:expand

Conversation

@carenas
Copy link
Contributor

Mainly as a way to clean the code and make it more resilient.

It changes the behavior of the pattern/\[]{-1}/expand which 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.

@carenascarenas changed the titlepcre2text: improveexpand and its use of bufferspcre2test: improveexpand and its use of buffersAug 15, 2025
size_tpp_offset=pp-buffer;
size_tpt_offset=pt-pbuffer8;
expand_input_buffers();
expand_input_buffers(m);
Copy link
Member

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.
}
elseif (allowed_size!=buffer_size)
{
void*q=realloc(buffer,buffer_size);

Check warning

Code scanning / clang

Potential leak of memory pointed to by 'p' Warning

Potential leak of memory pointed to by 'p'
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
Copy link
Member

I apologize, I think I have created a ton of conflicts in this branch after my splitting ofpcre2test.c.

I will rebase your changes if you would like, just ask.

@NWilsonNWilson changed the base branch frommaster tomainNovember 5, 2025 15:08
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@NWilsonNWilsonNWilson left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@carenas@NWilson

[8]ページ先頭

©2009-2025 Movatter.jp