summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim-Anh Tran <kimanh@chromium.org>2021-05-06 10:02:01 +0200
committerMichael BrĂ¼ning <michael.bruning@qt.io>2021-11-10 18:19:53 +0000
commit572ed10be12eefbd75c20292e812c7321d25ff2b (patch)
treec4b1596e6c68e2b0ae3fcca6e1b96d1453ffa638
parentaa041d5236cb8b3bb9b200612959d2d1d86bfbce (diff)
downloadqtwebengine-chromium-572ed10be12eefbd75c20292e812c7321d25ff2b.tar.gz
[Backport] Security bug 1202534
Manual backport of patch originally reviewed on https://chromium-review.googlesource.com/c/v8/v8/+/2940882: M86-LTS: [debugger] Return ServerError if debugger agent is disabled This returns a server error on setting breakpoints if the agent is disabled. (cherry picked from commit 5aa2de8128f885c44df79d38fb4aa5c6a5d94306) Also-by: bmeurer@chromium.org Fixed: chromium:1202534 No-Try: true No-Presubmit: true No-Tree-Checks: true Change-Id: I87c80a4bd785fa5c59a8dd0d5ac5f4b31b015ed8 Commit-Queue: Kim-Anh Tran <kimanh@chromium.org> Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Auto-Submit: Kim-Anh Tran <kimanh@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#74399} Reviewed-by: Achuith Bhandarkar <achuith@chromium.org> Commit-Queue: Artem Sumaneev <asumaneev@google.com> Cr-Commit-Position: refs/branch-heads/8.6@{#105} Cr-Branched-From: a64aed2333abf49e494d2a5ce24bbd14fff19f60-refs/heads/8.6.395@{#1} Cr-Branched-From: a626bc036236c9bf92ac7b87dc40c9e538b087e3-refs/heads/master@{#69472} Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--chromium/v8/src/inspector/v8-debugger-agent-impl.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/chromium/v8/src/inspector/v8-debugger-agent-impl.cc b/chromium/v8/src/inspector/v8-debugger-agent-impl.cc
index e4e6492b67a..6e53773215a 100644
--- a/chromium/v8/src/inspector/v8-debugger-agent-impl.cc
+++ b/chromium/v8/src/inspector/v8-debugger-agent-impl.cc
@@ -455,6 +455,8 @@ Response V8DebuggerAgentImpl::setBreakpointByUrl(
Maybe<int> optionalColumnNumber, Maybe<String16> optionalCondition,
String16* outBreakpointId,
std::unique_ptr<protocol::Array<protocol::Debugger::Location>>* locations) {
+ if (!enabled()) return Response::Error(kDebuggerNotEnabled);
+
*locations = Array<protocol::Debugger::Location>::create();
int specified = (optionalURL.isJust() ? 1 : 0) +
@@ -542,6 +544,8 @@ Response V8DebuggerAgentImpl::setBreakpoint(
String16 breakpointId = generateBreakpointId(
BreakpointType::kByScriptId, location->getScriptId(),
location->getLineNumber(), location->getColumnNumber(0));
+ if (!enabled()) return Response::Error(kDebuggerNotEnabled);
+
if (m_breakpointIdToDebuggerBreakpointIds.find(breakpointId) !=
m_breakpointIdToDebuggerBreakpointIds.end()) {
return Response::Error("Breakpoint at specified location already exists.");
@@ -558,6 +562,8 @@ Response V8DebuggerAgentImpl::setBreakpoint(
Response V8DebuggerAgentImpl::setBreakpointOnFunctionCall(
const String16& functionObjectId, Maybe<String16> optionalCondition,
String16* outBreakpointId) {
+ if (!enabled()) return Response::Error(kDebuggerNotEnabled);
+
InjectedScript::ObjectScope scope(m_session, functionObjectId);
Response response = scope.initialize();
if (!response.isSuccess()) return response;