Skip to content

Commit 9995d42

Browse files
ktranmibrunin
authored andcommitted
[Backport] Security bug 1202534
Cherry-pick 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: [email protected] Fixed: chromium:1202534 No-Try: true No-Presubmit: true No-Tree-Checks: true Change-Id: I87c80a4bd785fa5c59a8dd0d5ac5f4b31b015ed8 Commit-Queue: Kim-Anh Tran <[email protected]> Commit-Queue: Benedikt Meurer <[email protected]> Auto-Submit: Kim-Anh Tran <[email protected]> Reviewed-by: Benedikt Meurer <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#74399} Reviewed-by: Achuith Bhandarkar <[email protected]> Commit-Queue: Artem Sumaneev <[email protected]> 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: Michal Klocek <[email protected]>
1 parent 8b6c2cc commit 9995d42

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

chromium/v8/src/inspector/v8-debugger-agent-impl.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,8 @@ Response V8DebuggerAgentImpl::setBreakpointByUrl(
499499
Maybe<int> optionalColumnNumber, Maybe<String16> optionalCondition,
500500
String16* outBreakpointId,
501501
std::unique_ptr<protocol::Array<protocol::Debugger::Location>>* locations) {
502+
if (!enabled()) return Response::ServerError(kDebuggerNotEnabled);
503+
502504
*locations = std::make_unique<Array<protocol::Debugger::Location>>();
503505

504506
int specified = (optionalURL.isJust() ? 1 : 0) +
@@ -587,6 +589,8 @@ Response V8DebuggerAgentImpl::setBreakpoint(
587589
String16 breakpointId = generateBreakpointId(
588590
BreakpointType::kByScriptId, location->getScriptId(),
589591
location->getLineNumber(), location->getColumnNumber(0));
592+
if (!enabled()) return Response::ServerError(kDebuggerNotEnabled);
593+
590594
if (m_breakpointIdToDebuggerBreakpointIds.find(breakpointId) !=
591595
m_breakpointIdToDebuggerBreakpointIds.end()) {
592596
return Response::ServerError(
@@ -605,6 +609,8 @@ Response V8DebuggerAgentImpl::setBreakpoint(
605609
Response V8DebuggerAgentImpl::setBreakpointOnFunctionCall(
606610
const String16& functionObjectId, Maybe<String16> optionalCondition,
607611
String16* outBreakpointId) {
612+
if (!enabled()) return Response::ServerError(kDebuggerNotEnabled);
613+
608614
InjectedScript::ObjectScope scope(m_session, functionObjectId);
609615
Response response = scope.initialize();
610616
if (!response.IsSuccess()) return response;

0 commit comments

Comments
 (0)