[Lldb-commits] [PATCH] D121732: Avoid using a variable-sized array for a tiny allocation.

Sterling Augustine via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 15 13:04:28 PDT 2022


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7518e0ff63cd: Avoid using a variable-sized array for a tiny allocation. (authored by saugustine).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121732/new/

https://reviews.llvm.org/D121732

Files:
  lldb/source/Expression/DWARFExpression.cpp


Index: lldb/source/Expression/DWARFExpression.cpp
===================================================================
--- lldb/source/Expression/DWARFExpression.cpp
+++ lldb/source/Expression/DWARFExpression.cpp
@@ -1297,7 +1297,7 @@
         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 @@
             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 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121732.415551.patch
Type: text/x-patch
Size: 895 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220315/466ec3fa/attachment.bin>


More information about the lldb-commits mailing list