libdwfl: linux-proc-maps.c (proc_maps_report): Don't assert on bad input.
authorMark Wielaard <mjw@redhat.com>
Wed, 26 Feb 2014 16:00:39 +0000 (17:00 +0100)
committerMark Wielaard <mjw@redhat.com>
Mon, 3 Mar 2014 08:26:10 +0000 (09:26 +0100)
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
libdwfl/linux-proc-maps.c

index aacc0bf..ae58660 100644 (file)
@@ -1,5 +1,9 @@
 2014-02-26  Mark Wielaard  <mjw@redhat.com>
 
+       * linux-proc-maps.c (proc_maps_report): Don't assert on bad input.
+
+2014-02-26  Mark Wielaard  <mjw@redhat.com>
+
        * elf-from-memory.c (elf_from_remote_memory): Check against p64
        p_type in case ELFCLASS64, not against p32 p_type.
 
index cdb6959..a52920c 100644 (file)
@@ -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