[Lldb-commits] [lldb] [LLDB][NFC]Fix stack-use-after free bug. (PR #134296)
Vy Nguyen via lldb-commits
lldb-commits at lists.llvm.org
Thu Apr 3 12:30:30 PDT 2025
https://github.com/oontvoo created https://github.com/llvm/llvm-project/pull/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.
>From 96025fd1183f257c52ed889e882c808dd44e129a Mon Sep 17 00:00:00 2001
From: Vy Nguyen <vyng at google.com>
Date: Thu, 3 Apr 2025 15:28:22 -0400
Subject: [PATCH] [LLDB][NFC]Fix stack-use-after free bug.
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.
---
lldb/source/Interpreter/CommandInterpreter.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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?)
More information about the lldb-commits
mailing list