[PATCH] D55811: [compiler-rt] [sanitizer_common] Fix sha2 interceptors not to use vars in array len
Michał Górny via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 18 00:30:15 PST 2018
mgorny created this revision.
mgorny added reviewers: krytarowski, vitalybuka.
Herald added subscribers: Sanitizers, llvm-commits, dberris, kubamracek.
Fix the sha2 interceptor macros to use a constant for array parameter
length rather than referencing the extern variable. Since the digest
length is provided in hash name, reuse the macro parameter for it.
Verify that the calculated value matches the one provided by system
headers.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D55811
Files:
lib/sanitizer_common/sanitizer_common_interceptors.inc
Index: lib/sanitizer_common/sanitizer_common_interceptors.inc
===================================================================
--- lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -8435,9 +8435,10 @@
if (context) \
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, context, SHA##LEN##_CTX_sz); \
} \
- INTERCEPTOR(void, SHA##LEN##_Final, u8 digest[SHA##LEN##_digest_length], \
+ INTERCEPTOR(void, SHA##LEN##_Final, u8 digest[LEN/8], \
void *context) { \
void *ctx; \
+ CHECK_EQ(SHA##LEN##_digest_length, LEN/8); \
COMMON_INTERCEPTOR_ENTER(ctx, SHA##LEN##_Final, digest, context); \
if (context) \
COMMON_INTERCEPTOR_READ_RANGE(ctx, context, SHA##LEN##_CTX_sz); \
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55811.178608.patch
Type: text/x-patch
Size: 765 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181218/4b1a2ed8/attachment.bin>
More information about the cfe-commits
mailing list