Skip to content

Commit

Permalink
Fix OTS issue with empty index (mozilla#15289)
Browse files Browse the repository at this point in the history
  • Loading branch information
calixteman authored and rousek committed Aug 10, 2022
1 parent fca82b7 commit 222c109
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/core/cff_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 2 additions & 0 deletions test/pdfs/issue15289.pdf.link
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
https://github.com/mozilla/pdf.js/files/9280755/issue15289.pdf

9 changes: 9 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]

0 comments on commit 222c109

Please sign in to comment.