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

Unified Diff: base/security_unittest.cc

Issue 1064713003: clang/win: Fix SecurityTest.CallocOverflow in -Os builds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/security_unittest.cc
diff --git a/base/security_unittest.cc b/base/security_unittest.cc
index f4c60a75db7291df8f4d51b8a495d48e6915a34d..50032694dad59dff16d9f3db9cbda999d6ef6d07 100644
--- a/base/security_unittest.cc
+++ b/base/security_unittest.cc
@@ -290,11 +290,11 @@ TEST(SecurityTest, MAYBE_NewOverflow) {
// Call calloc(), eventually free the memory and return whether or not
// calloc() did succeed.
bool CallocReturnsNull(size_t nmemb, size_t size) {
+ // We need the two calls to HideValueFromCompiler(): we have seen LLVM
+ // optimize away the call to calloc() entirely and assume the pointer to not
+ // be NULL.
scoped_ptr<char, base::FreeDeleter> array_pointer(
- static_cast<char*>(calloc(nmemb, size)));
- // We need the call to HideValueFromCompiler(): we have seen LLVM
- // optimize away the call to calloc() entirely and assume
- // the pointer to not be NULL.
+ static_cast<char*>(HideValueFromCompiler(calloc(nmemb, size))));
return HideValueFromCompiler(array_pointer.get()) == NULL;
}
« 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