summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthakis <thakis@chromium.org>2015-04-22 19:58:29 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-23 02:58:48 +0000
commit189ce1fd449ae1f2c1eaca718a6da5f444d7fcb5 (patch)
treeb03c2f513f07b5f55f2b211227c58387a712f569
parenta068236fabb7a1925df7494bd668c2b58b26979a (diff)
downloadchromium_src-189ce1fd449ae1f2c1eaca718a6da5f444d7fcb5.zip
chromium_src-189ce1fd449ae1f2c1eaca718a6da5f444d7fcb5.tar.gz
chromium_src-189ce1fd449ae1f2c1eaca718a6da5f444d7fcb5.tar.bz2
win: Get SecurityTest.CallocOverflow passing again after clang r235553.
Previously: https://codereview.chromium.org/1064713003 BUG=467929 TBR=hans Review URL: https://codereview.chromium.org/1105583002 Cr-Commit-Position: refs/heads/master@{#326438}
-rw-r--r--base/security_unittest.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/base/security_unittest.cc b/base/security_unittest.cc
index 5003269..07ba6f5 100644
--- a/base/security_unittest.cc
+++ b/base/security_unittest.cc
@@ -69,7 +69,7 @@ void ExhaustMemoryWithRealloc() {
// We also use it so that the compiler doesn't discard certain return values
// as something we don't need (see the comment with calloc below).
template <typename Type>
-Type HideValueFromCompiler(volatile Type value) {
+NOINLINE Type HideValueFromCompiler(volatile Type value) {
#if defined(__GNUC__)
// In a GCC compatible compiler (GCC or Clang), make this compiler barrier
// more robust than merely using "volatile".
@@ -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
+ 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.
- scoped_ptr<char, base::FreeDeleter> array_pointer(
- static_cast<char*>(HideValueFromCompiler(calloc(nmemb, size))));
return HideValueFromCompiler(array_pointer.get()) == NULL;
}