[ob] Fix dwarf2 reader crash

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[ob] Fix dwarf2 reader crash

Mark Kettenis
DW_AT_decl_file can be zero, indicating no file.  It's better not to
crash in that case.

Mark


Index: ChangeLog
from  Mark Kettenis  <[hidden email]>

        * dwarf2read.c (new_symbol): Handle DW_AT_decl_file being zero.

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.213
diff -u -p -r1.213 dwarf2read.c
--- dwarf2read.c 23 Jan 2007 23:57:47 -0000 1.213
+++ dwarf2read.c 28 Jan 2007 14:39:55 -0000
@@ -7079,7 +7079,7 @@ new_symbol (struct die_info *die, struct
       || file_index > cu->line_header->num_file_names)
     complaint (&symfile_complaints,
        _("file index out of range"));
-  else
+  else if (file_index > 0)
     {
       struct file_entry *fe;
       fe = &cu->line_header->file_names[file_index - 1];
Reply | Threaded
Open this post in threaded view
|

Re: [ob] Fix dwarf2 reader crash

Daniel Jacobowitz-2
On Sun, Jan 28, 2007 at 03:42:29PM +0100, Mark Kettenis wrote:
> DW_AT_decl_file can be zero, indicating no file.  It's better not to
> crash in that case.

Whoops, thank you!

--
Daniel Jacobowitz
CodeSourcery