From e41faeb557d85438e767b0a08745446ba648f0bc Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 16 Nov 2020 19:52:42 -0500 Subject: [PATCH] Adds a quick protection against sector ID buffer overrun. --- Storage/Disk/DiskImage/Formats/MacintoshIMG.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Storage/Disk/DiskImage/Formats/MacintoshIMG.cpp b/Storage/Disk/DiskImage/Formats/MacintoshIMG.cpp index 510638426..5fc7f5006 100644 --- a/Storage/Disk/DiskImage/Formats/MacintoshIMG.cpp +++ b/Storage/Disk/DiskImage/Formats/MacintoshIMG.cpp @@ -202,7 +202,7 @@ std::shared_ptr<::Storage::Disk::Track> MacintoshIMG::get_track_at_position(::St int destination = 0; for(int c = 0; c < included_sectors.length; ++c) { // Deal with collisions by finding the next non-colliding spot. - while(source_sectors[destination] != 0xff) ++destination; + while(source_sectors[destination] != 0xff) destination = (destination + 1) % included_sectors.length; source_sectors[destination] = uint8_t(c); destination = (destination + (format_ & 0x1f)) % included_sectors.length; }