GHSA-343h-94h5-c4wr

Suggest an improvement
Source
https://github.com/advisories/GHSA-343h-94h5-c4wr
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-343h-94h5-c4wr/GHSA-343h-94h5-c4wr.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-343h-94h5-c4wr
Aliases
Published
2026-10-07T20:35:46Z
Modified
2026-10-07T20:45:07Z
Severity
  • 3.7 (Low) CVSS_V3 - CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L CVSS Calculator
Summary
yawkat LZ4 Java: LZ4BlockInputStream with stopOnEmptyBlock=false recurses once per empty block, causing StackOverflowError
Details

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.

Database specific
{
    "cwe_ids": [
        "CWE-674"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-10-07T20:35:46Z",
    "nvd_published_at": "2026-10-06T20:17:26Z",
    "severity": "LOW"
}
References

Affected packages

Maven / at.yawk.lz4:lz4-java

Package

Name
at.yawk.lz4:lz4-java
View open source insights on deps.dev
Purl
pkg:maven/at.yawk.lz4/lz4-java

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
1.11.4

Affected versions

1.*
1.8.1
1.9.0
1.10.0
1.10.1
1.10.2
1.10.3
1.10.4
1.11.0
1.11.1
1.11.2
1.11.3

Database specific

last_known_affected_version_range
"<= 1.11.3"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-343h-94h5-c4wr/GHSA-343h-94h5-c4wr.json"

Maven / org.lz4:lz4-java

Package

Name
org.lz4:lz4-java
View open source insights on deps.dev
Purl
pkg:maven/org.lz4/lz4-java

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Last Affected
1.8.1

Affected versions

1.*
1.4
1.4.0
1.4.1
1.5.0
1.5.1
1.6.0
1.7.0
1.7.1
1.8.0
1.8.1

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-343h-94h5-c4wr/GHSA-343h-94h5-c4wr.json"