summaryrefslogtreecommitdiff
path: root/lib/ubsan/ubsan_type_hash_itanium.cc
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2015-08-14 22:40:35 +0000
committerHans Wennborg <hans@hanshq.net>2015-08-14 22:40:35 +0000
commitb5214093d4c91ed5352d35ee9126665fabfa97fe (patch)
tree69ee72f2662dfb56a4ce405021fb1cf8c43af45d /lib/ubsan/ubsan_type_hash_itanium.cc
parent25ac0b1c40702c8e8112de2bb41c46fd29eb2711 (diff)
downloadcompiler-rt-b5214093d4c91ed5352d35ee9126665fabfa97fe.tar.gz
Merging r244101:release_37
------------------------------------------------------------------------ r244101 | samsonov | 2015-08-05 12:35:46 -0700 (Wed, 05 Aug 2015) | 6 lines [UBSan] Fix UBSan-vptr false positive. Offset from vptr to the start of most-derived object can actually be positive in some virtual base class vtables. Patch by Stephan Bergmann! ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/branches/release_37@245114 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ubsan/ubsan_type_hash_itanium.cc')
-rw-r--r--lib/ubsan/ubsan_type_hash_itanium.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/ubsan/ubsan_type_hash_itanium.cc b/lib/ubsan/ubsan_type_hash_itanium.cc
index 5cd46df16..b84e88d4c 100644
--- a/lib/ubsan/ubsan_type_hash_itanium.cc
+++ b/lib/ubsan/ubsan_type_hash_itanium.cc
@@ -185,8 +185,8 @@ namespace {
struct VtablePrefix {
/// The offset from the vptr to the start of the most-derived object.
- /// This should never be greater than zero, and will usually be exactly
- /// zero.
+ /// This will only be greater than zero in some virtual base class vtables
+ /// used during object con-/destruction, and will usually be exactly zero.
sptr Offset;
/// The type_info object describing the most-derived class type.
std::type_info *TypeInfo;
@@ -196,7 +196,7 @@ VtablePrefix *getVtablePrefix(void *Vtable) {
if (!Vptr)
return 0;
VtablePrefix *Prefix = Vptr - 1;
- if (Prefix->Offset > 0 || !Prefix->TypeInfo)
+ if (!Prefix->TypeInfo)
// This can't possibly be a valid vtable.
return 0;
return Prefix;