diff options
author | Nick Clifton <nickc@redhat.com> | 2019-08-22 13:11:18 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2019-08-22 13:11:18 +0100 |
commit | 4ac948a0447f1abc9bc3b2c38363e883b1b06634 (patch) | |
tree | b8842aa89259288ca1383734578da5c92c85f9ed /binutils/dwarf.c | |
parent | a3197745b1edfd711e345b7c94c68be85eb11e48 (diff) | |
download | gdb-4ac948a0447f1abc9bc3b2c38363e883b1b06634.zip gdb-4ac948a0447f1abc9bc3b2c38363e883b1b06634.tar.gz gdb-4ac948a0447f1abc9bc3b2c38363e883b1b06634.tar.bz2 |
Prevent a floating point exception in the dwarf parser when a CU or TU table does not have any columns.
PR 24921
* dwarf.c (process_cu_tu_index): Handle the case where a table
does not have any columns.
Diffstat (limited to 'binutils/dwarf.c')
-rw-r--r-- | binutils/dwarf.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/binutils/dwarf.c b/binutils/dwarf.c index e792a17..b36406c 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -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); |