From 107291dc5aef04ecd8465f533ed8a43fb7acab7a Mon Sep 17 00:00:00 2001 From: JosJuice Date: Wed, 7 Aug 2019 10:34:52 +0200 Subject: [PATCH] Fix problems with running VolumeVerifier on very small disc images --- Source/Core/DiscIO/DiscScrubber.cpp | 3 ++- Source/Core/DolphinQt/Config/VerifyWidget.cpp | 2 +- 2 files changed, 3 insertions(+), 2 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(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) diff --git a/Source/Core/DolphinQt/Config/VerifyWidget.cpp b/Source/Core/DolphinQt/Config/VerifyWidget.cpp index dd96c6ba9b..8fc16d5a66 100644 --- a/Source/Core/DolphinQt/Config/VerifyWidget.cpp +++ b/Source/Core/DolphinQt/Config/VerifyWidget.cpp @@ -117,7 +117,7 @@ void VerifyWidget::Verify() verifier.Finish(); DiscIO::VolumeVerifier::Result result = verifier.GetResult(); - progress->setValue(verifier.GetBytesProcessed() / DIVISOR); + progress->reset(); m_summary_text->setText(QString::fromStdString(result.summary_text));