CVE-2026-106449
yawkat LZ4 Java: LZ4BlockInputStream with stopOnEmptyBlock=false recurses once per empty block, causing StackOverflowError
Description
Summary
When LZ4BlockInputStream is configured with stopOnEmptyBlock = false (the mode for reading concatenated block streams), it handles each empty block by calling refill() recursively. A long run of empty blocks exhausts the thread stack and throws StackOverflowError out of read() or skip().
Details
In net.jpountz.lz4.LZ4BlockInputStream.refill():
if (originalLen == 0 && compressedLen == 0) {
if (check != 0) {
throw new IOException("Stream is corrupted");
}
if (!stopOnEmptyBlock) {
refill();
} else {
finished = true;
}
return;
}
Each well-formed empty block is 21 bytes and adds one stack frame, with no limit on nesting depth. In local testing, around 10,000 to 100,000 consecutive empty blocks (about 210 KB to 2.1 MB, depending on JIT state and thread stack size) threw StackOverflowError. StackOverflowError is an Error, not an IOException, so callers that only handle I/O errors for corrupt input don't catch it.
Impact
Applications that decode attacker-controlled LZ4Block streams with LZ4BlockInputStream.newBuilder().withStopOnEmptyBlock(false) or the deprecated LZ4BlockInputStream(InputStream, boolean) constructor can have the decoding thread fail with StackOverflowError. The default configuration (stopOnEmptyBlock = true) is not affected. There is no memory corruption. Availability impact only.
Patch
Fixed in lz4-java 1.11.4. Empty blocks are now skipped in a loop instead of by recursion, so any number of consecutive empty blocks uses constant stack space.
For older versions, the workaround is to use the default stopOnEmptyBlock = true for untrusted input, or catch StackOverflowError around the read loop.
Affected Maven artifacts (2)
| Artifact | Affected versions | Fixed in |
|---|---|---|
| at.yawk.lz4 » lz4-java | < 1.11.4 | 1.11.4 |
| org.lz4 » lz4-java | <= 1.8.1 | - |
Blast radius
78% of the dependent artifacts (15,136) still pull an affected version in their latest release.
| Depth | Dependent versions |
|---|---|
| Direct | 43,610 |
| 2 hops | 408,044 |
| 3 hops | 308,662 |
| 4 hops | 195,065 |
| 5 hops | 74,099 |
| 6 hops | 22,252 |
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.
References
- Webhttps://github.com/yawkat/lz4-java/security/advisories/GHSA-343h-94h5-c4wr
- Advisoryhttps://nvd.nist.gov/vuln/detail/CVE-2026-106449
- Webhttps://github.com/yawkat/lz4-java/commit/c8ebf97d504fb34434fda46fc761e8202570e0d8
- Packagehttps://github.com/yawkat/lz4-java
- Webhttps://github.com/yawkat/lz4-java/releases/tag/v1.11.4
