Skip to content

Catch circular references in /Form XObjects (issue 19800) #19803

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

Merged
merged 2 commits into from
Apr 11, 2025

Conversation

Snuffleupagus
Copy link
Collaborator

For simplicity we will abort /Form XObject parsing immediately when encountering a circular reference, rather than letting it continue up until some limit (as e.g. PDFium appears to do), which should be fine since there are never any guarantees if/how corrupt PDF documents will render.

@Snuffleupagus Snuffleupagus force-pushed the issue-19800 branch 2 times, most recently from 900fb56 to 0abfefd Compare April 11, 2025 09:00
@Snuffleupagus
Copy link
Collaborator Author

/botio test

@mozilla mozilla deleted a comment from moz-tools-bot Apr 11, 2025
@mozilla mozilla deleted a comment from moz-tools-bot Apr 11, 2025
@mozilla mozilla deleted a comment from moz-tools-bot Apr 11, 2025
@mozilla mozilla deleted a comment from moz-tools-bot Apr 11, 2025
@Snuffleupagus
Copy link
Collaborator Author

/botio unittest

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_unittest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/89298a43847ddc1/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_unittest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/cc049feae29da96/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/89298a43847ddc1/output.txt

Total script time: 2.32 mins

  • Unit Tests: Passed

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/cc049feae29da96/output.txt

Total script time: 7.72 mins

  • Unit Tests: Passed

@Snuffleupagus
Copy link
Collaborator Author

/botio browsertest

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_browsertest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/fcd49388a19e6bb/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_browsertest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/6f41904794a612d/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/6f41904794a612d/output.txt

Total script time: 16.50 mins

  • Regression tests: FAILED
  different ref/snapshot: 1

Image differences available at: http://54.241.84.105:8877/6f41904794a612d/reftest-analyzer.html#web=eq.log

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/fcd49388a19e6bb/output.txt

Total script time: 29.52 mins

  • Regression tests: FAILED
  different ref/snapshot: 1

Image differences available at: http://54.193.163.58:8877/fcd49388a19e6bb/reftest-analyzer.html#web=eq.log

@Snuffleupagus Snuffleupagus requested review from calixteman and removed request for calixteman April 11, 2025 11:31
@calixteman
Copy link
Contributor

Would you know why we have the same "failing" ref test on both bots ?

@Snuffleupagus
Copy link
Collaborator Author

Snuffleupagus commented Apr 11, 2025

Would you know why we have the same "failing" ref test on both bots ?

As far as I can tell that would be caused by using another /Resources dictionary now, i.e. the "correct" one courtesy of the first patch (needed to address a circular dependency), which has a slightly different /SMask-entry.

@Snuffleupagus Snuffleupagus linked an issue Apr 11, 2025 that may be closed by this pull request
Copy link
Contributor

@calixteman calixteman left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you.

In rare cases /Resources are also found in the /Contents stream-dict, in addition to in the /Page dict, hence we need to prefer those when available; see `issue18894.pdf`.
For simplicity we will abort /Form XObject parsing *immediately* when encountering a circular reference, rather than letting it continue up until some limit (as e.g. PDFium appears to do), which should be fine since there are never any guarantees if/how *corrupt* PDF documents will render.
@Snuffleupagus Snuffleupagus merged commit 9c6e2e6 into mozilla:master Apr 11, 2025
9 checks passed
@Snuffleupagus
Copy link
Collaborator Author

/botio makeref

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_makeref from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/12de9aa9d394b8b/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_makeref from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/f7d2c76915bc117/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/12de9aa9d394b8b/output.txt

Total script time: 16.11 mins

  • Make references: Passed
  • Check references: Passed

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/f7d2c76915bc117/output.txt

Total script time: 29.68 mins

  • Make references: Passed
  • Check references: Passed

@Snuffleupagus Snuffleupagus deleted the issue-19800 branch April 11, 2025 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Circular references in Form XObjects cause endless loop
3 participants