[PR #300] XZ: fix padding issues #954

Closed
opened 2026-01-29 22:18:20 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/adamhathcock/sharpcompress/pull/300

State: closed
Merged: Yes


SkipPadding in XZBlock and XZIndex did not always skip the right number of bytes:

  • block padding size computation used decompressed instead of compressed bytes,
  • and both were wrong for even numbers of bytes (skipped 1 when they should have skipped 3, and vice-versa).

This PR fixes both SkipPadding methods, resolves #289 and resolves #296.
I added unit tests using two new inline XZ files (an empty one, and one with 2 blocks), in order to test more cases.

Note that this relies on my previous PR #299: I created a new branch on top of the one I used for the previous PR, not sure if that was the right way to go...

**Original Pull Request:** https://github.com/adamhathcock/sharpcompress/pull/300 **State:** closed **Merged:** Yes --- `SkipPadding` in `XZBlock` and `XZIndex` did not always skip the right number of bytes: - block padding size computation used decompressed instead of compressed bytes, - and both were wrong for even numbers of bytes (skipped 1 when they should have skipped 3, and vice-versa). This PR fixes both `SkipPadding` methods, resolves #289 and resolves #296. I added unit tests using two new inline XZ files (an empty one, and one with 2 blocks), in order to test more cases. Note that this relies on my previous PR #299: I created a new branch on top of the one I used for the previous PR, not sure if that was the right way to go...
claunia added the pull-request label 2026-01-29 22:18:20 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#954