[compiler-rt] r349645 - [sanitizer_common] Fix sha2 interceptors not to use vars in array len
Michal Gorny via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 19 09:22:15 PST 2018
Author: mgorny
Date: Wed Dec 19 09:22:14 2018
New Revision: 349645
URL: http://llvm.org/viewvc/llvm-project?rev=349645&view=rev
Log:
[sanitizer_common] Fix sha2 interceptors not to use vars in array len
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.
Differential Revision: https://reviews.llvm.org/D55811
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc?rev=349645&r1=349644&r2=349645&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc Wed Dec 19 09:22:14 2018
@@ -8511,9 +8511,10 @@ INTERCEPTOR(char *, MD2Data, const unsig
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); \
More information about the llvm-commits
mailing list