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

Side by Side Diff: base/security_unittest.cc

Issue 1483413002: Enable SecurityTest.NewOverflow under ThreadSanitizer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <fcntl.h> 5 #include <fcntl.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 printf("Platform has overflow: %s\n", 78 printf("Platform has overflow: %s\n",
79 !overflow_detected ? "yes." : "no."); 79 !overflow_detected ? "yes." : "no.");
80 #else 80 #else
81 // Otherwise, fail the test. (Note: EXPECT are ok in subfunctions, ASSERT 81 // Otherwise, fail the test. (Note: EXPECT are ok in subfunctions, ASSERT
82 // aren't). 82 // aren't).
83 EXPECT_TRUE(overflow_detected); 83 EXPECT_TRUE(overflow_detected);
84 #endif 84 #endif
85 } 85 }
86 } 86 }
87 87
88 #if defined(OS_IOS) || defined(OS_WIN) || defined(THREAD_SANITIZER) || defined(O S_MACOSX) 88 #if defined(OS_IOS) || defined(OS_WIN) || defined(OS_MACOSX)
89 #define MAYBE_NewOverflow DISABLED_NewOverflow 89 #define MAYBE_NewOverflow DISABLED_NewOverflow
90 #else 90 #else
91 #define MAYBE_NewOverflow NewOverflow 91 #define MAYBE_NewOverflow NewOverflow
92 #endif 92 #endif
93 // Test array[TooBig][X] and array[X][TooBig] allocations for int overflows. 93 // Test array[TooBig][X] and array[X][TooBig] allocations for int overflows.
94 // IOS doesn't honor nothrow, so disable the test there. 94 // IOS doesn't honor nothrow, so disable the test there.
95 // Crashes on Windows Dbg builds, disable there as well. 95 // Crashes on Windows Dbg builds, disable there as well.
96 // Fails on Mac 10.8 http://crbug.com/227092 96 // Fails on Mac 10.8 http://crbug.com/227092
97 TEST(SecurityTest, MAYBE_NewOverflow) { 97 TEST(SecurityTest, MAYBE_NewOverflow) {
98 const size_t kArraySize = 4096; 98 const size_t kArraySize = 4096;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // kRandomMask, so we use it as an additional detection mechanism. 175 // kRandomMask, so we use it as an additional detection mechanism.
176 const uintptr_t kRandomMask = 0x3fffffffffffULL; 176 const uintptr_t kRandomMask = 0x3fffffffffffULL;
177 bool impossible_random_address = 177 bool impossible_random_address =
178 reinterpret_cast<uintptr_t>(ptr.get()) & ~kRandomMask; 178 reinterpret_cast<uintptr_t>(ptr.get()) & ~kRandomMask;
179 EXPECT_FALSE(impossible_random_address); 179 EXPECT_FALSE(impossible_random_address);
180 } 180 }
181 181
182 #endif // defined(OS_LINUX) && defined(__x86_64__) 182 #endif // defined(OS_LINUX) && defined(__x86_64__)
183 183
184 } // namespace 184 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698