Skip to content

Consider non-recursive parser #659

@NWilson

Description

@NWilson

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions