This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[PATCH] libdwfl: linux-proc-maps.c (proc_maps_report): Don't assert on bad input.
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Wed, 26 Feb 2014 17:00:39 +0100
- Subject: [PATCH] libdwfl: linux-proc-maps.c (proc_maps_report): Don't assert on bad input.
If ino == last_ino && dmajor == last_dmajor && dminor == last_dminor then
we expect the file names to be the same as well. Which is reasonable if
the input came from the /proc file system. But there could be bad user
input if the file was supplied through dwfl_linux_proc_maps_report.
Instead of asserting on the bad input, just signal a bad_report.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
libdwfl/ChangeLog | 4 ++++
libdwfl/linux-proc-maps.c | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index e55b03b..7d25330 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,7 @@
+2014-02-26 Mark Wielaard <mjw@redhat.com>
+
+ * linux-proc-maps.c (proc_maps_report): Don't assert on bad input.
+
2014-01-17 Petr Machata <pmachata@redhat.com>
* relocate.c (relocate_section): Use gelf_fsize instead of relying
diff --git a/libdwfl/linux-proc-maps.c b/libdwfl/linux-proc-maps.c
index cdb6959..a52920c 100644
--- a/libdwfl/linux-proc-maps.c
+++ b/libdwfl/linux-proc-maps.c
@@ -241,7 +241,8 @@ proc_maps_report (Dwfl *dwfl, FILE *f, GElf_Addr sysinfo_ehdr, pid_t pid)
&& ino == last_ino && dmajor == last_dmajor && dminor == last_dminor)
{
/* This is another portion of the same file's mapping. */
- assert (!strcmp (last_file, file));
+ if (strcmp (last_file, file) != 0)
+ goto bad_report;
high = end;
}
else
--
1.8.5.3