Extend -fsanitize=nullability-arg to handle call sites which accept C++
member function pointers.
rdar://62476022
Paths
| Differential D88336
[ubsan] nullability-arg: Fix crash on C++ member function pointers ClosedPublic Authored by vsk on Sep 25 2020, 1:12 PM.
Details Summary Extend -fsanitize=nullability-arg to handle call sites which accept C++ rdar://62476022
Diff Detail
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
This revision is now accepted and ready to land.Sep 25 2020, 6:18 PM Comment Actions Thanks for the review!
This revision was landed with ongoing or failed builds.Sep 28 2020, 9:42 AM Closed by commit rG06bc685fa240: [ubsan] nullability-arg: Fix crash on C++ member pointers (authored by vsk). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 294733 clang/lib/CodeGen/CGCall.cpp
clang/lib/CodeGen/CGExpr.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/test/CodeGenCXX/ubsan-nullability-arg.cpp
|
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?