This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
readelf .debug_line fix
- To: binutils at sources dot redhat dot com
- Subject: readelf .debug_line fix
- From: Richard Henderson <rth at redhat dot com>
- Date: Fri, 17 Nov 2000 00:30:57 -0800
info.li_length is a bfd_vma; the size of the external length field
is exactly 4. Thus using sizeof is incorrect, and in fact results
in garbage on Alpha.
r~
* readelf.c (display_debug_lines): Fix section length check
and end_of_sequence computation.
Index: readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.70
diff -c -p -d -r1.70 readelf.c
*** readelf.c 2000/11/05 19:18:34 1.70
--- readelf.c 2000/11/17 08:27:35
*************** display_debug_lines (section, start, fil
*** 5005,5011 ****
/* Check the length of the block. */
info.li_length = BYTE_GET (external->li_length);
! if (info.li_length > section->sh_size)
{
warn
(_("The line info appears to be corrupt - the section is too small\n"));
--- 5005,5011 ----
/* Check the length of the block. */
info.li_length = BYTE_GET (external->li_length);
! if (info.li_length + 4 > section->sh_size)
{
warn
(_("The line info appears to be corrupt - the section is too small\n"));
*************** display_debug_lines (section, start, fil
*** 5040,5046 ****
printf (_(" Line Range: %d\n"), info.li_line_range);
printf (_(" Opcode Base: %d\n"), info.li_opcode_base);
! end_of_sequence = data + info.li_length + sizeof (info.li_length);
reset_state_machine (info.li_default_is_stmt);
--- 5040,5046 ----
printf (_(" Line Range: %d\n"), info.li_line_range);
printf (_(" Opcode Base: %d\n"), info.li_opcode_base);
! end_of_sequence = data + info.li_length + 4;
reset_state_machine (info.li_default_is_stmt);