]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
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 aacc0bf2a60f7b31ba1bf07f4bf205368c631757..ae5866051ae651c94ca72c430d1fdcdbedbb70e5 100644 (file)
@@ -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-02-26  Mark Wielaard  <mjw@redhat.com>
 
        * elf-from-memory.c (elf_from_remote_memory): Check against p64
index cdb6959db38210fdec7a62498a810f66d03f001c..a52920cdab8867daa7b7fd0c87253ad2f252c548 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