From 107291dc5aef04ecd8465f533ed8a43fb7acab7a Mon Sep 17 00:00:00 2001 From: JosJuice Date: Wed, 7 Aug 2019 10:34:52 +0200 Subject: Fix problems with running VolumeVerifier on very small disc images --- Source/Core/DiscIO/DiscScrubber.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Source/Core/DiscIO/DiscScrubber.cpp') diff --git a/Source/Core/DiscIO/DiscScrubber.cpp b/Source/Core/DiscIO/DiscScrubber.cpp index 0c944a782a..121f5dbe25 100644 --- a/Source/Core/DiscIO/DiscScrubber.cpp +++ b/Source/Core/DiscIO/DiscScrubber.cpp @@ -44,7 +44,8 @@ bool DiscScrubber::SetupScrub(const Volume* disc, int block_size) m_file_size = m_disc->GetSize(); - const size_t num_clusters = static_cast(m_file_size / CLUSTER_SIZE); + // Round up when diving by CLUSTER_SIZE, otherwise MarkAsUsed might write out of bounds + const size_t num_clusters = static_cast((m_file_size + CLUSTER_SIZE - 1) / CLUSTER_SIZE); // Warn if not DVD5 or DVD9 size if (num_clusters != 0x23048 && num_clusters != 0x46090) -- cgit v1.2.3