[Lldb-commits] [lldb] [lldb][windows] fix a use before allocation crash (PR #170530)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Dec 3 10:40:00 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-platform-windows
Author: Charles Zablit (charles-zablit)
<details>
<summary>Changes</summary>
This patch fixes a crash in `ProcessLauncherWindows::GetInheritedHandles` which was introduced by https://github.com/llvm/llvm-project/pull/170301.
`ProcessLauncherWindows::GetInheritedHandles` was trying to use `startupinfoex.lpAttributeList` which was still `NULL`.
---
Full diff: https://github.com/llvm/llvm-project/pull/170530.diff
1 Files Affected:
- (modified) lldb/source/Host/windows/ProcessLauncherWindows.cpp (+8-8)
``````````diff
diff --git a/lldb/source/Host/windows/ProcessLauncherWindows.cpp b/lldb/source/Host/windows/ProcessLauncherWindows.cpp
index 3c0da1a1e70db..73fff6b234eae 100644
--- a/lldb/source/Host/windows/ProcessLauncherWindows.cpp
+++ b/lldb/source/Host/windows/ProcessLauncherWindows.cpp
@@ -107,14 +107,6 @@ ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo &launch_info,
::CloseHandle(stderr_handle);
});
- auto inherited_handles_or_err = GetInheritedHandles(
- launch_info, startupinfoex, stdout_handle, stderr_handle, stdin_handle);
- if (!inherited_handles_or_err) {
- error = Status(inherited_handles_or_err.getError());
- return HostProcess();
- }
- inherited_handles = *inherited_handles_or_err;
-
SIZE_T attributelist_size = 0;
InitializeProcThreadAttributeList(/*lpAttributeList=*/nullptr,
/*dwAttributeCount=*/1, /*dwFlags=*/0,
@@ -133,6 +125,14 @@ ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo &launch_info,
auto delete_attributelist = llvm::make_scope_exit(
[&] { DeleteProcThreadAttributeList(startupinfoex.lpAttributeList); });
+ auto inherited_handles_or_err = GetInheritedHandles(
+ launch_info, startupinfoex, stdout_handle, stderr_handle, stdin_handle);
+ if (!inherited_handles_or_err) {
+ error = Status(inherited_handles_or_err.getError());
+ return HostProcess();
+ }
+ inherited_handles = *inherited_handles_or_err;
+
const char *hide_console_var =
getenv("LLDB_LAUNCH_INFERIORS_WITHOUT_CONSOLE");
if (hide_console_var &&
``````````
</details>
https://github.com/llvm/llvm-project/pull/170530
More information about the lldb-commits
mailing list