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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The problem is that to avoid the segfault, you'd need to significantly slow
down the library code (pretty much, instead of
  if (Prefix->Offset > 0 || !Prefix->TypeInfo)
    // This can't possibly be a valid vtable.
    return 0;
you'd need something like write (dev_null_fd, VtablePrefix, sizeof
(*VtablePrefix)); first and check if it didn't return -1 / EFAULT (because the
library hardly can install segfault handlers).
The library assumes that the virtual table pointers contain either valid, or
previously valid vptrs (or NULL).
So, to get rid of some of the segfaults, but not all, it could e.g. write NULL
to the virtual table pointer at the start of the constructor, before starting
to construct the base classes, or something similar (if -fsanitize=vptr only,
of course).

Reply via email to