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

Auto-close any open BMC/BDC when ending text (bug 1898053) #18151

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

calixteman
Copy link
Contributor

No description provided.

@calixteman
Copy link
Contributor Author

/botio test

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.241.84.105:8877/d43ceb4eba5d4d0/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

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

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/d43ceb4eba5d4d0/output.txt

Total script time: 27.95 mins

  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 24
  different first/second rendering: 2

Image differences available at: http://54.241.84.105:8877/d43ceb4eba5d4d0/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/a19b0d1062ef276/output.txt

Total script time: 43.38 mins

  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 8

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

case OPS.endMarkedContent:
markedContentLevel--;
Copy link
Collaborator

Choose a reason for hiding this comment

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

You need to protect against this becoming negative, note

pdf.js/src/core/evaluator.js

Lines 3426 to 3434 in b7b8e5e

case OPS.endMarkedContent:
flushTextContentItem();
if (includeMarkedContent) {
if (markedContentData.level === 0) {
// Handle unbalanced beginMarkedContent/endMarkedContent
// operators (fixes issue15629.pdf).
break;
}
markedContentData.level--;

@@ -1732,6 +1732,7 @@ class PartialEvaluator {
const stateManager = new StateManager(initialState);
const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
const timeSlotManager = new TimeSlotManager();
let markedContentLevel = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This behaves subtly different than the code in getTextContent, which keeps the existing level-state when parsing /Form XObjects.

Perhaps that's not actually necessary to do, but my point here is that getOperatorList and getTextContent should handle markedContent-levels in /Form XObjects the same way (whatever that way is).

@timvandermeij
Copy link
Contributor

Moreover, it looks like the FreeText Editor FreeText accessibility must check that the parent structTree id is correct integration test fails on this PR since it fails on both Linux and Windows and I haven't seen this one fail before (so while it could still be an intermittent failure it seems unlikely). We should check if that is indeed caused by this change or if it's a new intermittent.

@Snuffleupagus
Copy link
Collaborator

Having looked at a few real-world PDF documents recently it seems to be fairly common (e.g. with /ActualText entries) for BDC/EMC-blocks to be nested within each other, hence I unfortunately cannot imagine that just closing any open ones on end-text is actually correct in the general case.

@calixteman
Copy link
Contributor Author

Yep, I think I've a fix for it, I'll try to do that this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Opening PDF documents in Chromium-based browsers causes a STATUS_STACK_OVERFLOW failure
4 participants