Insert a type check before reading vtable.
authorIvan Krasin <krasin@chromium.org>
Thu, 17 Nov 2016 00:39:48 +0000 (00:39 +0000)
committerIvan Krasin <krasin@chromium.org>
Thu, 17 Nov 2016 00:39:48 +0000 (00:39 +0000)
commitd98f5d78cbe1f5f83833e95d7dea663b9ab69e4b
treed1acc32d5613fd2d235b086af27ff6757d6ffdd7
parent48c26b2b1297c1b2e2e1cd67e50c016c652c6c60
Insert a type check before reading vtable.

Summary:
this is to prevent a situation when a pointer is invalid or null,
but we get to reading from vtable before we can check that
(possibly causing a segfault without a good diagnostics).

Reviewers: pcc

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26559

llvm-svn: 287181
clang/lib/CodeGen/CGExprCXX.cpp
clang/test/CodeGenCXX/ubsan-vtable-checks.cpp [new file with mode: 0644]