From 47f76b8907aac1b9c268f25502dd4cc5f8d00983 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Mon, 14 Apr 2014 20:35:40 -0500 Subject: [PATCH] Fix the integer overflow that happens in the MD5Sum Progressbar. Instead of using a u64 size integer as the range on the progressbar, set the max as 1000. Similar maximums are used in other parts of the UI. --- Source/Core/DolphinWX/ISOProperties.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/DolphinWX/ISOProperties.cpp b/Source/Core/DolphinWX/ISOProperties.cpp index 780ed5b16d..70565d5fd8 100644 --- a/Source/Core/DolphinWX/ISOProperties.cpp +++ b/Source/Core/DolphinWX/ISOProperties.cpp @@ -1208,7 +1208,7 @@ void CISOProperties::OnComputeMD5Sum(wxCommandEvent& WXUNUSED (event)) u8 output[16]; std::string output_string; std::vector data(8 * 1024 * 1024); - size_t read_offset = 0; + u64 read_offset = 0; md5_context ctx; File::IOFile file(OpenGameListItem->GetFileName(), "rb"); @@ -1217,7 +1217,7 @@ void CISOProperties::OnComputeMD5Sum(wxCommandEvent& WXUNUSED (event)) wxProgressDialog progressDialog( _("Computing MD5 checksum"), _("Working..."), - game_size, + 1000, this, wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME | wxPD_REMAINING_TIME | @@ -1228,7 +1228,7 @@ void CISOProperties::OnComputeMD5Sum(wxCommandEvent& WXUNUSED (event)) while(read_offset < game_size) { - if (!progressDialog.Update(read_offset, _("Computing MD5 checksum"))) + if (!progressDialog.Update((int)((double)read_offset / (double)game_size * 1000), _("Computing MD5 checksum"))) return; size_t read_size;