summaryrefslogtreecommitdiffstats
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
parentlibdwfl: Make dwfl_segment_report_module aware of maximum Elf size (diff)
downloadelfutils-163d1e9582efa8248057b088ad9c28fc8d24512e.tar.gz
elfutils-163d1e9582efa8248057b088ad9c28fc8d24512e.tar.bz2
elfutils-163d1e9582efa8248057b088ad9c28fc8d24512e.tar.xz
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 @@
12021-12-08 Mark Wielaard <mark@klomp.org>
2
3 * dwfl_segment_report_module.c (dwfl_segment_report_module): Make
4 sure the note len increases each iteration.
5
12021-12-17 Mark Wielaard <mark@klomp.org> 62021-12-17 Mark Wielaard <mark@klomp.org>
2 7
3 * libdwflP.h (dwfl_segment_report_module): Add maxread argument. 8 * 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,
562 note_desc = notes + len; 562 note_desc = notes + len;
563 563
564 if (unlikely (filesz < len + nh->n_descsz 564 if (unlikely (filesz < len + nh->n_descsz
565 || len < last_len 565 || len <= last_len
566 || len + nh->n_descsz < last_len)) 566 || len + nh->n_descsz < last_len))
567 break; 567 break;
568 568