Skip to contentSkip to conversation

lib-decompress_bunzip2-fix-32-bit-shift-undefined-behavior.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Mar 28

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: lib: decompress_bunzip2: fix 32-bit shift undefined behavior
has been removed from the -mm tree. Its filename was
lib-decompress_bunzip2-fix-32-bit-shift-undefined-behavior.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Josh Law <[email protected]>
Subject: lib: decompress_bunzip2: fix 32-bit shift undefined behavior
Date: Sun, 8 Mar 2026 16:50:12 +0000

Fix undefined behavior caused by shifting a 32-bit integer by 32 bits during decompression. This prevents potential kernel decompression failures or corruption when parsing malicious or malformed bzip2 archives.

---

 lib/decompress_bunzip2.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/decompress_bunzip2.c renamed from lib/decompress_bunzip2.c~lib-decompress_bunzip2-fix-32-bit-shift-undefined-behavior +2 -2
@@ -135,7 +135,7 @@ static unsigned int INIT get_bits(struct
 		}
 		/* Avoid 32-bit overflow (dump bit buffer to top of output) */
 		if (bd->inbufBitCount >= 24) {
-			bits = bd->inbufBits&((1 << bd->inbufBitCount)-1);
+			bits = bd->inbufBits & ((1ULL << bd->inbufBitCount) - 1);
 			bits_wanted -= bd->inbufBitCount;
 			bits <<= bits_wanted;
 			bd->inbufBitCount = 0;
@@ -146,7 +146,7 @@ static unsigned int INIT get_bits(struct
 	}
 	/* Calculate result */
 	bd->inbufBitCount -= bits_wanted;
-	bits |= (bd->inbufBits >> bd->inbufBitCount)&((1 << bits_wanted)-1);
+	bits |= (bd->inbufBits >> bd->inbufBitCount) & ((1ULL << bits_wanted) - 1);
 
 	return bits;
 }

_

Patches currently in -mm which might be from [email protected] are

mm-damon-core-document-damos_commit_dests-failure-semantics.patch lib-maple_tree-fix-swapped-arguments-in-mas_safe_pivot-call.patch lib-idr-fix-ida_find_first_range-missing-ids-across-chunk-boundaries.patch