| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #define _CRT_SECURE_NO_WARNINGS | 5 #define _CRT_SECURE_NO_WARNINGS |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/eintr_wrapper.h" | 10 #include "base/eintr_wrapper.h" |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 #endif // defined(OS_WIN) | 448 #endif // defined(OS_WIN) |
| 449 | 449 |
| 450 #if defined(OS_MACOSX) | 450 #if defined(OS_MACOSX) |
| 451 | 451 |
| 452 TEST_F(ProcessUtilTest, MacTerminateOnHeapCorruption) { | 452 TEST_F(ProcessUtilTest, MacTerminateOnHeapCorruption) { |
| 453 // Note that base::EnableTerminationOnHeapCorruption() is called as part of | 453 // Note that base::EnableTerminationOnHeapCorruption() is called as part of |
| 454 // test suite setup and does not need to be done again, else mach_override | 454 // test suite setup and does not need to be done again, else mach_override |
| 455 // will fail. | 455 // will fail. |
| 456 | 456 |
| 457 char buf[3]; | 457 char buf[3]; |
| 458 #ifndef ADDRESS_SANITIZER |
| 458 ASSERT_DEATH(free(buf), "being freed.*" | 459 ASSERT_DEATH(free(buf), "being freed.*" |
| 459 "\\*\\*\\* set a breakpoint in malloc_error_break to debug.*" | 460 "\\*\\*\\* set a breakpoint in malloc_error_break to debug.*" |
| 460 "Terminating process due to a potential for future heap corruption"); | 461 "Terminating process due to a potential for future heap corruption"); |
| 462 #else |
| 463 // AddressSanitizer replaces malloc() and prints a different error message on |
| 464 // heap corruption. |
| 465 ASSERT_DEATH(free(buf), "attempting free on address which " |
| 466 "was not malloc()-ed: .*"); |
| 467 #endif |
| 461 } | 468 } |
| 462 | 469 |
| 463 #endif // defined(OS_MACOSX) | 470 #endif // defined(OS_MACOSX) |
| 464 | 471 |
| 465 #if defined(OS_POSIX) | 472 #if defined(OS_POSIX) |
| 466 | 473 |
| 467 namespace { | 474 namespace { |
| 468 | 475 |
| 469 // Returns the maximum number of files that a process can have open. | 476 // Returns the maximum number of files that a process can have open. |
| 470 // Returns 0 on error. | 477 // Returns 0 on error. |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 SetUpInDeathAssert(); | 1157 SetUpInDeathAssert(); |
| 1151 while ((value_ = base::AllocatePsychoticallyBigObjCObject())) {} | 1158 while ((value_ = base::AllocatePsychoticallyBigObjCObject())) {} |
| 1152 }, ""); | 1159 }, ""); |
| 1153 } | 1160 } |
| 1154 | 1161 |
| 1155 #endif // !ARCH_CPU_64_BITS | 1162 #endif // !ARCH_CPU_64_BITS |
| 1156 #endif // OS_MACOSX | 1163 #endif // OS_MACOSX |
| 1157 | 1164 |
| 1158 #endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) && | 1165 #endif // !defined(OS_ANDROID) && !defined(OS_OPENBSD) && |
| 1159 // !defined(OS_WIN) && !defined(ADDRESS_SANITIZER) | 1166 // !defined(OS_WIN) && !defined(ADDRESS_SANITIZER) |
| OLD | NEW |