diff options
author | 2024-11-09 10:08:15 -0500 | |
---|---|---|
committer | 2024-11-09 10:08:28 -0500 | |
commit | 94ee92901bee9e42873fcea86ab5ff5d60476fd4 (patch) | |
tree | 272a9e94c5d2a48c2f3d8d94dd40bcba23641353 | |
parent | 93eb3514b1cf7a22739e800700abe3bdf1c3ff38 (diff) |
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)
-rw-r--r-- | src/lib/formats/fs_fat.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
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; } |