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