[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:33:16 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87191
--- Comment #6 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'
How i canl all fix it?
More information about the Gcc-bugs
mailing list