Repository navigation
FOP-3350: PDFPageLabels: a page label of "0" is written as a prefix label, not read past its end - #122
Open
plutext wants to merge 1 commit into
Open
FOP-3350: PDFPageLabels: a page label of "0" is written as a prefix label, not read past its end#122plutext wants to merge 1 commit into
plutext wants to merge 1 commit into
Conversation
…abel, not read past its end addPageLabel counted a decimal label's leading zeros with a do/while that ran past the end of a label made only of zeros, throwing StringIndexOutOfBoundsException. Such a label is now written as a prefix label (/P), since /St must be at least 1 (ISO 32000-1, 12.4.2). Test: PDFPageLabelsTestCase.testPageNumberedZero, which threw before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes FOP-3350.
PDFPageLabels.addPageLabelcounts a decimal label's leading zeros withwhich runs past the end of a label made only of zeros (
StringIndexOutOfBoundsException). A page numbered 0 isreachable wherever a page sequence's numbering yields 0: an extension, or a user agent that honours
initial-page-number="0", as documents converted from word processors ask for a cover page.The change. An all-zero decimal label is written as a prefix label (
/P), since/Stmust be at least 1(ISO 32000-1, 12.4.2), and the loop is skipped for it.
Test.
PDFPageLabelsTestCase.testPageNumberedZerolabels "0", "1", "2" and expects[0 << /P (0) >> 1 << /S /D >>]. Without the change it throws. With it, the fop-core suite passes, 3660 testsand 0 failures, and checkstyle reports 0 violations.
🤖 Generated with Claude Code