The vulnerability is a quadratic-time (Θ(n²)) denial of service in re2js's lookbehind matching. The root cause is in Machine.match (and Machine.matchSet), where the line let currentPos = this.prog.numLb > 0 ? 0 : pos forced the NFA scan to always restart at offset 0 whenever the pattern contained a lookbehind (prog.numLb > 0). Because lookbehind automata are prefixed with .*? and must observe every character, restarting from offset 0 on every call re-walks the entire input. The early-exit optimization (if (this.ncap === 0 && this.matched) break) never fires through the Matcher-based APIs because they always request ncap = 2 (one capture group slot), even for captureless lookbehind patterns. As a result, a find-loop over k matches in an n-character string costs k × Θ(n), which is Θ(n²) for dense matches.
The fix (commit dfdd947785dfa113bdc97416375c246a39458395) introduces a LookbehindState class that carries the lookbehind automata state between successive searches over the same input, so each search resumes from where the previous one left off instead of restarting at offset 0. The state is threaded through Matcher.genMatch/find, RE2.executeEngine, RE2.doExecuteNFA, RE2.replaceAllFunc, and RE2.allMatches. The vulnerable functions are those that, in the pre-fix version, either forced the offset-0 restart (Machine.match, Machine.matchSet) or failed to carry lookbehind state between repeated matches (Matcher.genMatch/find, RE2.doExecuteNFA/executeEngine/replaceAllFunc/allMatches).