Skip to content

Commit

Permalink
Merge pull request #18766 from Snuffleupagus/issue-18765
Browse files Browse the repository at this point in the history
Ignore non-existing /Shading resources during parsing (issue 18765)
  • Loading branch information
Snuffleupagus authored Sep 21, 2024
2 parents 96cdff4 + 67af371 commit ea2172e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
26 changes: 19 additions & 7 deletions src/core/evaluator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2132,14 +2132,26 @@ class PartialEvaluator {
break;

case OPS.shadingFill:
var shadingRes = resources.get("Shading");
if (!shadingRes) {
throw new FormatError("No shading resource found");
}
let shading;
try {
const shadingRes = resources.get("Shading");
if (!shadingRes) {
throw new FormatError("No shading resource found");
}

var shading = shadingRes.get(args[0].name);
if (!shading) {
throw new FormatError("No shading object found");
shading = shadingRes.get(args[0].name);
if (!shading) {
throw new FormatError("No shading object found");
}
} catch (reason) {
if (reason instanceof AbortException) {
continue;
}
if (self.options.ignoreErrors) {
warn(`getOperatorList - ignoring Shading: "${reason}".`);
continue;
}
throw reason;
}
const patternId = self.parseShading({
shading,
Expand Down
1 change: 1 addition & 0 deletions test/pdfs/issue18765.pdf.link
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://github.com/user-attachments/files/17065251/LUCID.-.Asif.Rasha-1.pdf
10 changes: 10 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3021,6 +3021,16 @@
"lastPage": 1,
"type": "eq"
},
{
"id": "issue18765",
"file": "pdfs/issue18765.pdf",
"md5": "7763ead2aa69db3a5263f92bb1922e31",
"link": true,
"talos": false,
"rounds": 1,
"lastPage": 1,
"type": "eq"
},
{
"id": "issue11139",
"file": "pdfs/issue11139.pdf",
Expand Down

0 comments on commit ea2172e

Please sign in to comment.