[PATCH] D35735: [ubsan] Null-check pointers in -fsanitize=vptr (PR33881)

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 24 06:14:55 PDT 2017


arphaman accepted this revision.
arphaman added a comment.
This revision is now accepted and ready to land.

LGTM!



================
Comment at: test/CodeGenCXX/ubsan-devirtualized-calls.cpp:67
   static_cast<Base1 *>(badp)->f1(); //< No devirt, test 'badp isa Base1'.
+  // We were able to skip the null check on the first type check becuase 'p'
+  // is backed by an alloca. We can't skip the second null check because 'badp'
----------------
NIT: because


================
Comment at: test/CodeGenCXX/ubsan-type-checks.cpp:5
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin10 -emit-llvm -o - %s -fsanitize=null,vptr | FileCheck %s -check-prefixes=VPTR
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin10 -emit-llvm -o - %s -fsanitize=vptr | FileCheck %s -check-prefixes=NOVPTR
 
----------------
You might want to check that the vptr type check is still emitted without -fsanitize=null when `PtrToAlloca` is true, because it doesn't look that scenario is tested.


https://reviews.llvm.org/D35735





More information about the cfe-commits mailing list