mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
When a backward greedy loop backtracked toward the right edge of the input, the optimized scan for a following Char instruction could stop making progress at end of input and loop forever. This made patterns like /(?<=a.?)/ hang on non-matching input.
9 lines
265 B
JavaScript
9 lines
265 B
JavaScript
test("greedy lookbehind backtracking makes progress at end of input", () => {
|
|
expect(/(?<=a.?)/.exec("b")).toBeNull();
|
|
|
|
let match = /(?<=a.?)/.exec("ab");
|
|
expect(match).not.toBeNull();
|
|
expect(match[0]).toBe("");
|
|
expect(match.index).toBe(1);
|
|
});
|