Commit 66eccb95 authored by Ben Wagner's avatar Ben Wagner Committed by Commit Bot

Correct memory allocators in paint_op_buffer_fuzzer

Properly have 'new' terminate on oom and set the discardable memory
allocator so that it can be used.

Bug: chromium:993654
Change-Id: I9d26135447f8174d528ac1e44dc6165cfcf93233
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1754530Reviewed-by: default avatarenne <enne@chromium.org>
Commit-Queue: Ben Wagner <bungeman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#687412}
parent 057ab2b3
......@@ -118,6 +118,7 @@ fuzzer_test("paint_op_buffer_fuzzer") {
libfuzzer_options = [ "max_len=4096" ]
deps = [
"//base/test:test_support",
"//cc:test_support",
"//cc/paint",
"//components/viz/test:test_support",
......
......@@ -6,6 +6,8 @@
#include <stdint.h>
#include "base/command_line.h"
#include "base/process/memory.h"
#include "base/test/test_discardable_memory_allocator.h"
#include "cc/paint/paint_cache.h"
#include "cc/paint/paint_op_buffer.h"
#include "cc/test/transfer_cache_test_helper.h"
......@@ -20,7 +22,16 @@ struct Environment {
// Disable noisy logging as per "libFuzzer in Chrome" documentation:
// testing/libfuzzer/getting_started.md#Disable-noisy-error-message-logging.
logging::SetMinLogLevel(logging::LOG_FATAL);
base::EnableTerminationOnOutOfMemory();
base::DiscardableMemoryAllocator::SetInstance(
&discardable_memory_allocator);
}
~Environment() { base::DiscardableMemoryAllocator::SetInstance(nullptr); }
private:
base::TestDiscardableMemoryAllocator discardable_memory_allocator;
};
class FontSupport : public gpu::ServiceFontManager::Client {
......
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