* [PATCH] libdwfl: Make sure the note len increases each iteration
@ 2021-12-17 17:12 Mark Wielaard
0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2021-12-17 17:12 UTC (permalink / raw)
To: elfutils-devel; +Cc: Mark Wielaard
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>
---
libdwfl/ChangeLog | 5 +++++
libdwfl/dwfl_segment_report_module.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 21f3b6a4..a1288d44 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 73704efe..cad1a9b3 100644
--- a/libdwfl/dwfl_segment_report_module.c
+++ b/libdwfl/dwfl_segment_report_module.c
@@ -559,7 +559,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;
--
2.18.4
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-12-17 17:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17 17:12 [PATCH] libdwfl: Make sure the note len increases each iteration Mark Wielaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).