| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include <limits> |
| 6 |
| 7 #include "base/version.h" |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 |
| 11 namespace { |
| 12 |
| 13 // Check that we can not allocate a continuous space that cannot indexed |
| 14 // via an int. This is used to mitigate vulnerabilities in libraries that use |
| 15 // int instead of size_t. |
| 16 TEST(SecurityTest, AllocationRestrictions) { |
| 17 scoped_ptr<char, base::FreeDeleter> |
| 18 ptr(static_cast<char*>(malloc(std::numeric_limits<int>::max()))); |
| 19 ASSERT_TRUE(ptr == NULL); |
| 20 // TODO(jln): a lot more tests here. |
| 21 } |
| 22 |
| 23 } // namespace |
| OLD | NEW |