[Lldb-commits] [PATCH] D59495: Fix an out-of-bounds error in RegisterContextDarwin_arm64

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 18 08:50:08 PDT 2019


labath created this revision.
labath added a reviewer: jasonmolenda.
Herald added subscribers: kristof.beyls, javed.absar.

gcc diagnoses this as "array subscript 63 is above array bounds of
'RegisterContextDarwin_arm64::VReg [32]'".

The correct fix seems to be subtracting the fpu register base index, but
I have no way of verifying that this actually works.


https://reviews.llvm.org/D59495

Files:
  source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp


Index: source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
===================================================================
--- source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
+++ source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
@@ -429,7 +429,7 @@
   case fpu_v29:
   case fpu_v30:
   case fpu_v31:
-    value.SetBytes(fpu.v[reg].bytes.buffer, reg_info->byte_size,
+    value.SetBytes(fpu.v[reg - fpu_v0].bytes.buffer, reg_info->byte_size,
                    endian::InlHostByteOrder());
     break;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59495.191101.patch
Type: text/x-patch
Size: 547 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190318/77aa023b/attachment.bin>


More information about the lldb-commits mailing list