[Lldb-commits] [lldb] [lldb] Fix crash on creating string error (PR #212503)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Jul 28 07:11:07 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Ebuka Ezike (da-viper)
<details>
<summary>Changes</summary>
It crashes because the `default` error string may not be a format string compared to the `fallback` error string
---
Full diff: https://github.com/llvm/llvm-project/pull/212503.diff
1 Files Affected:
- (modified) lldb/source/Target/Target.cpp (+5-3)
``````````diff
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 148d7e0b30dbb..bb0c02e0f7930 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -3119,11 +3119,13 @@ Target::ReadInstructions(const Address &start_addr, uint32_t count,
ReadMemory(start_addr, data.GetBytes(), data.GetByteSize(), error,
force_live_memory, &load_addr);
- if (error.Fail())
+ if (error.Fail()) {
+ if (error.AsCString(/*default_error_str=*/nullptr))
+ return error.takeError();
return llvm::createStringErrorV(
- error.AsCString(
- "Target::ReadInstructions failed to read memory at {:x}"),
+ "Target::ReadInstructions failed to read memory at {:x}",
start_addr.GetLoadAddress(this));
+ }
const bool data_from_file = load_addr == LLDB_INVALID_ADDRESS;
if (!flavor_string || flavor_string[0] == '\0') {
``````````
</details>
https://github.com/llvm/llvm-project/pull/212503
More information about the lldb-commits
mailing list