From bb48d6a4dcce24b6e5d9424e7f80115c6174bb5d Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Thu, 9 Jan 2025 21:55:50 +0100 Subject: [PATCH] unzip.cpp: Check successful write with good() std::ofstream::write might not throw an exception on failed write --- src/modules/userinterface/legacymenu/mainscreens/unzip.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modules/userinterface/legacymenu/mainscreens/unzip.cpp b/src/modules/userinterface/legacymenu/mainscreens/unzip.cpp index 9daf35431..e2466a915 100644 --- a/src/modules/userinterface/legacymenu/mainscreens/unzip.cpp +++ b/src/modules/userinterface/legacymenu/mainscreens/unzip.cpp @@ -97,6 +97,12 @@ int unzip::extract(const std::string &path) const try { out.write(buf, n); + + if (!out.good()) + { + GfLogError("Failed to write %d bytes\n", n); + return -1; + } } catch (const std::ios_base::failure &failure) {