[Bug sanitizer/95279] UBSan doesn't seem to detect pointer overflow in certain cases

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon May 25 10:36:12 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95279

--- Comment #8 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #4)
> There is nothing wrong on addition of -1, whether signed or cast to
> size_t/uintptr_t, to a pointer,

Looking at the standard (I am not a pro at that), one could easily interpret
that p+(size_t)(-1) means adding a huge number to p, not subtracting 1. It does
not say that the integer is cast to ptrdiff_t or anything like that.


More information about the Gcc-bugs mailing list