summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/DiscScrubber.cpp
diff options
context:
space:
mode:
authorConnor McLaughlin <stenzek@gmail.com>2019-08-09 22:16:33 +1000
committerGitHub <noreply@github.com>2019-08-09 22:16:33 +1000
commite87a3f91a919fa0a470b5f785b354661dcb1f4d4 (patch)
treea828499987fb9cc84f3565738eef18ce2dc4986c /Source/Core/DiscIO/DiscScrubber.cpp
parent2df522d4eb27961dc10c3423f52277f5d3a84234 (diff)
parent107291dc5aef04ecd8465f533ed8a43fb7acab7a (diff)
Merge pull request #8303 from JosJuice/volumeverifier-very-small
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)