Files
sharpcompress/tests/SharpCompress.Test
Fidel de8ee30b17 BZip2: add opt-in tolerateTruncatedStream to decode a footerless/partial stream
Add a `tolerateTruncatedStream` option (default false) to `BZip2Stream.Create`/`CreateAsync`,
threaded through to `CBZip2InputStream`. When enabled, the decoder accepts a stream that has no
trailing footer - e.g. a truncated stream, or a sub-range of blocks extracted for random access:

- An end-of-input reached while reading a block/footer header (a true block boundary, tracked by
  `expectingBlockStart`) is treated as a normal end of stream instead of throwing
  `ArchiveOperationException("BZip2 compressed file ends unexpectedly")`. EOF in the middle of a
  block, the block CRC, or the Huffman tables still throws.
- The whole-stream combined CRC in the footer is not verified, since a partial decode's running
  combined CRC won't match the stored whole-stream value. Per-block CRCs are still enforced.

Default behaviour is unchanged (the flag defaults to false) and the change is applied symmetrically
to the sync and async read paths.

Tests (BZip2StreamTests):
- a footerless header-only stream decodes to empty with the flag and throws without it;
- a real block followed by end-of-input at the next block boundary decodes with the flag and throws
  without it;
- a corrupted whole-stream combined CRC is tolerated with the flag and fatal without it;
- a complete, well-formed stream still round-trips with the flag set.
All existing BZip2 tests continue to pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 13:08:02 +10:00
..
2026-04-21 10:55:59 +01:00
2026-02-04 09:25:48 +00:00
2026-04-21 10:55:59 +01:00
2025-10-13 10:40:43 +01:00
2026-06-15 17:02:31 +01:00
2026-04-21 10:55:59 +01:00
2026-04-29 11:50:51 +01:00
2026-06-15 09:29:50 +01:00
2026-05-05 17:48:39 +01:00
2026-06-15 09:29:50 +01:00
2026-06-13 15:09:13 +01:00
2026-05-29 15:11:39 +01:00
2026-06-15 09:59:48 +01:00
2026-06-19 11:21:39 +01:00
2026-01-08 12:35:12 +00:00
2026-04-30 13:07:34 +01:00
2026-04-21 11:04:14 +01:00
2024-04-23 09:16:05 +01:00
2026-06-15 09:17:05 +01:00
2026-06-02 09:13:00 +01:00
2026-04-21 11:04:14 +01:00
2026-04-23 11:43:10 +01:00
2026-04-27 17:17:31 +01:00
2025-01-15 04:43:16 +03:00
2026-05-14 08:26:02 +01:00
2026-05-14 08:26:02 +01:00
2026-04-23 11:19:09 +01:00
2026-04-21 10:55:59 +01:00
2026-01-16 08:58:26 +00:00