CVE-2026-59949
LZ4 Java: Native XXHash implementations can crash the JVM when passed invalid byte array ranges
Description
Summary
Insufficient validation of byte array arguments in JNI-based XXHash implementations in lz4-java 1.11.0 and earlier allows callers to crash the JVM by passing an invalid array reference or invalid range to native XXHash methods.
This affects applications where an attacker can influence the byte array object or the off / len arguments passed to affected XXHash APIs. It does not affect the common case where only the contents of a valid byte array are attacker-controlled.
Java-based XXHash implementations are not affected.
Details
The JNI-backed XXHash implementations pass caller-provided byte array arguments to native code. The affected APIs are:
XXHashFactory.nativeInstance().hash32().hash(byte[] buf, int off, int len, int seed)XXHashFactory.nativeInstance().hash64().hash(byte[] buf, int off, int len, long seed)XXHashFactory.nativeInstance().newStreamingHash32(seed).update(byte[] bytes, int off, int len)XXHashFactory.nativeInstance().newStreamingHash64(seed).update(byte[] bytes, int off, int len)
Before the fix, the streaming JNI implementations did not validate bytes, off, or len before calling XXHashJNI.XXH32_update / XXHashJNI.XXH64_update. The non-streaming JNI implementations called SafeUtils.checkRange, but SafeUtils.checkRange(byte[], int, int) skipped all array access when len == 0, so a null byte array with a zero length could still reach JNI.
As a result:
hash(null, 0, 0, seed)andupdate(null, 0, 0)could pass a null array reference to JNI, causing a fatal JVM crash inGetPrimitiveArrayCritical.update(new byte[16], 0, Integer.MAX_VALUE)could cause native XXHash code to read far beyond the end of the Java array, causing a fatal JVM crash and potentially exposing in-process memory to the native routine before the crash.
The oversized-length non-streaming hash(new byte[16], 0, Integer.MAX_VALUE, seed) case was already rejected in Java before this fix. The missing validation affected the streaming oversized-length case and the zero-length null-array case for both streaming and non-streaming JNI XXHash APIs.
The impact of this vulnerability depends on how user code uses the XXHash API. Code that hashes attacker-controlled byte contents in a valid, correctly bounded array is not affected. Code may be affected if an attacker can cause the application to pass a null array, an attacker-controlled offset, or an attacker-controlled length to the native XXHash API. The primary impact is denial of service due to JVM termination. For oversized lengths, native code may also read outside the Java array before the process crashes.
Mitigation
lz4-java 1.11.1 fixes this issue without requiring changes in user code.
If you cannot upgrade, avoid passing attacker-controlled array references, offsets, or lengths to JNI-backed XXHash APIs. In particular, validate that arrays are non-null and that off and len describe a range fully contained in the array before calling native XXHash methods.
Using XXHashFactory.safeInstance() avoids the JNI boundary and is not affected by this native crash behavior.
Affected Maven artifacts (2)
| Artifact | Affected versions | Fixed in |
|---|---|---|
| at.yawk.lz4 » lz4-java | < 1.11.1 | 1.11.1 |
| org.lz4 » lz4-java | <= 1.8.1 | - |
Blast radius
69% of the dependent artifacts (13,316) still pull an affected version in their latest release.
| Depth | Dependent versions |
|---|---|
| Direct | 42,464 |
| 2 hops | 400,122 |
| 3 hops | 306,123 |
| 4 hops | 194,442 |
| 5 hops | 73,842 |
| 6 hops | 22,000 |
Most used dependents
- org.apache.hadoop » hadoop-common3,482 usages
- org.apache.spark » spark-sql3,174 usages
- org.apache.kafka » kafka-clients3,135 usages
- org.apache.spark » spark-core2,899 usages
- org.codehaus.mojo » buildnumber-maven-plugin2,777 usages
- com.typesafe.play » play-test1,902 usages
- org.apache.hadoop » hadoop-client1,796 usages
- org.apache.kafka » kafka1,450 usages
- com.typesafe.play » play-server1,436 usages
- com.typesafe.play » play-logback1,380 usages
- org.elasticsearch » elasticsearch1,377 usages
- org.apache.hadoop » hadoop-mapreduce-client-core1,366 usages
- org.scalatestplus.play » scalatestplus-play1,286 usages
- com.jetbrains.intellij.platform » core1,284 usages
- com.typesafe.play » play-akka-http-server1,152 usages
Computed from the dependency graph of build 20261124.0621 (compile and runtime scopes, nearest version wins). Exclusions and dependency management in consuming projects are not applied, so dependents are potentially affected. When several artifacts are affected, a dependent version that pulls more than one of them is counted once per artifact.
