You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Test that the JNI safe decompressor never exposes stale destination bytes #123
CVE-2025-66566 was fixed in the Java decompressor: offset-0 matches are zero-filled and matchOff < destOff throws. The JNI safe decompressor passes out + destOff to LZ4_decompress_safe (net_jpountz_lz4_LZ4JNI.c:271), so upstream's lowPrefix is dest + destOff.
My understanding of upstream lz4.c at the pinned submodule commit:
matches reaching before lowPrefix are rejected;
offset-0 matches with offsets below 8 zero the output first (LZ4_write32(op, 0));
the byte-by-byte path that would keep stale bytes only runs in partial decoding, which we don't use.
So this is most likely fine, but it isn't verified. Add a canary test run against LZ4Factory.nativeInstance().safeDecompressor():
Repeat with direct and heap ByteBuffers, since those take separate JNI branches, and with offsets 1-7 and long offset-0 matches. Also compare the output with safeInstance().safeDecompressor().
Activity
Test safe decompressors with destination offsets and buffer kinds (#146)