mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-24 03:32:35 +08:00
Fix possible division by zero
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282468 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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<std::uintmax_t>(-1);
|
||||
};
|
||||
do_mult(si.capacity, m_svfs.f_blocks);
|
||||
|
||||
Reference in New Issue
Block a user