diff options
author | Filipe Cabecinhas <me@filcab.net> | 2018-07-16 13:41:54 +0000 |
---|---|---|
committer | Filipe Cabecinhas <me@filcab.net> | 2018-07-16 13:41:54 +0000 |
commit | 3bc3fb477afc2217d1f33f10b914c6e1986c4be7 (patch) | |
tree | ea793fb2d46d138f494593f2052ec7257e75052a /compiler-rt/lib/cfi/cfi.cc | |
parent | 07f6e8e3a5191ae8150ed7530d364326d78f000a (diff) | |
download | bcm5719-llvm-3bc3fb477afc2217d1f33f10b914c6e1986c4be7.tar.gz bcm5719-llvm-3bc3fb477afc2217d1f33f10b914c6e1986c4be7.zip |
[cfi] Don't pass a uint16_t to memset. Make sure the 16-bit constant is appropriate for us.
Reviewers: eugenis, pcc, kcc
Subscribers: delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D49252
llvm-svn: 337170
Diffstat (limited to 'compiler-rt/lib/cfi/cfi.cc')
-rw-r--r-- | compiler-rt/lib/cfi/cfi.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler-rt/lib/cfi/cfi.cc b/compiler-rt/lib/cfi/cfi.cc index 52f504bd281..5ee8365697a 100644 --- a/compiler-rt/lib/cfi/cfi.cc +++ b/compiler-rt/lib/cfi/cfi.cc @@ -132,7 +132,10 @@ void ShadowBuilder::Start() { void ShadowBuilder::AddUnchecked(uptr begin, uptr end) { uint16_t *shadow_begin = MemToShadow(begin, shadow_); uint16_t *shadow_end = MemToShadow(end - 1, shadow_) + 1; - memset(shadow_begin, kUncheckedShadow, + // memset takes a byte, so our unchecked shadow value requires both bytes to + // be the same. Make sure we're ok during compilation. + static_assert(kUncheckedShadow & 0xff == ((kUncheckedShadow >> 8) & 0xff)); + memset(shadow_begin, kUncheckedShadow & 0xff, (shadow_end - shadow_begin) * sizeof(*shadow_begin)); } |