From 16d8b1e2a62f81ac368438a730d5e57cd2778f55 Mon Sep 17 00:00:00 2001 From: Milan Broz Date: Sun, 4 Jun 2023 19:15:55 +0200 Subject: [PATCH] libblkid: jfs - avoid undefined shift Fix previous commit 04a0717b0b0faa1a8078dc6fad05183b8bada395 to avoid undefined shift if value is exactly 32. libblkid/src/superblocks/jfs.c:46:39: runtime error: shift exponent 32 is too large for 32-bit type 'unsigned int' Reproducer found with OSS-Fuzz (issue 59284) running over cryptsetup project (blkid is used in header init). Signed-off-by: Milan Broz --- libblkid/src/superblocks/jfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libblkid/src/superblocks/jfs.c b/libblkid/src/superblocks/jfs.c index 1b545c7d50..7b75ecb6b5 100644 --- a/libblkid/src/superblocks/jfs.c +++ b/libblkid/src/superblocks/jfs.c @@ -41,7 +41,7 @@ static int probe_jfs(blkid_probe pr, const struct blkid_idmag *mag) js = blkid_probe_get_sb(pr, mag, struct jfs_super_block); if (!js) return errno ? -errno : 1; - if (le16_to_cpu(js->js_l2bsize) > 32 || le16_to_cpu(js->js_l2pbsize) > 32) + if (le16_to_cpu(js->js_l2bsize) > 31 || le16_to_cpu(js->js_l2pbsize) > 31) return 1; if (le32_to_cpu(js->js_bsize) != (1U << le16_to_cpu(js->js_l2bsize))) return 1; -- 2.47.2