[Bug sanitizer/95279] UBSan doesn't seem to detect pointer overflow in certain cases
joseph at codesourcery dot com
gcc-bugzilla@gcc.gnu.org
Wed Jun 3 21:37:12 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95279
--- Comment #16 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
On Wed, 3 Jun 2020, pinskia at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95279
>
> --- Comment #15 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
> (In reply to joseph@codesourcery.com from comment #14)
> > I think it's invalid to refer to element (size_t)-1 of an array; that the
> > actual integer value used has to be within the range of available array
> > elements.
>
> But this case is:
> (array + 1) + (size_t)-1
>
> That is the question there.
That doesn't make any difference. A reference to positive index n,
regardless of where the pointer points within the underlying object, isn't
valid unless all indexes 0, 1, 2, ..., n are valid.
More information about the Gcc-bugs
mailing list