summaryrefslogtreecommitdiffstats
path: root/debian/patches/upstream/0025-libblkid-ntfs-avoid-UB-in-signed-shift.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:30:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:30:36 +0000
commitd731b1222e17e0081e5e4e1fc9603b67ba0b72e3 (patch)
treee0426bca9e6173cf00b0ee2573aa2c0cf96b8a25 /debian/patches/upstream/0025-libblkid-ntfs-avoid-UB-in-signed-shift.patch
parentAdding upstream version 2.38.1. (diff)
downloadutil-linux-d731b1222e17e0081e5e4e1fc9603b67ba0b72e3.tar.xz
util-linux-d731b1222e17e0081e5e4e1fc9603b67ba0b72e3.zip
Adding debian version 2.38.1-5.debian/2.38.1-5
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches/upstream/0025-libblkid-ntfs-avoid-UB-in-signed-shift.patch')
-rw-r--r--debian/patches/upstream/0025-libblkid-ntfs-avoid-UB-in-signed-shift.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/debian/patches/upstream/0025-libblkid-ntfs-avoid-UB-in-signed-shift.patch b/debian/patches/upstream/0025-libblkid-ntfs-avoid-UB-in-signed-shift.patch
new file mode 100644
index 0000000..a212b04
--- /dev/null
+++ b/debian/patches/upstream/0025-libblkid-ntfs-avoid-UB-in-signed-shift.patch
@@ -0,0 +1,33 @@
+From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= <thomas@t-8ch.de>
+Date: Thu, 10 Nov 2022 18:35:00 +0100
+Subject: [PATCH 25/26] libblkid: ntfs: avoid UB in signed shift
+
+Fix OSS-Fuzz issue 53142 ( #1886 )
+Fix OSS-Fuzz issue 53160 ( #1888 )
+---
+ libblkid/src/superblocks/ntfs.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/libblkid/src/superblocks/ntfs.c b/libblkid/src/superblocks/ntfs.c
+index dced699..217e7e8 100644
+--- a/libblkid/src/superblocks/ntfs.c
++++ b/libblkid/src/superblocks/ntfs.c
+@@ -135,11 +135,15 @@ static int __probe_ntfs(blkid_probe pr, const struct blkid_idmag *mag, int save_
+ }
+ }
+
+- if (ns->clusters_per_mft_record > 0)
++ if (ns->clusters_per_mft_record > 0) {
+ mft_record_size = ns->clusters_per_mft_record *
+ sectors_per_cluster * sector_size;
+- else
+- mft_record_size = 1 << (0 - ns->clusters_per_mft_record);
++ } else {
++ int8_t mft_record_size_shift = 0 - ns->clusters_per_mft_record;
++ if (mft_record_size_shift < 0 || mft_record_size_shift >= 31)
++ return 1;
++ mft_record_size = 1 << mft_record_size_shift;
++ }
+
+ nr_clusters = le64_to_cpu(ns->number_of_sectors) / sectors_per_cluster;
+