[Lldb-commits] [lldb] 7518e0f - Avoid using a variable-sized array for a tiny allocation.
Sterling Augustine via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 15 13:04:25 PDT 2022
Author: Sterling Augustine
Date: 2022-03-15T13:00:14-07:00
New Revision: 7518e0ff63cdee4b4082e918e1b5603115777d9b
URL: https://github.com/llvm/llvm-project/commit/7518e0ff63cdee4b4082e918e1b5603115777d9b
DIFF: https://github.com/llvm/llvm-project/commit/7518e0ff63cdee4b4082e918e1b5603115777d9b.diff
LOG: Avoid using a variable-sized array for a tiny allocation.
Differential Revision: https://reviews.llvm.org/D121732
Added:
Modified:
lldb/source/Expression/DWARFExpression.cpp
Removed:
################################################################################
diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp
index 0f6c380fe0357..5ee62fb4376b8 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -1297,7 +1297,7 @@ bool DWARFExpression::Evaluate(
addr_t load_addr = *maybe_load_addr;
if (load_addr == LLDB_INVALID_ADDRESS && so_addr.IsSectionOffset()) {
- uint8_t addr_bytes[size];
+ uint8_t addr_bytes[8];
Status error;
if (exe_ctx->GetTargetRef().ReadMemory(
@@ -1306,7 +1306,7 @@ bool DWARFExpression::Evaluate(
ObjectFile *objfile = module_sp->GetObjectFile();
stack.back().GetScalar() = DerefSizeExtractDataHelper(
- addr_bytes, sizeof(addr_bytes), objfile->GetByteOrder(), size);
+ addr_bytes, size, objfile->GetByteOrder(), size);
stack.back().ClearContext();
break;
} else {
More information about the lldb-commits
mailing list