From acc05dac8b16e65c1b233e0d97807e376b1d83e9 Mon Sep 17 00:00:00 2001 From: localhorst Date: Tue, 9 Dec 2025 22:02:59 +0100 Subject: [PATCH] Potential Division by Zero --- src/printer.cpp | 2 +- src/shred.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/printer.cpp b/src/printer.cpp index ead3876..6bd043f 100644 --- a/src/printer.cpp +++ b/src/printer.cpp @@ -6,7 +6,7 @@ */ #include "../include/reHDD.h" -using namespace std; + bool Printer::instanceFlag = false; Printer *Printer::single = NULL; diff --git a/src/shred.cpp b/src/shred.cpp index 5e5df7a..5be6ce4 100644 --- a/src/shred.cpp +++ b/src/shred.cpp @@ -224,6 +224,8 @@ double Shred::calcProgress() #ifdef ZERO_CHECK uiMaxShredIteration++; // increment because we will check after SHRED_ITERATIONS the drive for non-zero bytes #endif + if (this->ulDriveByteSize == 0) + return 0.0; return (double)(((double)ulDriveByteOverallCount) / ((double)this->ulDriveByteSize * uiMaxShredIteration)) * 100.0f; }