DWARF-5: Fix parsing DWARF-5 line number tables
authorH.J. Lu <hjl.tools@gmail.com>
Sun, 24 Jan 2021 02:17:37 +0000 (18:17 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Sun, 24 Jan 2021 02:17:48 +0000 (18:17 -0800)
Advance rngs_ptr when parsing DW_RLE_offset_pair, which was missing in

commit c3757b583d2448a5996e83e374fb96ac7938da35
Author: Mark Wielaard <mark@klomp.org>
Date:   Tue Aug 25 15:33:00 2020 +0100

    Fix the linker's handling of DWARF-5 line number tables.

PR binutils/27231
* dwarf2.c (read_rnglists): Advance rngs_ptr after
_bfd_safe_read_leb128 when parsing DW_RLE_offset_pair.

bfd/ChangeLog
bfd/dwarf2.c

index a5e2304bd9450965bc46de764ab62936d669c0aa..9d23a8a083675ce38e01fabc5d1e1bd71929a976 100644 (file)
@@ -1,3 +1,9 @@
+2021-01-23  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR binutils/27231
+       * dwarf2.c (read_rnglists): Advance rngs_ptr after
+       _bfd_safe_read_leb128 when parsing DW_RLE_offset_pair.
+
 2021-01-20  Alan Modra  <amodra@gmail.com>
 
        * elf32-ppc.c: Delete outdated comment.
index d1770ae4fdbedbb65a2830495b0bd9f142deef52..292d60c33d4f44b796676baed9ccf574527ee842 100644 (file)
@@ -3265,9 +3265,11 @@ read_rnglists (struct comp_unit *unit, struct arange *arange,
          low_pc = base_address;
          low_pc += _bfd_safe_read_leb128 (abfd, rngs_ptr, &bytes_read,
                                           FALSE, rngs_end);
+         rngs_ptr += bytes_read;
          high_pc = base_address;
          high_pc += _bfd_safe_read_leb128 (abfd, rngs_ptr, &bytes_read,
                                            FALSE, rngs_end);
+         rngs_ptr += bytes_read;
          break;
 
        case DW_RLE_start_end: