<?xml version="1.0" encoding="UTF-8"?>
<cvrfdoc xmlns="http://www.icasi.org/CVRF/schema/cvrf/1.1" xmlns:cvrf="http://www.icasi.org/CVRF/schema/cvrf/1.1">
	<DocumentTitle xml:lang="en">An update for snappy-java is now available for openEuler-20.03-LTS-SP1,openEuler-20.03-LTS-SP3,openEuler-22.03-LTS,openEuler-22.03-LTS-SP1 and openEuler-22.03-LTS-SP2</DocumentTitle>
	<DocumentType>Security Advisory</DocumentType>
	<DocumentPublisher Type="Vendor">
		<ContactDetails>openeuler-security@openeuler.org</ContactDetails>
		<IssuingAuthority>openEuler security committee</IssuingAuthority>
	</DocumentPublisher>
	<DocumentTracking>
		<Identification>
			<ID>openEuler-SA-2023-1398</ID>
		</Identification>
		<Status>Final</Status>
		<Version>1.0</Version>
		<RevisionHistory>
			<Revision>
				<Number>1.0</Number>
				<Date>2023-07-08</Date>
				<Description>Initial</Description>
			</Revision>
		</RevisionHistory>
		<InitialReleaseDate>2023-07-08</InitialReleaseDate>
		<CurrentReleaseDate>2023-07-08</CurrentReleaseDate>
		<Generator>
			<Engine>openEuler SA Tool V1.0</Engine>
			<Date>2023-07-08</Date>
		</Generator>
	</DocumentTracking>
	<DocumentNotes>
		<Note Title="Synopsis" Type="General" Ordinal="1" xml:lang="en">snappy-java security update</Note>
		<Note Title="Summary" Type="General" Ordinal="2" xml:lang="en">An update for snappy-java is now available for openEuler-20.03-LTS-SP1,openEuler-20.03-LTS-SP3,openEuler-22.03-LTS,openEuler-22.03-LTS-SP1 and openEuler-22.03-LTS-SP2.</Note>
		<Note Title="Description" Type="General" Ordinal="3" xml:lang="en">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)</Note>
		<Note Title="Topic" Type="General" Ordinal="4" xml:lang="en">An update for snappy-java is now available for openEuler-20.03-LTS-SP1,openEuler-20.03-LTS-SP3,openEuler-22.03-LTS,openEuler-22.03-LTS-SP1 and openEuler-22.03-LTS-SP2.

openEuler Security has rated this update as having a security impact of high. A Common Vunlnerability Scoring System(CVSS)base score,which gives a detailed severity rating, is available for each vulnerability from the CVElink(s) in the References section.</Note>
		<Note Title="Severity" Type="General" Ordinal="5" xml:lang="en">High</Note>
		<Note Title="Affected Component" Type="General" Ordinal="6" xml:lang="en">snappy-java</Note>
	</DocumentNotes>
	<DocumentReferences>
		<Reference Type="Self">
			<URL>https://www.openeuler.org/en/security/safety-bulletin/detail.html?id=openEuler-SA-2023-1398</URL>
		</Reference>
		<Reference Type="openEuler CVE">
			<URL>https://www.openeuler.org/en/security/cve/detail.html?id=CVE-2023-34454</URL>
			<URL>https://www.openeuler.org/en/security/cve/detail.html?id=CVE-2023-34455</URL>
		</Reference>
		<Reference Type="Other">
			<URL>https://nvd.nist.gov/vuln/detail/CVE-2023-34454</URL>
			<URL>https://nvd.nist.gov/vuln/detail/CVE-2023-34455</URL>
		</Reference>
	</DocumentReferences>
	<ProductTree xmlns="http://www.icasi.org/CVRF/schema/prod/1.1">
		<Branch Type="Product Name" Name="openEuler">
			<FullProductName ProductID="openEuler-20.03-LTS-SP1" CPE="cpe:/a:openEuler:openEuler:20.03-LTS-SP1">openEuler-20.03-LTS-SP1</FullProductName>
			<FullProductName ProductID="openEuler-20.03-LTS-SP3" CPE="cpe:/a:openEuler:openEuler:20.03-LTS-SP3">openEuler-20.03-LTS-SP3</FullProductName>
			<FullProductName ProductID="openEuler-22.03-LTS" CPE="cpe:/a:openEuler:openEuler:22.03-LTS">openEuler-22.03-LTS</FullProductName>
			<FullProductName ProductID="openEuler-22.03-LTS-SP1" CPE="cpe:/a:openEuler:openEuler:22.03-LTS-SP1">openEuler-22.03-LTS-SP1</FullProductName>
			<FullProductName ProductID="openEuler-22.03-LTS-SP2" CPE="cpe:/a:openEuler:openEuler:22.03-LTS-SP2">openEuler-22.03-LTS-SP2</FullProductName>
		</Branch>
		<Branch Type="Package Arch" Name="aarch64">
			<FullProductName ProductID="snappy-java-1.1.2.4-2" CPE="cpe:/a:openEuler:openEuler:20.03-LTS-SP1">snappy-java-1.1.2.4-2.oe1.aarch64.rpm</FullProductName>
			<FullProductName ProductID="snappy-java-1.1.2.4-2" CPE="cpe:/a:openEuler:openEuler:20.03-LTS-SP3">snappy-java-1.1.2.4-2.oe1.aarch64.rpm</FullProductName>
			<FullProductName ProductID="snappy-java-1.1.2.4-2" CPE="cpe:/a:openEuler:openEuler:22.03-LTS">snappy-java-1.1.2.4-2.oe2203.aarch64.rpm</FullProductName>
			<FullProductName ProductID="snappy-java-1.1.2.4-2" CPE="cpe:/a:openEuler:openEuler:22.03-LTS-SP1">snappy-java-1.1.2.4-2.oe2203sp1.aarch64.rpm</FullProductName>
			<FullProductName ProductID="" CPE="cpe:/a:openEuler:openEuler:22.03-LTS-SP2">snappy-java-1.1.2.4-2.oe2203sp2.aarch64.rpm</FullProductName>
		</Branch>
		<Branch Type="Package Arch" Name="noarch">
			<FullProductName ProductID="snappy-java-javadoc-1.1.2.4-2" CPE="cpe:/a:openEuler:openEuler:20.03-LTS-SP1">snappy-java-javadoc-1.1.2.4-2.oe1.noarch.rpm</FullProductName>
			<FullProductName ProductID="snappy-java-javadoc-1.1.2.4-2" CPE="cpe:/a:openEuler:openEuler:20.03-LTS-SP3">snappy-java-javadoc-1.1.2.4-2.oe1.noarch.rpm</FullProductName>
			<FullProductName ProductID="snappy-java-javadoc-1.1.2.4-2" CPE="cpe:/a:openEuler:openEuler:22.03-LTS">snappy-java-javadoc-1.1.2.4-2.oe2203.noarch.rpm</FullProductName>
			<FullProductName ProductID="snappy-java-javadoc-1.1.2.4-2" CPE="cpe:/a:openEuler:openEuler:22.03-LTS-SP1">snappy-java-javadoc-1.1.2.4-2.oe2203sp1.noarch.rpm</FullProductName>
			<FullProductName ProductID="" CPE="cpe:/a:openEuler:openEuler:22.03-LTS-SP2">snappy-java-javadoc-1.1.2.4-2.oe2203sp2.noarch.rpm</FullProductName>
		</Branch>
		<Branch Type="Package Arch" Name="src">
			<FullProductName ProductID="snappy-java-1.1.2.4-2" CPE="cpe:/a:openEuler:openEuler:20.03-LTS-SP1">snappy-java-1.1.2.4-2.oe1.src.rpm</FullProductName>
			<FullProductName ProductID="snappy-java-1.1.2.4-2" CPE="cpe:/a:openEuler:openEuler:20.03-LTS-SP3">snappy-java-1.1.2.4-2.oe1.src.rpm</FullProductName>
			<FullProductName ProductID="snappy-java-1.1.2.4-2" CPE="cpe:/a:openEuler:openEuler:22.03-LTS">snappy-java-1.1.2.4-2.oe2203.src.rpm</FullProductName>
			<FullProductName ProductID="snappy-java-1.1.2.4-2" CPE="cpe:/a:openEuler:openEuler:22.03-LTS-SP1">snappy-java-1.1.2.4-2.oe2203sp1.src.rpm</FullProductName>
			<FullProductName ProductID="" CPE="cpe:/a:openEuler:openEuler:22.03-LTS-SP2">snappy-java-1.1.2.4-2.oe2203sp2.src.rpm</FullProductName>
		</Branch>
		<Branch Type="Package Arch" Name="x86_64">
			<FullProductName ProductID="snappy-java-1.1.2.4-2" CPE="cpe:/a:openEuler:openEuler:20.03-LTS-SP1">snappy-java-1.1.2.4-2.oe1.x86_64.rpm</FullProductName>
			<FullProductName ProductID="snappy-java-1.1.2.4-2" CPE="cpe:/a:openEuler:openEuler:20.03-LTS-SP3">snappy-java-1.1.2.4-2.oe1.x86_64.rpm</FullProductName>
			<FullProductName ProductID="snappy-java-1.1.2.4-2" CPE="cpe:/a:openEuler:openEuler:22.03-LTS">snappy-java-1.1.2.4-2.oe2203.x86_64.rpm</FullProductName>
			<FullProductName ProductID="snappy-java-1.1.2.4-2" CPE="cpe:/a:openEuler:openEuler:22.03-LTS-SP1">snappy-java-1.1.2.4-2.oe2203sp1.x86_64.rpm</FullProductName>
			<FullProductName ProductID="" CPE="cpe:/a:openEuler:openEuler:22.03-LTS-SP2">snappy-java-1.1.2.4-2.oe2203sp2.x86_64.rpm</FullProductName>
		</Branch>
	</ProductTree>
	<Vulnerability Ordinal="1" xmlns="http://www.icasi.org/CVRF/schema/vuln/1.1">
		<Notes>
			<Note Title="Vulnerability Description" Type="General" Ordinal="1" xml:lang="en">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.</Note>
		</Notes>
		<ReleaseDate>2023-07-08</ReleaseDate>
		<CVE>CVE-2023-34454</CVE>
		<ProductStatuses>
			<Status Type="Fixed">
				<ProductID>openEuler-20.03-LTS-SP1</ProductID>
				<ProductID>openEuler-20.03-LTS-SP3</ProductID>
				<ProductID>openEuler-22.03-LTS</ProductID>
				<ProductID>openEuler-22.03-LTS-SP1</ProductID>
				<ProductID>openEuler-22.03-LTS-SP2</ProductID>
			</Status>
		</ProductStatuses>
		<Threats>
			<Threat Type="Impact">
				<Description>High</Description>
			</Threat>
		</Threats>
		<CVSSScoreSets>
			<ScoreSet>
				<BaseScore>7.5</BaseScore>
				<Vector>AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H</Vector>
			</ScoreSet>
		</CVSSScoreSets>
		<Remediations>
			<Remediation Type="Vendor Fix">
				<Description>snappy-java security update</Description>
				<DATE>2023-07-08</DATE>
				<URL>https://www.openeuler.org/en/security/safety-bulletin/detail.html?id=openEuler-SA-2023-1398</URL>
			</Remediation>
		</Remediations>
	</Vulnerability>
	<Vulnerability Ordinal="2" xmlns="http://www.icasi.org/CVRF/schema/vuln/1.1">
		<Notes>
			<Note Title="Vulnerability Description" Type="General" Ordinal="2" xml:lang="en">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.</Note>
		</Notes>
		<ReleaseDate>2023-07-08</ReleaseDate>
		<CVE>CVE-2023-34455</CVE>
		<ProductStatuses>
			<Status Type="Fixed">
				<ProductID>openEuler-20.03-LTS-SP1</ProductID>
				<ProductID>openEuler-20.03-LTS-SP3</ProductID>
				<ProductID>openEuler-22.03-LTS</ProductID>
				<ProductID>openEuler-22.03-LTS-SP1</ProductID>
				<ProductID>openEuler-22.03-LTS-SP2</ProductID>
			</Status>
		</ProductStatuses>
		<Threats>
			<Threat Type="Impact">
				<Description>High</Description>
			</Threat>
		</Threats>
		<CVSSScoreSets>
			<ScoreSet>
				<BaseScore>7.5</BaseScore>
				<Vector>AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H</Vector>
			</ScoreSet>
		</CVSSScoreSets>
		<Remediations>
			<Remediation Type="Vendor Fix">
				<Description>snappy-java security update</Description>
				<DATE>2023-07-08</DATE>
				<URL>https://www.openeuler.org/en/security/safety-bulletin/detail.html?id=openEuler-SA-2023-1398</URL>
			</Remediation>
		</Remediations>
	</Vulnerability>
</cvrfdoc>