public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/14181] New: Potential division by 0 in dwarf_decode_lines_1()
@ 2012-05-30  7:40 ingolf.steinbach at googlemail dot com
  0 siblings, 0 replies; only message in thread
From: ingolf.steinbach at googlemail dot com @ 2012-05-30  7:40 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14181

             Bug #: 14181
           Summary: Potential division by 0 in dwarf_decode_lines_1()
           Product: gdb
           Version: 7.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
        AssignedTo: unassigned@sourceware.org
        ReportedBy: ingolf.steinbach@googlemail.com
    Classification: Unclassified
              Host: i686-pc-linux-gnu
            Target: sparc-rtems4.8


The function dwarf_decode_lines_1() (gdb/dwarf2read.c) misses some sanity
checks and divides by 0 when there are errors in the ELF file which is selected
for debugging.

In 4.7.1, dwarf_decode_lines_1 contains the following code:

          if (op_code >= lh->opcode_base)
            {
              /* Special operand.  */
              adj_opcode = op_code - lh->opcode_base;
              address += (((op_index + (adj_opcode / lh->line_range))
                           / lh->maximum_ops_per_instruction)
                          * lh->minimum_instruction_length);

There is no safeguard against division by 0 when (for whatever reason)
line_range and/or minimum_instruction_length is 0. As a result, gdb hangs
indefinitely when reading the ELF file.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-05-30  7:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-30  7:40 [Bug gdb/14181] New: Potential division by 0 in dwarf_decode_lines_1() ingolf.steinbach at googlemail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).