Commit cdbedb59 authored by Yuki Shiino's avatar Yuki Shiino Committed by Commit Bot

base/allocator: Disable OOM test when USE_PARTITION_ALLOC_AS_MALLOC

Disable an unittest that tests OOM allocation behaviors when
USE_PARTITION_ALLOC_AS_MALLOC because operator new (nothrow)
do not return nullptr and crash instead.

Bug: 998048
Change-Id: I14a2b25152568c912273215a24b9b528ddfa304e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2366446
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Reviewed-by: default avatarBenoit L <lizeb@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801320}
parent ba34b62b
...@@ -76,18 +76,23 @@ void OverflowTestsSoftExpectTrue(bool overflow_detected) { ...@@ -76,18 +76,23 @@ void OverflowTestsSoftExpectTrue(bool overflow_detected) {
#if defined(OS_FUCHSIA) || defined(OS_APPLE) || defined(ADDRESS_SANITIZER) || \ #if defined(OS_FUCHSIA) || defined(OS_APPLE) || defined(ADDRESS_SANITIZER) || \
defined(THREAD_SANITIZER) || defined(MEMORY_SANITIZER) || \ defined(THREAD_SANITIZER) || defined(MEMORY_SANITIZER) || \
BUILDFLAG(IS_HWASAN) BUILDFLAG(IS_HWASAN) || BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
#define MAYBE_NewOverflow DISABLED_NewOverflow #define MAYBE_NewOverflow DISABLED_NewOverflow
#else #else
#define MAYBE_NewOverflow NewOverflow #define MAYBE_NewOverflow NewOverflow
#endif #endif
// Test array[TooBig][X] and array[X][TooBig] allocations for int // Test that array[TooBig][X] and array[X][TooBig] allocations fail and not
// overflows. IOS doesn't honor nothrow, so disable the test there. // succeed with the wrong size allocation in case of size_t overflow. This
// test is disabled on environments that operator new (nothrow) crashes in
// case of size_t overflow.
//
// - iOS doesn't honor nothrow.
// - XSan aborts when operator new returns nullptr.
// - PartitionAlloc crashes by design when size_t overflows.
//
// TODO(https://crbug.com/828229): Fuchsia SDK exports an incorrect // TODO(https://crbug.com/828229): Fuchsia SDK exports an incorrect
// new[] that gets picked up in Debug/component builds, breaking this // new[] that gets picked up in Debug/component builds, breaking this
// test. Disabled on Mac for the same reason. Disabled under XSan // test. Disabled on Mac for the same reason.
// because asan aborts when new returns nullptr,
// https://bugs.chromium.org/p/chromium/issues/detail?id=690271#c15
TEST(SecurityTest, MAYBE_NewOverflow) { TEST(SecurityTest, MAYBE_NewOverflow) {
const size_t kArraySize = 4096; const size_t kArraySize = 4096;
// We want something "dynamic" here, so that the compiler doesn't // We want something "dynamic" here, so that the compiler doesn't
......
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