[libcxx] r249349 - Fixed a possible overflow in a test of allocator::max_size().
Marshall Clow via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 5 13:50:25 PDT 2015
Author: marshall
Date: Mon Oct 5 15:50:25 2015
New Revision: 249349
URL: http://llvm.org/viewvc/llvm-project?rev=249349&view=rev
Log:
Fixed a possible overflow in a test of allocator::max_size().
Modified:
libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp
Modified: libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp?rev=249349&r1=249348&r2=249349&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp Mon Oct 5 15:50:25 2015
@@ -22,6 +22,6 @@ int new_called = 0;
int main()
{
const std::allocator<int> a;
- std::size_t M = a.max_size() * sizeof(int);
- assert(M > 0xFFFF && M <= std::numeric_limits<std::size_t>::max());
+ std::size_t M = a.max_size();
+ assert(M > 0xFFFF && M <= (std::numeric_limits<std::size_t>::max() / sizeof(int)));
}
More information about the cfe-commits
mailing list