Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Side by Side Diff: base/security_unittest.cc

Issue 11857007: TCMalloc: restrict maximum size of memory ranges (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698