Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore non-existing /Shading resources during parsing (issue 18765) #18766

Merged
merged 1 commit into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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