From b73838d55ad6824bb055971ee57d3db186fb6caf Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Thu, 28 Jan 2016 00:37:54 +0000 Subject: [cfi] Fix recovery from out-of-bounds vtable error. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@259007 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/cfi/cross-dso/target_out_of_bounds.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'test/cfi') diff --git a/test/cfi/cross-dso/target_out_of_bounds.cpp b/test/cfi/cross-dso/target_out_of_bounds.cpp index b7449c942..fbd664bce 100644 --- a/test/cfi/cross-dso/target_out_of_bounds.cpp +++ b/test/cfi/cross-dso/target_out_of_bounds.cpp @@ -20,9 +20,13 @@ int main(int argc, char *argv[]) { // enough to handle unaddressable vtables. TODO: fix this. void *empty = calloc(1, 128); uintptr_t v = (uintptr_t)empty + 64; - A *volatile p = new A(); - for (uintptr_t *q = (uintptr_t *)p; q < (uintptr_t *)(p + 1); ++q) + char *volatile p = reinterpret_cast(new A()); + for (uintptr_t *q = (uintptr_t *)p; q < (uintptr_t *)(p + sizeof(A)); ++q) *q = v; + + // CHECK: runtime error: control flow integrity check for type 'A' failed during cast + A *volatile pa = reinterpret_cast(p); + // CHECK: untime error: control flow integrity check for type 'A' failed during virtual call - p->f(); + pa->f(); } -- cgit v1.2.3