Commit 4d99f02a authored by Vladimir Levin's avatar Vladimir Levin Committed by Commit Bot

DL: Speculative fix for a leak in display_lock_fuzzer.

This replaces a leaky new with a local static variable for the display
lock fuzzer environment.

This is a speculative fix for the referenced bug.

R=schenney@chromium.org

Bug: 1013486
Change-Id: I717437eac8d3d6f3d81515e2822209a676047698
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1873916
Commit-Queue: vmpstr <vmpstr@chromium.org>
Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709212}
parent d6d08107
......@@ -9,23 +9,14 @@
#include "third_party/blink/public/web/web_view.h"
#include "third_party/blink/public/web/web_widget.h"
static content::Env* env;
bool Initialize() {
blink::WebRuntimeFeatures::EnableDisplayLocking(true);
env = new content::Env();
return true;
}
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
static bool initialized = Initialize();
// Suppress unused variable warning.
(void)initialized;
// Only handle reasonable size inputs.
if (size < 1 || size > 10000)
return 0;
blink::WebRuntimeFeatures::EnableDisplayLocking(true);
static base::NoDestructor<content::Env> env;
std::string data_as_string(reinterpret_cast<const char*>(data), size);
int num_rafs = std::hash<std::string>()(data_as_string) % 10;
env->adapter->LoadHTML(data_as_string, "");
......
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