diff options
author | Vy Nguyen <vyng@google.com> | 2025-04-04 08:00:46 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-04 08:00:46 -0400 |
commit | a2e888f5b49113c66b055290cb7069ae88c9d2e1 (patch) | |
tree | cd79de04b9ec84cf4ea10ea659c987c5c3ac2499 /lldb/source/Interpreter/CommandInterpreter.cpp | |
parent | 0d17547879ffbd50d79907ea23fdac199758d45e (diff) | |
download | llvm-a2e888f5b49113c66b055290cb7069ae88c9d2e1.zip llvm-a2e888f5b49113c66b055290cb7069ae88c9d2e1.tar.gz llvm-a2e888f5b49113c66b055290cb7069ae88c9d2e1.tar.bz2 |
[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.
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r-- | lldb/source/Interpreter/CommandInterpreter.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 949b119..112d2f2 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -1918,7 +1918,9 @@ bool CommandInterpreter::HandleCommand(const char *command_line, // Those will be collected by the on-exit-callback. }); - helper.DispatchOnExit([&](lldb_private::telemetry::CommandInfo *info) { + helper.DispatchOnExit([&cmd_obj, &parsed_command_args, &result, + detailed_command_telemetry, command_id]( + lldb_private::telemetry::CommandInfo *info) { // TODO: this is logging the time the command-handler finishes. // But we may want a finer-grain durations too? // (ie., the execute_time recorded below?) |