This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/14181] New: Potential division by 0 indwarf_decode_lines_1()


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]