summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/DiscScrubber.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2019-08-07 10:34:52 +0200
committerJosJuice <josjuice@gmail.com>2019-08-07 19:48:10 +0200
commit107291dc5aef04ecd8465f533ed8a43fb7acab7a (patch)
tree547a611cd1d4e826cc10402e8e34f187c93a1351 /Source/Core/DiscIO/DiscScrubber.cpp
parent24718c1a389e4f51db974575cd15c372485b92e2 (diff)
Fix problems with running VolumeVerifier on very small disc images
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)