[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
Thu Jul 12 10:12:19 PDT 2018
filcab created this revision.
filcab added reviewers: eugenis, pcc, kcc.
Herald added subscribers: Sanitizers, delcypher.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D49252
Files:
lib/cfi/cfi.cc
Index: lib/cfi/cfi.cc
===================================================================
--- lib/cfi/cfi.cc
+++ 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.155209.patch
Type: text/x-patch
Size: 702 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180712/eca6735c/attachment.bin>
More information about the llvm-commits
mailing list