|
From: <sv...@va...> - 2013-04-11 17:55:50
|
mjw 2013-04-11 18:55:39 +0100 (Thu, 11 Apr 2013)
New Revision: 13367
Log:
read_unitinfo_dwarf2 DW_FORM_ref_addr is address size in DWARF version 2.
Bug #305513 contained a patch for some extra robustness checks. But
the real cause of crashing in the read_unitinfo_dwarf2 DWARF reader
seemed to have been this issue where DWARF version 2 DWZ partial_units
were read and DW_FORM_ref_addr had an unexpected size. This combination
is rare. DWARF version 4 is the current default version of GCC.
Modified files:
trunk/coregrind/m_debuginfo/readdwarf.c
Modified: trunk/coregrind/m_debuginfo/readdwarf.c (+3 -3)
===================================================================
--- trunk/coregrind/m_debuginfo/readdwarf.c 2013-04-11 17:17:45 +01:00 (rev 13366)
+++ trunk/coregrind/m_debuginfo/readdwarf.c 2013-04-11 18:55:39 +01:00 (rev 13367)
@@ -991,7 +991,7 @@
UInt acode, abcode;
ULong atoffs, blklen;
Int level;
- /* UShort ver; */
+ UShort ver;
UChar addr_size;
UChar* p = unitblock_img;
@@ -1008,7 +1008,7 @@
p += ui->dw64 ? 12 : 4;
/* version should be 2, 3 or 4 */
- /* ver = ML_(read_UShort)(p); */
+ ver = ML_(read_UShort)(p);
p += 2;
/* get offset in abbrev */
@@ -1122,7 +1122,7 @@
case 0x0c: /* FORM_flag */ p++; break;
case 0x0d: /* FORM_sdata */ read_leb128S( &p ); break;
case 0x0f: /* FORM_udata */ read_leb128U( &p ); break;
- case 0x10: /* FORM_ref_addr */ p += ui->dw64 ? 8 : 4; break;
+ case 0x10: /* FORM_ref_addr */ p += (ver == 2) ? addr_size : (ui->dw64 ? 8 : 4); break;
case 0x11: /* FORM_ref1 */ p++; break;
case 0x12: /* FORM_ref2 */ p += 2; break;
case 0x13: /* FORM_ref4 */ p += 4; break;
|