[PATCH] D49252: [cfi] Don't pass a uint16_t to memset. Make sure the 16-bit constant is appropriate for us.
Filipe Cabecinhas via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 16 06:47:09 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL337170: [cfi] Don't pass a uint16_t to memset. Make sure the 16-bit constant is… (authored by filcab, committed by ).
Repository:
rL LLVM
https://reviews.llvm.org/D49252
Files:
compiler-rt/trunk/lib/cfi/cfi.cc
Index: compiler-rt/trunk/lib/cfi/cfi.cc
===================================================================
--- compiler-rt/trunk/lib/cfi/cfi.cc
+++ compiler-rt/trunk/lib/cfi/cfi.cc
@@ -132,7 +132,10 @@
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));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49252.155669.patch
Type: text/x-patch
Size: 756 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180716/095c64da/attachment.bin>
More information about the llvm-commits
mailing list