Repository navigation
fix(documents): keep an outline item /Prev readable - #432
Merged
Merged
Conversation
/Prev and /XRefStm denote an incremental update only as trailer keys. Refusing them at the name token made any outline item that carries a previous sibling refuse the whole document as UNSUPPORTED_DOCUMENT (T-Auto#427). Refuse both keys where the trailer is read, keep /Encrypt, /ObjStm and /XRef refused at the token, and cover both directions with a regression test: the outline document from the report parses, and the same names as trailer keys are still refused, decoded escapes included.
Contributor
Author
|
Both validation runs point at the same head commit
Approving the upstream run should reproduce the green result above; nothing else is pending from my side. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #427
What was wrong
read_pdfrefused the document from the report asUNSUPPORTED_DOCUMENT("Encrypted, incremental, object-stream and xref-stream PDFs are unsupported"), even though it is a plain classic-xref PDF with no incremental section.native/crates/ops-documents/src/pdf_syntax.rs:216-223made that decision at the name token: any/Encrypt,/Prev,/XRefStm,/ObjStmor/XRefseen anywhere in the file stopped parsing. But/Previs also the key an outline item uses for its previous sibling, so an ordinary outline (<< /Title (Second) /Parent 6 0 R /Prev 7 0 R >>) made the whole document unreadable.The change
pdf_syntax.rs:name()returns/Prevand/XRefStmverbatim./Encrypt,/ObjStmand/XRefstay refused at the token, because no supported structure can hold them.pdf_container.rs: those two names are refused while the trailer dictionary is read, which is the only place they denote an earlier xref section. Code (UNSUPPORTED_DOCUMENT) and message are unchanged, so a genuinely incremental file behaves exactly as before, escaped spellings (/Pr#65v) included.docs/native-kernel.md: the parser paragraph now states which names are refused everywhere and which only as trailer keys.docs/CHANGELOG.md:## [Unreleased]entry.Deliberately not done: nothing about the other three obstacles listed in the issue (
MAX_PAGES = 32, the 16 MiB input cap, the 10,000 xref-entry cap); they stay separate issues.Validation
CI requiredrun triggered bypull_request, URL pasted belownpm run verifyoutput (below)docs/CHANGELOG.md## [Unreleased]entry addedpackage.jsonversion oroptionalDependenciesThe one failing suite is
test/linux-paths.test.mjs:143("a trailing separator is refused, not silently trimmed"). It fails identically on pristinemain(a6e215a) on this host, before this branch is applied:node test/run.mjs linux-pathsgives1 of 8 check(s) failed, and drivingnative/target/release/dsh-ops-worker.exedirectly shows.../norm.txt/and...\norm.txt\both returningstatus: completedwhile./norm.txtreturnsINVALID_ARGUMENT.mainis green upstream (run 40458041379), so this is a host-specific pre-existing red, not an effect of this change; I will open a separate issue for it.The first URL is this PR's own
pull_requestrun: as described in #150, the first run from a fork waits inaction_requireduntil a maintainer approves it. The second URL is the same head commit6574899triggered by apull_requestevent inside the fork (path (b) in the template) and it is green, so the whole cross-platform matrix has already passed this branch end to end.Environment
maina6e215anpm ci --ignore-scripts,npm run build,npm run build:ptc