]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdw: Make sure to initialize Dwarf_CU addr_base and str_off_base.
authorMark Wielaard <mark@klomp.org>
Wed, 4 Apr 2018 14:43:38 +0000 (16:43 +0200)
committerMark Wielaard <mark@klomp.org>
Wed, 4 Apr 2018 14:43:38 +0000 (16:43 +0200)
The __libdw_cu_addr_base () and __libdw_cu_str_off_base () functions
rely on these fields being initialized to -1 when the values have not
yet been set up. Shows up as a valgrind warning.

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

index ee6a1eba7dd59be046206a4f815bbf7b609652ad..ad62771212c517cde8405766f829dea265f20339 100644 (file)
@@ -1,3 +1,8 @@
+2018-04-04  Mark Wielaard  <mark@klomp.org>
+
+       * libdw_findcu.c (__libdw_intern_next_unit): Initialize Dwarf_CU
+       addr_base and str_off_base.
+
 2018-03-23  Mark Wielaard  <mark@klomp.org>
 
        * dwarf_begin_elf.c (dwarf_scnnames): Add IDX_debug_str_offsets,
index 4d1d842c3fc8cc586162e089350121167160f5cb..04390b4567a87c7ca7c0332075d28b4f642426e3 100644 (file)
@@ -116,6 +116,8 @@ __libdw_intern_next_unit (Dwarf *dbg, bool debug_types)
   newp->orig_abbrev_offset = newp->last_abbrev_offset = abbrev_offset;
   newp->lines = NULL;
   newp->locs = NULL;
+  newp->addr_base = (Dwarf_Off) -1;
+  newp->str_off_base = (Dwarf_Off) -1;
 
   newp->startp = data->d_buf + newp->start;
   newp->endp = data->d_buf + newp->end;