summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/DiscScrubber.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/DiscIO/DiscScrubber.cpp')
-rw-r--r--Source/Core/DiscIO/DiscScrubber.cpp3
1 files changed, 2 insertions, 1 deletions
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<size_t>(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<size_t>((m_file_size + CLUSTER_SIZE - 1) / CLUSTER_SIZE);
// Warn if not DVD5 or DVD9 size
if (num_clusters != 0x23048 && num_clusters != 0x46090)