mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Support corrupt documents with *empty* Name
-entries (issue 13610)
Apparently some really bad PDF software can create documents with *empty* `Name`-entries, which we thus need to somehow deal with. While I don't know if this patch is necessarily the best solution, it should at least ensure that the *empty* `Name`-instance cannot accidentally match a proper `Name`-instance (and it doesn't require changes to a lot of existing code).[1] --- [1] I briefly considered using a `Symbol` rather than an Object, but quickly decided against that since the former one [is not clonable](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types) and `Name`-instances may be sent to the API.
This commit is contained in:
parent
6163cd015b
commit
6467907318
5 changed files with 18 additions and 1 deletions
1
test/pdfs/issue13610.pdf.link
Normal file
1
test/pdfs/issue13610.pdf.link
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/mozilla/pdf.js/files/6694277/Unitfactuur_18707277_KORTELAND_PRINTEN.INSCANNEN.pdf
|
|
@ -1612,6 +1612,13 @@
|
|||
"rounds": 1,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "issue13610",
|
||||
"file": "pdfs/issue13610.pdf",
|
||||
"md5": "5b894c0b1b2279a245c23abd76648ca9",
|
||||
"link": true,
|
||||
"rounds": 1,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "simpletype3font-text",
|
||||
"file": "pdfs/simpletype3font.pdf",
|
||||
"md5": "b374c7543920840c61999e9e86939f99",
|
||||
|
|
|
@ -325,7 +325,7 @@ describe("evaluator", function () {
|
|||
expect(false).toEqual(true);
|
||||
} catch (reason) {
|
||||
expect(reason instanceof FormatError).toEqual(true);
|
||||
expect(reason.message).toEqual("XObject must be referred to by name.");
|
||||
expect(reason.message).toEqual("XObject should be a stream");
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue