[PATCH] [UBsan] Skip -fsanitize=vptr instrumentations when the pointer value is null

Richard Smith richard at metafoo.co.uk
Mon Jul 14 18:25:38 PDT 2014


Please provide a test.

================
Comment at: lib/CodeGen/CGExpr.cpp:553-554
@@ +552,4 @@
+
+      // Skip Vptr checks when the pointer value is null. This is redundant if
+      // -fsanitize=null is used.
+      // FIXME: Add optional flags.
----------------
Nit: lowercase 'v'.

It'd be nice to expand on this a bit: a null pointer here is undefined behavior, but if -fsanitize=null is not enabled, we don't want to change the behavior of code in that case, so that the user doesn't have to fix all their null pointer bugs before they can find their type mismatch bugs (which are likely to be more serious).

http://reviews.llvm.org/D4412






More information about the cfe-commits mailing list