Commit d38072d6 authored by thakis's avatar thakis Committed by Commit bot

clang/win: Fix SecurityTest.CallocOverflow in -Os builds.

The additional indirection foils clang's efforts...for now.

BUG=467929

Review URL: https://codereview.chromium.org/1064713003

Cr-Commit-Position: refs/heads/master@{#323978}
parent 8dd986fb
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment