Fix OTS issue with empty index (#15289)

This commit is contained in:
Calixte Denizet 2022-08-08 22:04:14 +02:00
parent 40f9f7e909
commit 04f78c935c
3 changed files with 13 additions and 3 deletions

View File

@ -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];

View File

@ -0,0 +1,2 @@
https://github.com/mozilla/pdf.js/files/9280755/issue15289.pdf

View File

@ -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"
}
]