This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Sat, Dec 13, 2014 at 02:36:08PM -0800, Josh Stone wrote: > On 12/12/2014 07:54 AM, Mark Wielaard wrote: > > @@ -513,6 +515,7 @@ __libdw_form_val_len (Dwarf *dbg, struct Dwarf_CU *cu, > > uint8_t len = form_lengths[form]; > > if (len != 0) > > { > > + const const unsigned char *endp = cu->endp; > > len &= 0x7f; /* Mask to allow 0x80 -> 0. */ > > if (unlikely (len > (size_t) (endp - valp))) > > { > > "const const", for when you're *really* sure it won't ever change! :) Removed the extra const. I also made two additional changes to harden the code a bit more when using "fake" cus. The fake empty cu isn't associated with a DWARF dbg, which isn't a problem because it is empty, so attributes pointing to it won't use it to resolve anything. But we might refer to it when interning the block Dwarf_Ops. Since the block is empty no ops need to be interned anyway. So short-circuit that path. Also in dwarf_formref_die we would refer to the data buffer of the form with cu_data (). But that might be the wrong buffer. Use the cu startp and endp directly and remove cu_data () completely to prevent any future mistake like that. I haven't actually found any such a case, because none of the attributes associated with the fake CUs use DW_FORM_addr. So that is just a "future hardening" change. Update patch attached. Cheers, Mark
Attachment:
0001-libdw-Make-sure-all-attributes-come-with-a-fake-CU-f.patch
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |