From 16f5691df74a1e2b95b5cf013a5897697448c49d Mon Sep 17 00:00:00 2001 From: calixteman Date: Tue, 4 Aug 2026 18:43:58 +0200 Subject: [PATCH] Remove the ambiguity from the PostScript number regex `\d+\.?\d*` can split a run of digits in as many ways as it is long, so it would backtrack polynomially if anything following it could reject. The optional exponent can't, hence no bug today, but `\d+(?:\.\d*)?` accepts the same numbers unambiguously. --- src/core/postscript/lexer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/postscript/lexer.js b/src/core/postscript/lexer.js index fa50551cd..7ee58cd77 100644 --- a/src/core/postscript/lexer.js +++ b/src/core/postscript/lexer.js @@ -132,7 +132,7 @@ class Lexer { this.pos = 0; this.len = data.length; // Sticky regexes: set lastIndex before exec() to match at an exact offset. - this._numberPattern = /[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?/iy; + this._numberPattern = /[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?/iy; this._identifierPattern = /[a-z]+/y; }