Commit d1593128 authored by Karan Bhatia's avatar Karan Bhatia Committed by Commit Bot

IsolatedWorldCSP: Early return on invalid world id in SetIsolatedWorldInfo.

This CL adds an early return to TestRunnerForSpecificView::SetIsolatedWorldInfo.
This helps prevent a CHECK failure when a fuzzer provides invalid input.

BUG=977801

Change-Id: If105f5d0e3502b7c67e72b5aa54447fbcef8d153
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1673763
Commit-Queue: Karan Bhatia <karandeepb@chromium.org>
Reviewed-by: default avatarMike West <mkwst@chromium.org>
Auto-Submit: Karan Bhatia <karandeepb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#672618}
parent 672a1fe9
......@@ -16,6 +16,7 @@
#include "base/strings/string_number_conversions.h"
#include "build/build_config.h"
#include "cc/paint/paint_canvas.h"
#include "content/public/common/isolated_world_ids.h"
#include "content/renderer/compositor/layer_tree_view.h"
#include "content/shell/test_runner/layout_dump.h"
#include "content/shell/test_runner/mock_content_settings_client.h"
......@@ -626,8 +627,11 @@ void TestRunnerForSpecificView::SetIsolatedWorldInfo(
int world_id,
v8::Local<v8::Value> security_origin,
v8::Local<v8::Value> content_security_policy) {
if (world_id >= blink::IsolatedWorldId::kEmbedderWorldIdLimit)
if (world_id <= content::ISOLATED_WORLD_ID_GLOBAL &&
world_id >= blink::IsolatedWorldId::kEmbedderWorldIdLimit) {
return;
}
if (!security_origin->IsString() && !security_origin->IsNull())
return;
......
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