From 222c1098b2cc5d3e8cc6e8782098c5b134d6b089 Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Mon, 8 Aug 2022 22:04:14 +0200 Subject: [PATCH] Fix OTS issue with empty index (#15289) --- src/core/cff_parser.js | 5 ++--- test/pdfs/issue15289.pdf.link | 2 ++ test/test_manifest.json | 9 +++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 test/pdfs/issue15289.pdf.link diff --git a/src/core/cff_parser.js b/src/core/cff_parser.js index 78ebb167bed344..fd1a120427a302 100644 --- a/src/core/cff_parser.js +++ b/src/core/cff_parser.js @@ -1864,10 +1864,9 @@ class CFFCompiler { // First 2 bytes contains the number of objects contained into this index const count = objects.length; - // If there is no object, just create an index. This technically - // should just be [0, 0] but OTS has an issue with that. + // If there is no object, just create an index. if (count === 0) { - return [0, 0, 0]; + return [0, 0]; } const data = [(count >> 8) & 0xff, count & 0xff]; diff --git a/test/pdfs/issue15289.pdf.link b/test/pdfs/issue15289.pdf.link new file mode 100644 index 00000000000000..0fd7733b403115 --- /dev/null +++ b/test/pdfs/issue15289.pdf.link @@ -0,0 +1,2 @@ +https://github.com/mozilla/pdf.js/files/9280755/issue15289.pdf + diff --git a/test/test_manifest.json b/test/test_manifest.json index 6635609a4922c9..797c19a87cce67 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -6882,5 +6882,14 @@ "md5": "8505033d63625dfd77e90a3722b0c316", "rounds": 1, "type": "eq" + }, + { "id": "issue15289", + "file": "pdfs/issue15289.pdf", + "md5": "f3d20aee398e052ac3dce7cc030f50de", + "link": true, + "rounds": 1, + "firstPage": 1, + "lastPage": 1, + "type": "eq" } ]