]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdwfl: Flag an error if CIE return_address_register is invalid.
authorMark Wielaard <mark@klomp.org>
Tue, 16 Jun 2020 16:24:43 +0000 (18:24 +0200)
committerMark Wielaard <mark@klomp.org>
Fri, 19 Jun 2020 17:58:11 +0000 (19:58 +0200)
If the CIE return address register is invalid (unknown) for the
architecture immediately flag an error and return.

Signed-off-by: Mark Wielaard <mark@klomp.org>
libdwfl/ChangeLog
libdwfl/frame_unwind.c

index 44b3ece77c0c415f4e82798b6f97058ff7a47cee..5a3d566ff61d4c8b54074589b600972b9420dfe0 100644 (file)
@@ -1,3 +1,8 @@
+2020-06-16  Mark Wielaard  <mark@klomp.org>
+
+       * frame_unwind.c (handle_cfi): Flag an error if
+       return_address_register is invalid.
+
 2020-06-16  Mark Wielaard  <mark@klomp.org>
 
        * linux-kernel-modules.c (try_kernel_name): Don't try other
index d7dfa5a94b660bcdaf2ca9506f5632efa35e3463..bdceeb3e0f3887ad545232eacc23c5815993dafd 100644 (file)
@@ -562,7 +562,11 @@ handle_cfi (Dwfl_Frame *state, Dwarf_Addr pc, Dwarf_CFI *cfi, Dwarf_Addr bias)
   /* The return register is special for setting the unwound->pc_state.  */
   unsigned ra = frame->fde->cie->return_address_register;
   bool ra_set = false;
-  ebl_dwarf_to_regno (ebl, &ra);
+  if (! ebl_dwarf_to_regno (ebl, &ra))
+    {
+      __libdwfl_seterrno (DWFL_E_INVALID_REGISTER);
+      return;
+    }
 
   for (unsigned regno = 0; regno < nregs; regno++)
     {