summaryrefslogtreecommitdiff
path: root/libdwfl
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2021-12-17 18:09:31 +0100
committerMark Wielaard <mark@klomp.org>2021-12-18 02:24:28 +0100
commit163d1e9582efa8248057b088ad9c28fc8d24512e (patch)
tree1414fc7ff0b6319cad7139f0f51007ec05d6a53d /libdwfl
parent3831c0b2c2334b129a9d04f12dc7549db412d3bd (diff)
downloadelfutils-163d1e9582efa8248057b088ad9c28fc8d24512e.tar.gz
libdwfl: Make sure the note len increases each iteration
In dwfl_segment_report_module we have an overflow check when reading notes, but we could still not make any progress if the number of bytes read (len) didn't increase at all. Check len > last_len. Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'libdwfl')
-rw-r--r--libdwfl/ChangeLog5
-rw-r--r--libdwfl/dwfl_segment_report_module.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 6a3e041b..d00ce702 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,8 @@
+2021-12-08 Mark Wielaard <mark@klomp.org>
+
+ * dwfl_segment_report_module.c (dwfl_segment_report_module): Make
+ sure the note len increases each iteration.
+
2021-12-17 Mark Wielaard <mark@klomp.org>
* libdwflP.h (dwfl_segment_report_module): Add maxread argument.
diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c
index 3e87d207..89e05103 100644
--- a/libdwfl/dwfl_segment_report_module.c
+++ b/libdwfl/dwfl_segment_report_module.c
@@ -562,7 +562,7 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
note_desc = notes + len;
if (unlikely (filesz < len + nh->n_descsz
- || len < last_len
+ || len <= last_len
|| len + nh->n_descsz < last_len))
break;