[packages/libarchive] Rel 2. Fix xar use-after-free on a crafted seek offset.
arekm
arekm at pld-linux.org
Thu Oct 29 08:40:33 CET 2026
commit 836557c74266284ec569aa8a51ee9ee9efd84855
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Thu Oct 29 00:07:41 2026 +0100
Rel 2. Fix xar use-after-free on a crafted seek offset.
libarchive-xar-seek-offset.patch | 49 ++++++++++++++++++++++++++++++++++++++++
libarchive.spec | 4 +++-
2 files changed, 52 insertions(+), 1 deletion(-)
---
diff --git a/libarchive.spec b/libarchive.spec
index 653d8cb..cc64193 100644
--- a/libarchive.spec
+++ b/libarchive.spec
@@ -6,7 +6,7 @@ Summary: Multi-format archive and compression library
Summary(pl.UTF-8): Biblioteka do archiwizacji i kompresji w wielu formatach
Name: libarchive
Version: 3.8.10
-Release: 1
+Release: 2
License: BSD
Group: Libraries
# see main page, downloads index may be out of date
@@ -15,6 +15,7 @@ Source0: https://www.libarchive.org/downloads/%{name}-%{version}.tar.xz
# Source0-md5: 7ca38379cb296edf27fe950b9c092a6e
Patch0: %{name}-man_progname.patch
Patch1: libxml2-config.patch
+Patch2: %{name}-xar-seek-offset.patch
URL: http://www.libarchive.org/
BuildRequires: acl-devel
BuildRequires: attr-devel
@@ -148,6 +149,7 @@ bsdunzip - implementacja programu unzip(1), oparta na libarchive.
%setup -q
%patch -P0 -p1
%patch -P1 -p1
+%patch -P2 -p1
%build
%{__libtoolize}
diff --git a/libarchive-xar-seek-offset.patch b/libarchive-xar-seek-offset.patch
new file mode 100644
index 0000000..9b3d27e
--- /dev/null
+++ b/libarchive-xar-seek-offset.patch
@@ -0,0 +1,49 @@
+xar: integer overflow in move_reading_point() lets a crafted offset seek back
+and re-read the TOC (GHSA-w3m6-5v92-c762, ASan-detected memory error).
+https://github.com/libarchive/libarchive/commit/b70c22f22c4030a65abd147433d5b027ed52d42e
+https://github.com/libarchive/libarchive/commit/efbe2f64a279d6d894bf62cffc466c84c05c1bb3
+
+diff --git a/libarchive/archive_read_support_format_xar.c b/libarchive/archive_read_support_format_xar.c
+index cd4923014f..3ccb01bd50 100644
+--- a/libarchive/archive_read_support_format_xar.c
++++ b/libarchive/archive_read_support_format_xar.c
+@@ -1001,7 +1001,15 @@ move_reading_point(struct archive_read *a, uint64_t offset)
+ return ((int)step);
+ xar->offset += step;
+ } else {
+- int64_t pos = __archive_read_seek(a, xar->h_base + offset, SEEK_SET);
++ if (archive_ckd_add_u64(&offset, offset, xar->h_base) ||
++ (int64_t)offset < 0) {
++ archive_set_error(&(a->archive),
++ ARCHIVE_ERRNO_FILE_FORMAT,
++ "Too many bytes to skip");
++ return (ARCHIVE_FATAL);
++ }
++
++ int64_t pos = __archive_read_seek(a, offset, SEEK_SET);
+ if (pos == ARCHIVE_FAILED) {
+ archive_set_error(&(a->archive),
+ ARCHIVE_ERRNO_MISC,
+diff --git a/libarchive/archive_read_support_format_xar.c b/libarchive/archive_read_support_format_xar.c
+index 3ccb01bd50..bb43d1f42f 100644
+--- a/libarchive/archive_read_support_format_xar.c
++++ b/libarchive/archive_read_support_format_xar.c
+@@ -1009,14 +1009,14 @@ move_reading_point(struct archive_read *a, uint64_t offset)
+ return (ARCHIVE_FATAL);
+ }
+
+- int64_t pos = __archive_read_seek(a, offset, SEEK_SET);
+- if (pos == ARCHIVE_FAILED) {
++ int64_t r = __archive_read_seek(a, offset, SEEK_SET);
++ if (r < ARCHIVE_OK) {
+ archive_set_error(&(a->archive),
+ ARCHIVE_ERRNO_MISC,
+ "Cannot seek");
+- return (ARCHIVE_FAILED);
++ return ((int)r);
+ }
+- xar->offset = pos;
++ xar->offset = r;
+ }
+ }
+ return (ARCHIVE_OK);
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/libarchive.git/commitdiff/836557c74266284ec569aa8a51ee9ee9efd84855
More information about the pld-cvs-commit
mailing list