[Bug sanitizer/103730] ubsan: store with insufficient space for an object of type

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Dec 15 09:56:06 GMT 2021


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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
What do you find wrong about it?
((logger_msginfo *) & logger)->Fn
where logger is a pointer and logger_msginfo is a 2 * sizeof (void*) sized
struct  does reference the pointer after the logger variable.  It is a clear
UB.
While ((logger_msginfo *) & logger[0])->Fn is dereferencing that pointer and
then taking address, so effectively ((logger_msginfo *) logger)->Fn or
logger->Fn.


More information about the Gcc-bugs mailing list