Prevent a floating point exception in the dwarf parser when a CU or TU table does...
authorNick Clifton <nickc@redhat.com>
Thu, 22 Aug 2019 12:11:18 +0000 (13:11 +0100)
committerNick Clifton <nickc@redhat.com>
Thu, 22 Aug 2019 12:11:18 +0000 (13:11 +0100)
PR 24921
* dwarf.c (process_cu_tu_index): Handle the case where a table
does not have any columns.

binutils/dwarf.c

index e792a17018cc908bdc2af1ca397822cfad0e0260..b36406c0e3a6a5c945f745f35441b5ca3bd27c51 100644 (file)
@@ -9411,11 +9411,12 @@ process_cu_tu_index (struct dwarf_section *section, int do_display)
       /* PR 17531: file: 0dd159bf.
         Check for integer overflow (can occur when size_t is 32-bit)
         with overlarge ncols or nused values.  */
-      if ((size_t) ncols * 4 / 4 != ncols
-         || (size_t) nused * ncols * 4 / ((size_t) ncols * 4) != nused
-         || poffsets < ppool || poffsets > limit
-         || psizes < poffsets || psizes > limit
-         || pend < psizes || pend > limit)
+      if (ncols > 0
+         && ((size_t) ncols * 4 / 4 != ncols
+             || (size_t) nused * ncols * 4 / ((size_t) ncols * 4) != nused
+             || poffsets < ppool || poffsets > limit
+             || psizes < poffsets || psizes > limit
+             || pend < psizes || pend > limit))
        {
          warn (_("Section %s too small for offset and size tables\n"),
                section->name);
This page took 0.028247 seconds and 4 git commands to generate.