diff mbox series

libsolv: fix CVE-2026-48864

Message ID 20261202154757.19871-1-saisireesha.t@windriver.com
State Under Review
Headers show
Series libsolv: fix CVE-2026-48864 | expand

Commit Message

Sai Sireesha T Dec. 2, 2026, 3:47 p.m. UTC
Backport upstream PR #622 (6ba8fbf), which replaces unchecked_decompress_buf()
with repopagestore_decompress_page() when loading solv pages, so decompressed
page data is validated before it is written to the output buffer.

Upstream libsolv closed this PR, saying the solv parser is not designed for
untrusted input. Red Hat ships the same commit as a fix for CVE-2026-48864
(RHEL-178270, RHSA-2026:48815).

[1] https://github.com/openSUSE/libsolv/pull/622
[2] https://bugzilla.redhat.com/show_bug.cgi?id=2460425

Signed-off-by: Sai Sireesha T <saisireesha.t@windriver.com>
---
 .../libsolv/libsolv/CVE-2026-48864.patch      | 63 +++++++++++++++++++
 .../libsolv/libsolv_0.7.41.bb                 |  1 +
 2 files changed, 64 insertions(+)
 create mode 100644 meta/recipes-extended/libsolv/libsolv/CVE-2026-48864.patch
diff mbox series

Patch

diff --git a/meta/recipes-extended/libsolv/libsolv/CVE-2026-48864.patch b/meta/recipes-extended/libsolv/libsolv/CVE-2026-48864.patch
new file mode 100644
index 0000000000..8a778bf9af
--- /dev/null
+++ b/meta/recipes-extended/libsolv/libsolv/CVE-2026-48864.patch
@@ -0,0 +1,63 @@ 
+From 6ba8fbf6603a7fcfdb1744df52d6f0c291f7b29f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
+Date: Tue, 5 May 2026 10:52:20 +0200
+Subject: [PATCH] Fix a buffer overflow when decompressing solv pages
+
+repopagestore_load_page_range() and
+repopagestore_read_or_setup_pages() functions called
+unchecked_decompress_buf() on compressed data which were just loaded
+from a solv file without validating them with check_decompress_buf().
+
+If the solv file was maliously crafted to decompress beyond
+REPOPAGE_BLOBSIZE-byte-sized stack-allocated buffer (e.g. 100lllll
+byte with high lllll counter at the end of the buffer), or
+a backreference was pointing out of the output buffer (e.g.
+a reference at the beginning of the buffer with high offset pointing
+before a start of the buffer), unchecked_decompress_buf() would read
+or write out of the output buffer, causing a buffer overflow.
+
+Trival fix would be calling check_decompress_buf() before
+unchecked_decompress_buf() as repopagestore_decompress_page() already
+does.
+
+Instead, this patch uses repopagestore_decompress_page() to do the
+check and decompression in a single step.
+
+Acknowledgement: Aisle Research
+
+CVE-2026-48864
+https://bugzilla.redhat.com/show_bug.cgi?id=2460425
+
+CVE: CVE-2026-48864
+Upstream-Status: Denied [https://github.com/openSUSE/libsolv/pull/622]
+Signed-off-by: SaiSireesha T <saisireesha.t@windriver.com>
+---
+ src/repopage.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/repopage.c b/src/repopage.c
+index a9a1c074b..0967979b8 100644
+--- a/src/repopage.c
++++ b/src/repopage.c
+@@ -779,8 +779,8 @@ repopagestore_load_page_range(Repopagestore *store, unsigned int pstart, unsigne
+ 	  if (compressed)
+ 	    {
+ 	      unsigned int out_len;
+-	      out_len = unchecked_decompress_buf(buf, in_len, dest, REPOPAGE_BLOBSIZE);
+-	      if (out_len != REPOPAGE_BLOBSIZE && pnum < store->num_pages - 1)
++	      out_len = repopagestore_decompress_page(buf, in_len, dest, REPOPAGE_BLOBSIZE);
++	      if (out_len == 0 || (out_len != REPOPAGE_BLOBSIZE && pnum < store->num_pages - 1))
+ 	        {
+ #ifdef DEBUG_PAGING
+ 	          fprintf(stderr, "can't decompress\n");
+@@ -947,8 +947,8 @@ repopagestore_read_or_setup_pages(Repopagestore *store, FILE *fp, unsigned int p
+ 	    }
+ 	  if (compressed)
+ 	    {
+-	      out_len = unchecked_decompress_buf(buf, in_len, dest, REPOPAGE_BLOBSIZE);
+-	      if (out_len != REPOPAGE_BLOBSIZE && i < npages - 1)
++	      out_len = repopagestore_decompress_page(buf, in_len, dest, REPOPAGE_BLOBSIZE);
++	      if (out_len == 0 || (out_len != REPOPAGE_BLOBSIZE && i < npages - 1))
+ 	        {
+ 		  return SOLV_ERROR_CORRUPT;
+ 	        }
diff --git a/meta/recipes-extended/libsolv/libsolv_0.7.41.bb b/meta/recipes-extended/libsolv/libsolv_0.7.41.bb
index bc866725ec..6698b66b62 100644
--- a/meta/recipes-extended/libsolv/libsolv_0.7.41.bb
+++ b/meta/recipes-extended/libsolv/libsolv_0.7.41.bb
@@ -9,6 +9,7 @@  LIC_FILES_CHKSUM = "file://LICENSE.BSD;md5=62272bd11c97396d4aaf1c41bc11f7d8"
 DEPENDS = "expat zlib zstd"
 
 SRC_URI = "git://github.com/openSUSE/libsolv.git;branch=master;protocol=https;tag=${PV} \
+           file://CVE-2026-48864.patch \
            file://run-ptest \
 "