[Lldb-commits] [lldb] [LLDB][NFC]Fix stack-use-after free bug. (PR #134296)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Apr 3 12:31:08 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Vy Nguyen (oontvoo)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/134296.diff
1 Files Affected:
- (modified) lldb/source/Interpreter/CommandInterpreter.cpp (+3-1)
``````````diff
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 949b1191c28f0..112d2f20fda41 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?)
``````````
</details>
https://github.com/llvm/llvm-project/pull/134296
More information about the lldb-commits
mailing list