|
From: <sv...@va...> - 2005-10-04 16:54:55
|
Author: tom
Date: 2005-10-04 17:54:54 +0100 (Tue, 04 Oct 2005)
New Revision: 4856
Log:
Make sure we have all the DWARF2 sections before trying to decode
any DWARF2 debug information. All make sure we don't fall over if
the .debug_info is less than four bytes long. Fixed bug 113642.
Modified:
trunk/coregrind/m_debuginfo/dwarf.c
trunk/coregrind/m_debuginfo/symtab.c
Modified: trunk/coregrind/m_debuginfo/dwarf.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_debuginfo/dwarf.c 2005-10-04 16:45:28 UTC (rev 4855=
)
+++ trunk/coregrind/m_debuginfo/dwarf.c 2005-10-04 16:54:54 UTC (rev 4856=
)
@@ -916,6 +916,12 @@
UChar* end =3D debuginfo + debug_info_sz;
UInt blklen;
=20
+ /* Make sure we at least have a header for the first block */
+ if (debug_info_sz < 4) {
+ ML_(symerr)( "Last block truncated in .debug_info; ignoring" );
+ return;
+ }
+
/* Iterate on all the blocks we find in .debug_info */
for ( block =3D debuginfo; block < end - 4; block +=3D blklen + 4 ) {
=20
Modified: trunk/coregrind/m_debuginfo/symtab.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_debuginfo/symtab.c 2005-10-04 16:45:28 UTC (rev 485=
5)
+++ trunk/coregrind/m_debuginfo/symtab.c 2005-10-04 16:54:54 UTC (rev 485=
6)
@@ -1745,7 +1745,7 @@
stabstr, stabstr_sz );
}
# endif
- if (debug_line) {
+ if (debug_info && debug_abbv && debug_line && debug_str) {
ML_(read_debuginfo_dwarf2) ( si,=20
debug_info, debug_info_sz,
debug_abbv,
|