Skip to content

flate: Data corruption when compressing with flate.BestCompression #1114

Closed

Description

@Hakkin

See kopia/kopia#5049 for initial details.

Reproducer here: https://go.dev/play/p/bU_ax9x8Ct2
It seems to trigger when compressing over a certain amount of data, in this case, just 1MiB of 0x00 results in:
decompress: flate: corrupt input before offset 10
when attempted to decompress the just compressed data.

This seems to have been introduced in commit 6e2f5d5, released in v1.18.1, commits before that one produce the expected output.

Activity

  1. klauspost commented on Nov 30, 2025

    @klauspost
    Owner

    Interesting. It seems to also dependent on the particular alignment of the block size. TestVeryLongSparseChunk doesn't seem to hit it.

    I will see if I can do a proper fix and avoid the revert. I will probably release and retract the old.

  2. added a commit that references this issue on Nov 30, 2025
    10b6726
  3. klauspost commented on Nov 30, 2025

    @klauspost
    Owner

    Submitted #1115 - will probably also include a retraction.

    I will leave fuzz testing running over night and probably release tomorrow.

  4. added a commit that references this issue on Dec 1, 2025
    444d5d9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions