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

Check and handle circular references when processing XObject forms and fix #671 #676

Merged
merged 1 commit into from
Aug 5, 2023

Conversation

BobLd
Copy link
Collaborator

@BobLd BobLd commented Aug 5, 2023

Check and handle circular references when processing XObject forms and fix #671

@BobLd
Copy link
Collaborator Author

BobLd commented Aug 5, 2023

@EliotJones tests are now fixed, let me know what you think about the method to handle that

@@ -603,6 +603,12 @@ private void ProcessFormXObject(StreamToken formStream)
// 3. We don't respect clipping currently.

// 4. Paint the objects.
if (parsingOptions.UseLenientParsing && xObjectName != null && operations.OfType<InvokeNamedXObject>()?.Any(o => o.Name == xObjectName) == true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this still stack overflow when parsingOptions.UseLenientParsing is false? Maybe the other branch of this if should throw an exception in that case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would yes,and makes sense to throw an exception. Will update that

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to do further investigation in fact. MOZILLA-3136-0.pdf is flagged as having circular reference now, but was never an issue with that (it seems)

Copy link
Collaborator Author

@BobLd BobLd Aug 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EliotJones I've updated the logic to also check each forms data so that MOZILLA-3136-0 is not flag as having a problem. We also now throw an exception when circular references exist

@BobLd BobLd merged commit d1e8b42 into master Aug 5, 2023
1 check passed
@BobLd BobLd deleted the issue-671 branch August 5, 2023 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

StackOverflow Exception
2 participants