Skip to content

Conversation

@sidd1809
Copy link

@sidd1809 sidd1809 commented May 20, 2025

Issue starting in version: v4.1.1 onwards
Last working Version: v4.1.0

We recently upgraded our lz4 library from v2.6.1+incompatible to v4.1.22 and started noticing data mismatch on decompression. Identified a missed edge-case handling where Decompress/Read patterns could return 0 data length, which currently ends up leaking a previously decompressed data frame buffer.

Fix: Trim data frame buffer when it is by-passed for received buffer in a Read(recvBuf []byte) call.

Testing:

  • Ran all existing unit tests
  • Similar benchmark number.
  • Have added a unit test that consistently reproduced the data mismatch error on data size in multiple of 20MB.

@sidd1809
Copy link
Author

sidd1809 commented May 20, 2025

@pierrec it seems lz4/v4 mainline is currently broken with #228 so raising this PR on v4.1.22. Apologies!

It adds a valid check for sync.Pool put, but might require a deeper look/understanding of the data frame buffer for a fix

@sidd1809 sidd1809 marked this pull request as ready for review May 20, 2025 15:03
@ncruces
Copy link
Contributor

ncruces commented Jan 26, 2026

@sidd1809 the tests should be fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants