1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

[XFA] Fix an hidden issue in the FormCalc lexer

Since there are no script engine with XFA, the FormCalc parser is not used irl.
The bug @nmtigor noticed was hidden by another one (the wrong check on `match`).
This commit is contained in:
Calixte Denizet 2022-09-20 13:53:50 +02:00
parent 8dd2b48488
commit f5b835157b
2 changed files with 5 additions and 3 deletions

View file

@ -239,8 +239,8 @@ class Lexer {
getNumber(first) {
const match = this.data.substring(this.pos).match(numberPattern);
if (!match) {
return first - 0x30 /* = 0 */;
if (!match[0]) {
return new Token(TOKEN.number, first - 0x30 /* = 0 */);
}
const number = parseFloat(
this.data.substring(this.pos - 1, this.pos + match[0].length)