fix(pdf): inflater fed in 16 KiB slices (browser memory bound), shared 16 MiB candidate budget, monotonic bounded endstream search, JSON object pre-check

This commit is contained in:
bchanot committed 2026-10-11 17:08:56 +02:00
1 parent 6adc38b027
commit 3a6e92625a
6 files changed
+310 -32

No files matched your search

+7 -4
View File
@@ -143,10 +143,13 @@ never lost because of its wrapper:
with its direct `/Length` or, failing that, the distance to `endstream`;
a `/Filespec` dictionary in clear whose `/EF /F` points at the stream
gives it a name. Candidates named `osteo-report*` come first, then file
order; Flate data is inflated by the platform inflater under a 16 MiB cap
(cancelled beyond it), and the first candidate whose text is a JSON
object with a numeric `envelopeVersion` or `version` wins. Object
streams, cross-reference streams and page contents are never inflated.
order; Flate data is fed to the platform inflater in 16 KiB slices, so
memory stays bounded in browsers too, under a 16 MiB cap (cancelled
beyond it); at most 16 MiB of candidate content is examined in all, a
candidate not opening on `{` is skipped unparsed, and the first one whose
text is a JSON object with a numeric `envelopeVersion` or `version`
wins. Object streams, cross-reference streams and page contents are never
inflated.
No candidate: `attachment_stripped` when a `/Keywords` string in clear
contains `faunosteo-archive`, else `no_attachment`. A stamped file saved
with object streams (before BLK-009) hides its stamp and reads as