[Bug sanitizer/87191] UBSan doesn't catch invalid pointer arithmetic outside known object bounds

Dmitriy.Poterukha at uvoteam dot com gcc-bugzilla@gcc.gnu.org
Thu Oct 6 12:32:30 GMT 2022


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

creeon <Dmitriy.Poterukha at uvoteam dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Dmitriy.Poterukha at uvoteam dot c
                   |                            |om

--- Comment #5 from creeon <Dmitriy.Poterukha at uvoteam dot com> ---
#0 0x401191 in bar (/home/marxin/Programming/testcases/a.out+0x401191)
    #1 0x40122a in main https://stemhave.com/programming-help.html
(/home/marxin/Programming/testcases/a.out+0x40122a)
    #2 0x7ffff6c71fea in __libc_start_main ../csu/libc-start.c:308
    #3 0x4010a9 in _start (/home/marxin/Programming/testcases/a.out+0x4010a9)

At a minimum we should diagnose if offsetting a pointer to a toplevel object
not by 0/1 (ideally also if not by 0 and then dereferencing?), e.g.:

warning: creating out-of-bounds pointer based on complete object 'a'


More information about the Gcc-bugs mailing list