diff --git a/src/core/parser.js b/src/core/parser.js index 50ea563db..14e01e285 100644 --- a/src/core/parser.js +++ b/src/core/parser.js @@ -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; } diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 2b06b3a4e..ce4ad6084 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -16,6 +16,7 @@ !bug1727053.pdf !issue18408_reduced.pdf !bug1907000_reduced.pdf +!bug1953099.pdf !issue11913.pdf !issue2391-1.pdf !issue2391-2.pdf diff --git a/test/pdfs/bug1953099.pdf b/test/pdfs/bug1953099.pdf new file mode 100644 index 000000000..1a86a60f0 Binary files /dev/null and b/test/pdfs/bug1953099.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index e660566a9..f7ea4f2c8 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -10414,6 +10414,14 @@ "link": true, "type": "eq" }, + { + "id": "bug1953099", + "file": "pdfs/bug1953099.pdf", + "md5": "15295cfa4999ccc08442423fca96c28f", + "rounds": 1, + "link": false, + "type": "eq" + }, { "id": "bug1899804_print", "file": "pdfs/bug1899804.pdf", diff --git a/test/unit/parser_spec.js b/test/unit/parser_spec.js index 404d729a1..307f7a783 100644 --- a/test/unit/parser_spec.js +++ b/test/unit/parser_spec.js @@ -152,7 +152,17 @@ describe("parser", function () { }); it("should treat a single decimal point, or minus/plus sign, as zero", function () { - const validNums = [".", "-", "+", "-.", "+.", "-\r\n.", "+\r\n."]; + const validNums = [ + ".", + "-", + "+", + "-.", + "+.", + "-\r\n.", + "+\r\n.", + "-(", + "-<", + ]; for (const number of validNums) { const validInput = new StringStream(number); const validLexer = new Lexer(validInput);