-
Notifications
You must be signed in to change notification settings - Fork 10k
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
base: master
Are you sure you want to change the base?
Conversation
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.241.84.105:8877/d43ceb4eba5d4d0/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.193.163.58:8877/a19b0d1062ef276/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/d43ceb4eba5d4d0/output.txt Total script time: 27.95 mins
Image differences available at: http://54.241.84.105:8877/d43ceb4eba5d4d0/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/a19b0d1062ef276/output.txt Total script time: 43.38 mins
Image differences available at: http://54.193.163.58:8877/a19b0d1062ef276/reftest-analyzer.html#web=eq.log |
case OPS.endMarkedContent: | ||
markedContentLevel--; |
There was a problem hiding this comment.
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
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; |
There was a problem hiding this comment.
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).
Moreover, it looks like the |
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. |
Yep, I think I've a fix for it, I'll try to do that this week. |
No description provided.