[Lldb-commits] [PATCH] D131658: [LLDB] Fix out-of-bounds memory access in EmulationStateArm

Slava Gurevich via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 11 01:34:29 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGab6a0823afc7: [LLDB] Fix out-of-bounds memory access in EmulationStateArm (authored by fixathon).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131658

Files:
  lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp


Index: lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp
===================================================================
--- lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp
+++ lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp
@@ -51,7 +51,7 @@
     if (reg_ctx->ReadRegister(reg_info, reg_value)) {
       uint64_t value = reg_value.GetAsUInt64();
       uint32_t idx = i - dwarf_d0;
-      if (i < 16) {
+      if (idx < 16) {
         m_vfp_regs.s_regs[idx * 2] = (uint32_t)value;
         m_vfp_regs.s_regs[idx * 2 + 1] = (uint32_t)(value >> 32);
       } else
@@ -92,7 +92,7 @@
     value = m_gpr[reg_num - dwarf_r0];
   else if ((dwarf_s0 <= reg_num) && (reg_num <= dwarf_s31)) {
     uint32_t idx = reg_num - dwarf_s0;
-    value = m_vfp_regs.d_regs[idx];
+    value = m_vfp_regs.s_regs[idx];
   } else if ((dwarf_d0 <= reg_num) && (reg_num <= dwarf_d31)) {
     uint32_t idx = reg_num - dwarf_d0;
     if (idx < 16)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131658.451766.patch
Type: text/x-patch
Size: 954 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220811/7fdc8466/attachment-0001.bin>


More information about the lldb-commits mailing list