From fbdbb36015dc4695e07d00da213705f57b87f78d Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Tue, 27 Sep 2016 02:13:27 +0000 Subject: [PATCH] Fix possible division by zero git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282468 91177308-0d34-0410-b5e6-96231b3b80d8 --- src/experimental/filesystem/operations.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/experimental/filesystem/operations.cpp b/src/experimental/filesystem/operations.cpp index cff27a0e5..f426262b8 100644 --- a/src/experimental/filesystem/operations.cpp +++ b/src/experimental/filesystem/operations.cpp @@ -720,7 +720,7 @@ space_info __space(const path& p, std::error_code *ec) { // Multiply with overflow checking. auto do_mult = [&](std::uintmax_t& out, std::uintmax_t other) { out = other * m_svfs.f_frsize; - if (out / other != m_svfs.f_frsize || other == 0) + if (other == 0 || out / other != m_svfs.f_frsize) out = static_cast(-1); }; do_mult(si.capacity, m_svfs.f_blocks);