Skip to content
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

Consider non-recursive parser #659

Open
NWilson opened this issue Jan 8, 2025 · 0 comments
Open

Consider non-recursive parser #659

NWilson opened this issue Jan 8, 2025 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@NWilson
Copy link
Member

NWilson commented Jan 8, 2025

At the moment, the parser uses a seriously large amount of stack for patterns with 255 nested parentheses. The unit tests running in CI need to have the stack limit increased on several platforms to cope with this, for example on platforms where there's 1MiB of stack (which should Enough for Anybody™).

It would be perfectly feasible, technically, to have one giant loop with explicit stack management that spills the parser state to the heap when encountering very deeply-nested parens.

With my security hat on, it would be really nice if PCRE2 had roughly ~fixed stack usage, to mitigate the risk of a customer's application crashing when a user supplies a big regex that causes megabytes of stack to be consumed.

@NWilson NWilson added the enhancement New feature or request label Jan 8, 2025
@NWilson NWilson modified the milestones: 10.46, Future Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant