]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
libarchive: patch regression of patch for CVE-2025-5918
authorPeter Marko <peter.marko@siemens.com>
Mon, 25 Aug 2025 16:09:52 +0000 (18:09 +0200)
committerSteve Sakoman <steve@sakoman.com>
Tue, 26 Aug 2025 20:08:52 +0000 (13:08 -0700)
Picked commit per [1].

[1] https://security-tracker.debian.org/tracker/CVE-2025-5918

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
meta/recipes-extended/libarchive/libarchive/CVE-2025-5918-0003.patch [new file with mode: 0644]
meta/recipes-extended/libarchive/libarchive_3.7.9.bb

diff --git a/meta/recipes-extended/libarchive/libarchive/CVE-2025-5918-0003.patch b/meta/recipes-extended/libarchive/libarchive/CVE-2025-5918-0003.patch
new file mode 100644 (file)
index 0000000..bc6903d
--- /dev/null
@@ -0,0 +1,51 @@
+From 51b4c35bb38b7df4af24de7f103863dd79129b01 Mon Sep 17 00:00:00 2001
+From: Tobias Stoeckmann <tobias@stoeckmann.org>
+Date: Tue, 27 May 2025 17:09:12 +0200
+Subject: [PATCH] Fix FILE_skip regression
+
+The fseek* family of functions return 0 on success, not the new offset.
+This is only true for lseek.
+
+Fixes https://github.com/libarchive/libarchive/issues/2641
+Fixes dcbf1e0ededa95849f098d154a25876ed5754bcf
+
+Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
+
+CVE: CVE-2025-5918
+Upstream-Status: Backport [https://github.com/libarchive/libarchive/commit/51b4c35bb38b7df4af24de7f103863dd79129b01]
+Signed-off-by: Peter Marko <peter.marko@siemens.com>
+---
+ libarchive/archive_read_open_file.c | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/libarchive/archive_read_open_file.c b/libarchive/archive_read_open_file.c
+index 6ed18a0c..742923ab 100644
+--- a/libarchive/archive_read_open_file.c
++++ b/libarchive/archive_read_open_file.c
+@@ -132,7 +132,7 @@ FILE_skip(struct archive *a, void *client_data, int64_t request)
+ #else
+       long skip = (long)request;
+ #endif
+-      int64_t old_offset, new_offset;
++      int64_t old_offset, new_offset = -1;
+       int skip_bits = sizeof(skip) * 8 - 1;
+       (void)a; /* UNUSED */
+@@ -170,11 +170,14 @@ FILE_skip(struct archive *a, void *client_data, int64_t request)
+ #ifdef __ANDROID__
+                       new_offset = lseek(fileno(mine->f), skip, SEEK_CUR);
+ #elif HAVE__FSEEKI64
+-                      new_offset = _fseeki64(mine->f, skip, SEEK_CUR);
++                      if (_fseeki64(mine->f, skip, SEEK_CUR) == 0)
++                              new_offset = _ftelli64(mine->f);
+ #elif HAVE_FSEEKO
+-                      new_offset = fseeko(mine->f, skip, SEEK_CUR);
++                      if (fseeko(mine->f, skip, SEEK_CUR) == 0)
++                              new_offset = ftello(mine->f);
+ #else
+-                      new_offset = fseek(mine->f, skip, SEEK_CUR);
++                      if (fseek(mine->f, skip, SEEK_CUR) == 0)
++                              new_offset = ftell(mine->f);
+ #endif
+                       if (new_offset >= 0)
+                               return (new_offset - old_offset);
index f08673ea3b96ac8f0cc7e8f26d2ad8455697146b..f4b1be233714f43a5ac90cbcccddc4634ad1443a 100644 (file)
@@ -37,6 +37,7 @@ SRC_URI = "http://libarchive.org/downloads/libarchive-${PV}.tar.gz \
            file://CVE-2025-5917.patch \
            file://CVE-2025-5918-0001.patch \
            file://CVE-2025-5918-0002.patch \
+           file://CVE-2025-5918-0003.patch \
            "
 UPSTREAM_CHECK_URI = "http://libarchive.org/"