[binutils-gdb] gdb/dwarf: remove unnecessary check in read_{rng, loc}list_index
Simon Marchi
simark@sourceware.org
Tue Feb 2 15:42:53 GMT 2021
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0c800c6ebc6bfc795575f3f37b27eba7ab1e7c11
commit 0c800c6ebc6bfc795575f3f37b27eba7ab1e7c11
Author: Simon Marchi <simon.marchi@efficios.com>
Date: Tue Feb 2 10:40:51 2021 -0500
gdb/dwarf: remove unnecessary check in read_{rng,loc}list_index
In read_rnglist_index and read_loclist_index, we check that both the
start and end of the offset that we read from the offset table are
within the section. I think it's unecessary to do both: if the end of
the offset is within the section, then surely the start of the offset is
within it.
Remove the check for the start of the offset in both functions.
gdb/ChangeLog:
* dwarf2/read.c (read_loclist_index): Remove bound check for
start of offset.
(read_rnglist_index): Likewise.
Change-Id: I7b57ddf4f8a8a28971738f0e3f3af62108f9e19a
Diff:
---
gdb/ChangeLog | 6 ++++++
gdb/dwarf2/read.c | 11 -----------
2 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8dd3147d3f1..b420a941184 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2021-02-02 Simon Marchi <simon.marchi@efficios.com>
+
+ * dwarf2/read.c (read_loclist_index): Remove bound check for
+ start of offset.
+ (read_rnglist_index): Likewise.
+
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
* dwarf2/read.c (read_loclist_index): Add bound check for the end
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 8d1edc29113..ee0f8bec446 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -20233,11 +20233,6 @@ read_loclist_index (struct dwarf2_cu *cu, ULONGEST loclist_index)
".debug_loclists offset array [in module %s]"),
objfile_name (objfile));
- if (start_offset >= section->size)
- error (_("DW_FORM_loclistx pointing outside of "
- ".debug_loclists section [in module %s]"),
- objfile_name (objfile));
-
/* Validate that reading won't go beyond the end of the section. */
if (start_offset + cu->header.offset_size > section->size)
error (_("Reading DW_FORM_loclistx index beyond end of"
@@ -20289,12 +20284,6 @@ read_rnglist_index (struct dwarf2_cu *cu, ULONGEST rnglist_index,
".debug_rnglists offset array [in module %s]"),
objfile_name (objfile));
- /* Validate that the offset is within the section's range. */
- if (start_offset >= section->size)
- error (_("DW_FORM_rnglistx pointing outside of "
- ".debug_rnglists section [in module %s]"),
- objfile_name (objfile));
-
/* Validate that reading won't go beyond the end of the section. */
if (start_offset + cu->header.offset_size > section->size)
error (_("Reading DW_FORM_rnglistx index beyond end of"
More information about the Gdb-cvs
mailing list