Skip to content

Commit 985410a

Browse files
CBL-Mariner-BotrealsdxPawelWMSjslobodzian
authored
[AUTO-CHERRYPICK] Patch javapackages-bootstrap for CVE-2024-25710 [HIGH] - branch 3.0-dev (#13986)
Co-authored-by: Sudipta Pandit <sudpandit@microsoft.com> Co-authored-by: Pawel Winogrodzki <pawelwi@microsoft.com> Co-authored-by: jslobodzian <joslobo@microsoft.com>
1 parent 4224526 commit 985410a

2 files changed

Lines changed: 62 additions & 1 deletion

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
From 74d2bf8a7f2ad282ebd0055c0f41ed2e6d1f5ea5 Mon Sep 17 00:00:00 2001
2+
From: Sudipta Pandit <sudpandit@microsoft.com>
3+
Date: Fri, 16 May 2025 17:10:24 +0530
4+
Subject: [PATCH] Backport patch for CVE-2024-25710
5+
6+
Upstream Reference: https://github.com/apache/commons-compress/commit/8a9a5847c04ae39a1d45b365f8bb82022466067d
7+
---
8+
.../commons/compress/archivers/dump/DumpArchiveUtil.java | 6 ++++++
9+
.../commons/compress/archivers/dump/TapeInputStream.java | 3 +++
10+
2 files changed, 9 insertions(+)
11+
12+
diff --git a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveUtil.java b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveUtil.java
13+
index 80cd93588..0484d329b 100644
14+
--- a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveUtil.java
15+
+++ b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveUtil.java
16+
@@ -83,6 +83,9 @@ public static final long convert64(final byte[] buffer, final int offset) {
17+
*/
18+
static String decode(final ZipEncoding encoding, final byte[] b, final int offset, final int len)
19+
throws IOException {
20+
+ if (offset > offset + len) {
21+
+ throw new IOException("Invalid offset/length combination");
22+
+ }
23+
return encoding.decode(Arrays.copyOfRange(b, offset, offset + len));
24+
}
25+
26+
@@ -103,6 +106,9 @@ public static final int getIno(final byte[] buffer) {
27+
* @return Whether the buffer contains a tape segment header.
28+
*/
29+
public static final boolean verify(final byte[] buffer) {
30+
+ if (buffer == null) {
31+
+ return false;
32+
+ }
33+
// verify magic. for now only accept NFS_MAGIC.
34+
final int magic = convert32(buffer, 24);
35+
36+
diff --git a/src/main/java/org/apache/commons/compress/archivers/dump/TapeInputStream.java b/src/main/java/org/apache/commons/compress/archivers/dump/TapeInputStream.java
37+
index 08d23f7f3..85735a189 100644
38+
--- a/src/main/java/org/apache/commons/compress/archivers/dump/TapeInputStream.java
39+
+++ b/src/main/java/org/apache/commons/compress/archivers/dump/TapeInputStream.java
40+
@@ -311,6 +311,9 @@ public void resetBlockSize(final int recsPerBlock, final boolean isCompressed)
41+
+ " records found, must be at least 1");
42+
}
43+
blockSize = RECORD_SIZE * recsPerBlock;
44+
+ if (blockSize < 1) {
45+
+ throw new IOException("Block size cannot be less than or equal to 0: " + blockSize);
46+
+ }
47+
48+
// save first block in case we need it again
49+
final byte[] oldBuffer = blockBuffer;
50+
--
51+
2.34.1
52+

SPECS/javapackages-bootstrap/javapackages-bootstrap.spec

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
Name: javapackages-bootstrap
2121
Version: 1.14.0
22-
Release: 2%{?dist}
22+
Release: 3%{?dist}
2323
Summary: A means of bootstrapping Java Packages Tools
2424
# For detailed info see the file javapackages-bootstrap-PACKAGE-LICENSING
2525
License: ASL 2.0 and ASL 1.1 and (ASL 2.0 or EPL-2.0) and (EPL-2.0 or GPLv2 with exceptions) and MIT and (BSD with advertising) and BSD-3-Clause and EPL-1.0 and EPL-2.0 and CDDL-1.0 and xpp and CC0 and Public Domain
@@ -154,6 +154,8 @@ Source1118: xmvn-jpb-4.2.0.tar.xz
154154
Source1119: xmvn-generator-1.2.1.tar.xz
155155
Source1120: xz-java-1.9.tar.xz
156156

157+
Patch0: CVE-2024-25710.patch
158+
157159
Provides: bundled(ant) = 1.10.14
158160
Provides: bundled(aopalliance) = 1.0
159161
Provides: bundled(apache-pom) = 30
@@ -316,6 +318,10 @@ do
316318
tar -xf "${source}"
317319
done
318320

321+
pushd "downstream/commons-compress"
322+
%patch -P 0 -p1
323+
popd
324+
319325
for patch_path in patches/*/*
320326
do
321327
package_name="$(echo ${patch_path} | cut -f2 -d/)"
@@ -402,6 +408,9 @@ sed -i s/_xmvngen_/_jpbgen_/ %{buildroot}%{_fileattrsdir}/jpbgen.attr
402408
%doc AUTHORS
403409

404410
%changelog
411+
* Fri May 16 2025 Sudipta Pandit <sudpandit@microsoft.com> - 1.14.0-3
412+
- Add backported patch for CVE-2024-25710
413+
405414
* Thu Mar 21 2024 Riken Maharjan <rmaharjan@microsoft.com> - 1.14.0-2
406415
- Change JAVA_HOME for xmvn to be msopenjdk location.
407416
- Upgrade to 1.14.0 - azl 3.0

0 commit comments

Comments
 (0)