]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: udf: avoid 32-bit overflow in offset calculations
authorKarel Zak <kzak@redhat.com>
Wed, 15 Apr 2026 18:31:19 +0000 (20:31 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 23 Apr 2026 12:07:45 +0000 (14:07 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/superblocks/udf.c

index a04da63a37eb232a90666f4a8b42eb0c5ad8f8fb..b1dac96b0faf80d78e89a97e3b3cccbd65059969 100644 (file)
@@ -162,7 +162,7 @@ struct logical_vol_integ_descriptor_imp_use
        uint16_t        max_udf_write_rev;
 } __attribute__ ((packed));
 
-#define UDF_LVIDIU_OFFSET(vd) (sizeof((vd).tag) + sizeof((vd).type.logical_vol_integ) + 2 * 4 * le32_to_cpu((vd).type.logical_vol_integ.num_partitions))
+#define UDF_LVIDIU_OFFSET(vd) (sizeof((vd).tag) + sizeof((vd).type.logical_vol_integ) + (uint64_t) 8 * le32_to_cpu((vd).type.logical_vol_integ.num_partitions))
 #define UDF_LVIDIU_LENGTH(vd) (le32_to_cpu((vd).type.logical_vol_integ.imp_use_length))
 
 static inline int gen_uuid_from_volset_id(unsigned char uuid[17], struct dstring128 *volset_id)
@@ -362,7 +362,7 @@ real_blksz:
        for (b = 0; b < count; b++) {
                vd = (struct volume_descriptor *)
                        blkid_probe_get_buffer(pr,
-                                       (uint64_t) (loc + b) * bs,
+                                       ((uint64_t) loc + b) * bs,
                                        sizeof(*vd));
                if (!vd)
                        return errno ? -errno : 1;