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]

Re: eu-strip --reloc-debug-sections


> On Tue, 2011-05-24 at 11:40 -0700, Roland McGrath wrote:
> > > +		    if (offset + size > tdata->d_size)
> > > +		      error (0, 0, gettext ("bad relocation"));
> > 
> > It's the style of the robustify branch, and IMHO might as well do it to
> > start with in the new code, to do these checks in overflow-proof ways.
> 
> Do you mean adding something like:
> 
>     if (offset + size > tdata->d_size
>         || offset > ((GElf_Addr) -1) - size)
> 
> Or is there a more natural way to check unsigned overflow in these
> cases?

offset > tdata->d_size || tdata->d_size - offset < size

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]