Skip to content

skip single letter final blocks#1076

Merged
BobLd merged 1 commit intomasterfrom
fix-issue-782
Jul 9, 2025
Merged

skip single letter final blocks#1076
BobLd merged 1 commit intomasterfrom
fix-issue-782

Conversation

@EliotJones
Copy link
Copy Markdown
Member

thanks for the reviews @BobLd, I'm not sure how long I'm back for but have a little motivation again at the moment

this change attempts a fix for #782 but without reference documents I'm not certain this is the actual fix

this aligns our decoder with the behavior of pdfbox and c (https://github.com/dcurrie/ascii85/tree/master) implementations where single character final blocks are ignored rather than being written. also makes the error more informative in case it is ever encountered again.

also adds more test cases for ASCII85.

it is possible this is hiding the problem and will move the error elsewhere but this matches the implementation behavior of the 2 reference implementations.

one other potential source for the error is if pdf supports '<~' as a start of data marker which i can't find in the spec but wikipedia says might be possible? https://en.wikipedia.org/wiki/Ascii85#Adobe_version however the source for this is a single implementation in a language I don't understand.

without documents to trigger the error i think this is the best fix for now

align with the behavior of pdfbox and c implementations where
single character final blocks are ignored rather than being written.
also makes the error more informative in case it is ever encountered
again.

add more test cases.

it is possible this is hiding the problem and will move the error elsewhere
but this matches the implementation behavior of the 2 reference
implementations. one other potential source for the error is if pdf supports
'<~' as a start of data marker which i can't find in the spec but wikipedia
says might be possible? without documents to trigger the error i think
this is the best fix for now
@EliotJones EliotJones requested a review from BobLd July 8, 2025 23:18
@BobLd BobLd merged commit 7fe60ff into master Jul 9, 2025
2 checks passed
@BobLd BobLd deleted the fix-issue-782 branch July 9, 2025 06:33
@RikanoAlienaris
Copy link
Copy Markdown

I can confirm that issue #782 has not been resolved yet. I’m currently using version 0.1.10 and I’m getting the same exception.

image image

EMAIL_1000508799.pdf

I provide the problematic PDF in order to be able to test it.

@BobLd
Copy link
Copy Markdown
Collaborator

BobLd commented Jul 16, 2025

@RikanoAlienaris the issue you are facing should be fixed, but not in 0.1.10

Can you try with the latest pre-release version? 0.1.11-alpha-20250715-016b7 should work

@RikanoAlienaris
Copy link
Copy Markdown

You're absolutely right, I didn't realize it wasn't a stable version yet. It does look like the issue is resolved now. Sorry about that.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants