mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 09:38:06 +02:00
Ensure that line-breaks are *only* skipped after operators in Lexer.getNumber
(PR 8359 follow-up)
With the current code line-breaks are accepted not just after an operator, but after a decimal point as well. When looking at this again, the latter case seems prone to cause false positives and might also interfere with subsequent patches. Hence this is code is adjusted to actually do what the original commit message says, and nothing more.
This commit is contained in:
parent
3b07147d98
commit
df4799a12a
2 changed files with 12 additions and 8 deletions
|
@ -734,16 +734,16 @@ var Lexer = (function LexerClosure() {
|
|||
} else if (ch === 0x2B) { // '+'
|
||||
ch = this.nextChar();
|
||||
}
|
||||
if (ch === 0x2E) { // '.'
|
||||
divideBy = 10;
|
||||
ch = this.nextChar();
|
||||
}
|
||||
if (ch === 0x0A || ch === 0x0D) { // LF, CR
|
||||
// Ignore line-breaks (this is consistent with Adobe Reader).
|
||||
do {
|
||||
ch = this.nextChar();
|
||||
} while (ch === 0x0A || ch === 0x0D);
|
||||
}
|
||||
if (ch === 0x2E) { // '.'
|
||||
divideBy = 10;
|
||||
ch = this.nextChar();
|
||||
}
|
||||
if (ch < 0x30 || ch > 0x39) { // '0' - '9'
|
||||
throw new FormatError(
|
||||
`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue