bneradt opened a new pull request, #13748: URL: https://github.com/apache/trafficserver/pull/13748
RegexMatchContext made every caller own a heap-allocated PCRE2 match context just to set a match limit. Its constructor started from a blank context rather than the shared one, so callers silently lost the shared 1 MiB JIT stack, and its hand-rolled copy and defaulted move members carried a latent null copy and double free. Passing a null context meant "use the shared one," while the shared general context wrapped malloc and free in a no-op allocator whose null would have meant the same thing. This patch replaces the type with Regex::Options, a plain value whose zero fields mean the shared default. Regex now owns the only match contexts: a default Options matches through the shared context, and a non-default one is applied to a per-thread copy of it, so the JIT stack and any future shared configuration carry over. The no-op allocator is removed. The esi URL validator now passes its match limit as Options, and regex_remap, which no longer set one, simply uses the shared context. Because regex_remap now gets the 1 MiB JIT stack, its 3 KB URL test case redirects as the rule is written. The autest now expects that redirect, and the #5762 crash property moves to a unit test that asserts exhaustion is reported as an error. New unit tests also cover that Options do not leak between calls and keep the shared JIT stack. Fixes: #13663 Co-authored-by: Claude Opus 5.5 Medium Related: #13660, #13683. This overlaps #13683, which fixes the same JIT stack loss while keeping RegexMatchContext; whichever lands second will need a rebase. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
