diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-02-23 02:40:07 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-02-23 02:40:07 +0000 |
commit | a0b1e21d72429c3672115b3ddc85240e3b7ac88b (patch) | |
tree | 6338b8f9aedaa5fb6277297a3744cdbc050bc2ae /lib/ubsan/ubsan_handlers.cc | |
parent | 0b487c02ed906e555fa473cea5afcd6363549373 (diff) |
ubsan: Runtime handlers for array indexing checks.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@175948 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ubsan/ubsan_handlers.cc')
-rw-r--r-- | lib/ubsan/ubsan_handlers.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/ubsan/ubsan_handlers.cc b/lib/ubsan/ubsan_handlers.cc index 33e044dfe..fa93b095d 100644 --- a/lib/ubsan/ubsan_handlers.cc +++ b/lib/ubsan/ubsan_handlers.cc @@ -183,6 +183,22 @@ void __ubsan::__ubsan_handle_shift_out_of_bounds_abort( Die(); } +void __ubsan::__ubsan_handle_out_of_bounds(OutOfBoundsData *Data, + ValueHandle Index) { + SourceLocation Loc = Data->Loc.acquire(); + if (Loc.isDisabled()) + return; + + Value IndexVal(Data->IndexType, Index); + Diag(Loc, DL_Error, "index %0 out of bounds for type %1") + << IndexVal << Data->ArrayType; +} +void __ubsan::__ubsan_handle_out_of_bounds_abort(OutOfBoundsData *Data, + ValueHandle Index) { + __ubsan_handle_out_of_bounds(Data, Index); + Die(); +} + void __ubsan::__ubsan_handle_builtin_unreachable(UnreachableData *Data) { Diag(Data->Loc, DL_Error, "execution reached a __builtin_unreachable() call"); Die(); |