gdb/dwarf-decode-lines.diff

31 lines
1.0 KiB
Diff

Index: gdb/dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.290
diff -u -a -p -u -p -a -r1.290 gdb/dwarf2read.c
--- gdb/dwarf2read.c 24 Oct 2008 18:21:00 -0000 1.290
+++ gdb/dwarf2read.c 27 Oct 2008 14:33:51 -0000
@@ -7090,6 +7090,13 @@ dwarf_decode_lines (struct line_header *
/* Decode the table. */
while (!end_sequence)
{
+ if (line_ptr >= line_end)
+ {
+ complaint (&symfile_complaints,
+ _("mangled .debug_line section"));
+ return;
+ }
+
op_code = read_1_byte (abfd, line_ptr);
line_ptr += 1;
@@ -7220,7 +7227,7 @@ dwarf_decode_lines (struct line_header *
file = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
line_ptr += bytes_read;
- if (lh->num_file_names < file)
+ if (file == 0 || lh->num_file_names < file)
dwarf2_debug_line_missing_file_complaint ();
else
{