Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1440)

Unified Diff: content/shell/renderer/test_runner/event_sender.cc

Issue 1140813007: Fix cluster-fuzz crash with internal EventSender API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/renderer/test_runner/event_sender.cc
diff --git a/content/shell/renderer/test_runner/event_sender.cc b/content/shell/renderer/test_runner/event_sender.cc
index f1acaadfbb624afcf6913cf6a7488535dfc2b5e0..a6482a7d3c5bd244f76ad30bdee9e107b112904f 100644
--- a/content/shell/renderer/test_runner/event_sender.cc
+++ b/content/shell/renderer/test_runner/event_sender.cc
@@ -1375,7 +1375,12 @@ void EventSender::KeyDown(const std::string& code_str,
if (!code) {
WebString web_code_str =
WebString::fromUTF8(code_str.data(), code_str.size());
- DCHECK_EQ(1u, web_code_str.length());
+ if (web_code_str.length() != 1u) {
+ v8::Isolate* isolate = blink::mainThreadIsolate();
+ isolate->ThrowException(v8::Exception::TypeError(
+ gin::StringToV8(isolate, "Invalid web code.")));
+ return;
+ }
text = code = web_code_str.at(0);
needs_shift_key_modifier = NeedsShiftModifier(code);
if ((code & 0xFF) >= 'a' && (code & 0xFF) <= 'z')
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698