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

Let Lexer.prototype.getNumber treat more cases of a single minus sign as zero (bug 1953099)

This patch extends the approach of PR 14543, by also treating e.g. minus signs followed by '(' or '<' as zero.
Inside of a /Contents stream those characters will generally mean the start of one or more glyphs.
This commit is contained in:
Jonas Jenwald 2025-03-12 16:35:37 +01:00
parent d74619847d
commit ee34c5c648
5 changed files with 27 additions and 3 deletions

View file

@ -933,9 +933,14 @@ class Lexer {
if (ch < /* '0' = */ 0x30 || ch > /* '9' = */ 0x39) {
const msg = `Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`;
if (isWhiteSpace(ch) || ch === /* EOF = */ -1) {
if (
isWhiteSpace(ch) ||
/* '(' = */ ch === 0x28 ||
/* '<' = */ ch === 0x3c ||
ch === /* EOF = */ -1
) {
// This is consistent with Adobe Reader (fixes issue9252.pdf,
// issue15604.pdf, bug1753983.pdf).
// issue15604.pdf, bug1753983.pdf, bug1953099.pdf).
info(`Lexer.getNumber - "${msg}".`);
return 0;
}