Skip to content

Commit a2e888f

Browse files
authored
[LLDB][NFC]Fix stack-use-after free bug. (#134296)
Details: detailed_command_telemetry (bool) and command_id (int) could already be freed when the dispatcher's dtor runs. So we should just copy them into the lambda since they are cheap.
1 parent 0d17547 commit a2e888f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lldb/source/Interpreter/CommandInterpreter.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1918,7 +1918,9 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
19181918
// Those will be collected by the on-exit-callback.
19191919
});
19201920

1921-
helper.DispatchOnExit([&](lldb_private::telemetry::CommandInfo *info) {
1921+
helper.DispatchOnExit([&cmd_obj, &parsed_command_args, &result,
1922+
detailed_command_telemetry, command_id](
1923+
lldb_private::telemetry::CommandInfo *info) {
19221924
// TODO: this is logging the time the command-handler finishes.
19231925
// But we may want a finer-grain durations too?
19241926
// (ie., the execute_time recorded below?)

0 commit comments

Comments
 (0)