diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-03 20:59:18 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-03 20:59:18 +0000 |
commit | f2950489c7c6e7b7fc2233e0cf47b8981e733011 (patch) | |
tree | 69bf8beaabe085b12b3577702d9331401e19290b /base/process_util_unittest.cc | |
parent | e4b3aab4953bc9e487c223cad98d10b60228fd47 (diff) | |
download | chromium_src-f2950489c7c6e7b7fc2233e0cf47b8981e733011.zip chromium_src-f2950489c7c6e7b7fc2233e0cf47b8981e733011.tar.gz chromium_src-f2950489c7c6e7b7fc2233e0cf47b8981e733011.tar.bz2 |
On 64 bit Macs, the malloc system automatically abort()s on heap corruption.
BUG=225806
TEST=ProcessUtilTest.MacTerminateOnHeapCorruption passes
Review URL: https://chromiumcodereview.appspot.com/13567003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192147 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util_unittest.cc')
-rw-r--r-- | base/process_util_unittest.cc | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc index be69b93..ef383b6 100644 --- a/base/process_util_unittest.cc +++ b/base/process_util_unittest.cc @@ -567,16 +567,20 @@ TEST_F(ProcessUtilTest, MacTerminateOnHeapCorruption) { // Assert that freeing an unallocated pointer will crash the process. char buf[3]; asm("" : "=r" (buf)); // Prevent clang from being too smart. -#if !defined(ADDRESS_SANITIZER) - ASSERT_DEATH(free(buf), "being freed.*" - "\\*\\*\\* set a breakpoint in malloc_error_break to debug.*" - "Terminating process due to a potential for future heap corruption"); -#else +#if ARCH_CPU_64_BITS + // On 64 bit Macs, the malloc system automatically abort()s on heap corruption + // but does not output anything. + ASSERT_DEATH(free(buf), ""); +#elif defined(ADDRESS_SANITIZER) // AddressSanitizer replaces malloc() and prints a different error message on // heap corruption. ASSERT_DEATH(free(buf), "attempting free on address which " "was not malloc\\(\\)-ed"); -#endif // !defined(ADDRESS_SANITIZER) +#else + ASSERT_DEATH(free(buf), "being freed.*" + "\\*\\*\\* set a breakpoint in malloc_error_break to debug.*" + "Terminating process due to a potential for future heap corruption"); +#endif // ARCH_CPU_64_BITS || defined(ADDRESS_SANITIZER) } #endif // defined(OS_MACOSX) |