mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-08-05 05:47:23 +02:00
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.
This commit is contained in:
parent
e57a46436f
commit
16f5691df7
@ -132,7 +132,7 @@ class Lexer {
|
|||||||
this.pos = 0;
|
this.pos = 0;
|
||||||
this.len = data.length;
|
this.len = data.length;
|
||||||
// Sticky regexes: set lastIndex before exec() to match at an exact offset.
|
// 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;
|
this._identifierPattern = /[a-z]+/y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user