1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Ensure that the /Resources-entry is actually a dictionary (issue 15150)

Prevent issues in *corrupt* PDF documents, if the /Resources-entry is not of the correct and expected type.
This commit is contained in:
Jonas Jenwald 2022-07-08 12:06:25 +02:00
parent b0a3c9e8cf
commit c2f7942aea
4 changed files with 60 additions and 1 deletions

View file

@ -132,10 +132,12 @@ class Page {
// For robustness: The spec states that a \Resources entry has to be
// present, but can be empty. Some documents still omit it; in this case
// we return an empty dictionary.
const resources = this._getInheritableProperty("Resources");
return shadow(
this,
"resources",
this._getInheritableProperty("Resources") || Dict.empty
resources instanceof Dict ? resources : Dict.empty
);
}