public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/bzip3] epel8: Fix integer overflows in a decoder
@ 2026-10-23 11:58 
  0 siblings, 0 replies; only message in thread
From:  @ 2026-10-23 11:58 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/bzip3
Branch : epel8
Commit : 8c8b8cf1439b2d18e90a3d2ce40bdd617a88c62b
Author : Petr Písař <ppisar@redhat.com>
Date   : 2026-10-23T13:57:46+02:00
Stats  : +63/-0 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/bzip3/c/8c8b8cf1439b2d18e90a3d2ce40bdd617a88c62b?branch=epel8

Log:
Fix integer overflows in a decoder

---
diff --git a/bzip3-1.3.1-fix-191-192.patch b/bzip3-1.3.1-fix-191-192.patch
new file mode 100644
index 0000000..3ffbca9
--- /dev/null
+++ b/bzip3-1.3.1-fix-191-192.patch
@@ -0,0 +1,58 @@
+From de72407ee6896b5439c3e8338fe579aa06a16cac Mon Sep 17 00:00:00 2001
+From: Kamila Szewczyk <k@iczelia.net>
+Date: Sun, 18 Oct 2026 12:37:07 +0200
+Subject: [PATCH] fix #191, #192
+
+Upstream commit: 2f82d62cc29a46ddc20824e3a0e5067e3ff5b36e
+Petr Pisar: Ported to 1.3.1
+---
+ src/libbz3.c | 19 +++++++++++++------
+ 1 file changed, 13 insertions(+), 6 deletions(-)
+
+diff --git a/src/libbz3.c b/src/libbz3.c
+index 25ad329..eed14b1 100644
+--- a/src/libbz3.c
++++ b/src/libbz3.c
+@@ -178,16 +178,18 @@ static s32 lzp_decode_block(const u8 * RESTRICT in, const u8 * in_end, s32 * RES
+         if (*in == MATCH && val > 0) {
+             in++;
+             if (*in != 255) {
++                // SAFETY: the match is clamped to the remaining output space anyway, so stop
++                // accumulating once past it. This keeps `len' from overflowing on untrusted data.
++                const s32 max_len = (s32)(out_end - out);
+                 s32 len = LZP_MIN_MATCH;
+                 while (1) {
+                     if (in == in_end) return -1;
+-                    len += *in;
++                    if (len <= max_len) len += *in;
+                     if (*in++ != 254) break;
+                 }
+ 
+                 const u8 * ref = outs + val;
+-                const u8 * oe = out + len;
+-                if (oe > out_end) oe = out_end;
++                const u8 * oe = (len > max_len) ? out_end : out + len;
+ 
+                 while (out < oe) *out++ = *ref++;
+ 
+@@ -282,9 +284,14 @@ static int mrled(u8 * RESTRICT in, u8 * RESTRICT out, s32 outlen, s32 maxin) {
+     while (op < outlen && ip < maxin) {
+         c = in[ip++];
+         if (t[c]) {
+-            for (run = 0; ip < maxin && (pc = in[ip++]) == 255; run += 255)
+-                ;
+-            run += pc + 1;
++            // SAFETY: the run is clamped to outlen anyway, so stop accumulating once past it.
++            // This keeps `run' from overflowing on untrusted data. A truncated run is malformed.
++            run = 1;
++            do {
++                if (ip >= maxin) return 1;
++                pc = in[ip++];
++                if (run <= outlen) run += pc;
++            } while (pc == 255);
+             for (; run > 0 && op < outlen; --run) out[op++] = c;
+         } else
+             out[op++] = c;
+-- 
+2.56.0
+

diff --git a/bzip3.spec b/bzip3.spec
index 4d936a9..87fb73b 100644
--- a/bzip3.spec
+++ b/bzip3.spec
@@ -69,6 +69,10 @@ Patch9:         bzip3-1.5.3-fix-175.patch
 # Stricter checks at boundaries for bz3_decode and CLI,
 # in upstream after 1.5.4
 Patch10:        bzip3-1.3.1-stricter-checks-at-boundaries-for-bz3_decode-and-cli.patch
+# Fix integer overflows in a decoder, in upstream after 1.5.4,
+# <https://github.com/iczelia/bzip3/issues/191>,
+# <https://github.com/iczelia/bzip3/issues/192>
+Patch11:        bzip3-1.3.1-fix-191-192.patch
 BuildRequires:  autoconf
 BuildRequires:  autoconf-archive
 BuildRequires:  automake
@@ -192,6 +196,7 @@ fi
 %changelog
 * Fri Oct 23 2026 Petr Pisar <ppisar@redhat.com> - 1.3.1-6
 - Stricter checks at boundaries for bz3_decode and CLI
+- Fix integer overflows in a decoder (upstream GH#191, upstream GH#192)
 
 * Tue Sep 08 2026 Petr Pisar <ppisar@redhat.com> - 1.3.1-5
 - Fix decompressing large incompressible streams (upstream GH#174)

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-23 11:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-23 11:58 [rpms/bzip3] epel8: Fix integer overflows in a decoder 

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox