From 94ee92901bee9e42873fcea86ab5ff5d60476fd4 Mon Sep 17 00:00:00 2001 From: AJR Date: Sat, 9 Nov 2024 10:08:15 -0500 Subject: formats/fs_fat.cpp: Guard against divide by zero errors when the bytes per sector field in the parameter block is not properly set (as on some early PC-DOS disks) --- src/lib/formats/fs_fat.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/formats/fs_fat.cpp b/src/lib/formats/fs_fat.cpp index 140036ae1c1..885a5ea3087 100644 --- a/src/lib/formats/fs_fat.cpp +++ b/src/lib/formats/fs_fat.cpp @@ -564,6 +564,8 @@ impl::impl(fsblk_t &blockdev, fsblk_t::block_t &&boot_sector_block, std::vector< , m_last_cluster_indicator(((u64)1 << bits_per_fat_entry) - 1) , m_last_valid_cluster(m_last_cluster_indicator - 0x10) { + if (m_bytes_per_sector == 0) + m_bytes_per_sector = 512; } -- cgit v1.2.3