From ba4775171eaddf8e8e053dc1a85f13bce987c086 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Mon, 5 Oct 2015 20:50:25 +0000 Subject: [PATCH] Fixed a possible overflow in a test of allocator::max_size(). git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249349 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../default.allocator/allocator.members/max_size.pass.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/std/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp b/test/std/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp index 6ec9339b..10109383 100644 --- a/test/std/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp +++ b/test/std/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp @@ -22,6 +22,6 @@ int new_called = 0; int main() { const std::allocator a; - std::size_t M = a.max_size() * sizeof(int); - assert(M > 0xFFFF && M <= std::numeric_limits::max()); + std::size_t M = a.max_size(); + assert(M > 0xFFFF && M <= (std::numeric_limits::max() / sizeof(int))); }