Releases: chappihappymeal/pdf
Release list
v0.2.0 — absorbed upstream bug-fix PRs
This release absorbs the open bug-fix PRs from ledongthuc/pdf with their original authorship preserved, adds our own fixes found while reviewing them, and hardens malformed-page handling.
Fixes
- Truncated PDF no longer OOMs:
readArraylooped forever appendingio.EOFas an object, allocating without bound (measured ~7 GB before OOM kill on a real-world file). Absorbed ledongthuc/pdf#79 by @spencerkimball, with its regression test. - Stray
]no longer panics:readObjecttreats]like>>— a dictionary with a missing value (<< /A ] >>) degrades instead of panicking. Absorbed from ledongthuc/pdf#64 by @yama6a; regression test added here. /Contentsstream arrays: a PDF object split across two content streams hung text extraction forever. Absorbed ledongthuc/pdf#76 by @rztaylor (one lexer over anio.MultiReader), with its regression test. On top of it, the concatenated streams are now separated with whitespace: raw concatenation glued adjacent tokens together (20+5lexes as205), silently corrupting text coordinates or panickingPage.Content()withbad Td.- Missing content stream: a page whose
/Contentshas no stream data panicked out ofPage.Content()and text extraction; it now degrades to an empty page. Idea from ledongthuc/pdf#46 by @utsav82, reimplemented (the original compared against a freshly constructed error, which never matches). - No more stdout pollution:
readDictprintedDEBUG: ...lines to the caller's stdout on dictionaries with non-name keys.
ledongthuc/pdf#58 by @roeey777 independently reached the same conclusions on both the readArray loop and the stream concatenation — credit to it as well.
Verification
Every fix ships with a regression test verified red on the previous code. Full suite runs under -race. Output on a production bank-statement corpus is byte-for-byte identical to v0.1.0.
What's next
ledongthuc/pdf#78 (hardening against malformed and hostile inputs, +1170 lines, 101 test assertions) is under review for the next release.
Install
go get github.com/chappihappymeal/pdf@v0.2.0v0.1.0 — standalone module + ASCII85 decoder fix
First tagged release of the maintained continuation of ledongthuc/pdf (rsc/pdf lineage).
Highlights
- Importable as a standalone module:
github.com/chappihappymeal/pdf— no fork orreplacedirective needed. Upstream has no tags at all, so this is also the first semver release in the lineage. - ASCII85 decoder fixed: the sanitizing reader used to strip the
zzero-group shorthand (silently dropping 4 bytes per group — corrupt output,unexpected EOFfrom a chained FlateDecode filter, and a panic escapingPage.Content()), and never signalledio.EOFat the~>end-of-data marker. Reported upstream as ledongthuc/pdf#83 with fix offered as ledongthuc/pdf#84. - Tests: 6 unit tests plus integration tests with synthetic reproduction PDFs in
testdata/, validated against poppler'spdftotextand Python'sbase64.a85decode.
Install
go get github.com/chappihappymeal/pdf@v0.1.0What's next
Triage and absorption of upstream's open bug-fix PRs (hangs, OOMs, truncated-input handling) with original authorship preserved — coming in v0.2.0.