Extend -fsanitize=nullability-arg to handle call sites which accept C++
member function pointers.
rdar://62476022
Differential D88336
[ubsan] nullability-arg: Fix crash on C++ member function pointers vsk on Sep 25 2020, 1:12 PM. Authored by
Details Extend -fsanitize=nullability-arg to handle call sites which accept C++ rdar://62476022
Diff Detail
Unit Tests Event TimelineComment Actions It looks like this still doesn't check null correctly (i.e., compare to -1) for data member pointers. Is that correct?
Comment Actions Thanks for catching this. The new revision takes advantage of CXXABI::EmitMemberPointerIsNotNull, so null data member pointers are now diagnosed. Comment Actions LGTM
Comment Actions Thanks for the review!
|
I think it's better to make it clear in the comment that we are checking for pointers to member function, not pointers to data members.
Also, I wonder whether there is a better way to do this only for Itanium ABI. Maybe just check ArgType->isMemberFunctionPointerType() and add a virtual function to CGCXXABI which extracts the pointer field and call it here?