[PATCH] [RFC] Sanitize upcasts and conversion to virtual base

Alexey Samsonov vonosmas at gmail.com
Mon Oct 6 17:47:12 PDT 2014


Hi rsmith,

This change adds UBSan check to upcasts. Namely, when we
perform derived-to-base conversion, we:
1) check that the pointer-to-derived has suitable alignment and underlying
   storage, if this pointer is non-null.
2) if vptr-sanitizer is enabled, and we perform conversion to virtual base,
   we check that pointer-to-derived has a matching vptr.

For now, this change lacks UBSan output tests in compiler-rt, I'm sending
it as an RFC to check that I'm doing the correct thing, and to agree
on error messages and enums wordings.

http://reviews.llvm.org/D5635

Files:
  projects/compiler-rt/lib/ubsan/ubsan_handlers.cc
  tools/clang/lib/CodeGen/CGClass.cpp
  tools/clang/lib/CodeGen/CGExpr.cpp
  tools/clang/lib/CodeGen/CGExprScalar.cpp
  tools/clang/lib/CodeGen/CodeGenFunction.h
  tools/clang/test/CodeGenCXX/catch-undef-behavior.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5635.14480.patch
Type: text/x-patch
Size: 9711 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141007/f1c855c5/attachment.bin>


More information about the cfe-commits mailing list