[PATCH] D19607: [sanitizer] Add early call handling to strchr + strrchr interceptors
Derek Bruening via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 27 11:41:03 PDT 2016
bruening created this revision.
bruening added a reviewer: vitalybuka.
bruening added subscribers: aizatsky, zhaoqin, kcc, eugenis, llvm-commits.
Herald added a subscriber: kubabrecka.
The strchr and strrchr interceptors are sometimes invoked too early for
their REAL() counterparts to be initialized. A special check is added to
use internal_ routines for this situation.
http://reviews.llvm.org/D19607
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
@@ -401,6 +401,8 @@
#if SANITIZER_INTERCEPT_STRCHR
INTERCEPTOR(char*, strchr, const char *s, int c) {
void *ctx;
+ if (COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED)
+ return internal_strchr(s, c);
COMMON_INTERCEPTOR_ENTER(ctx, strchr, s, c);
char *result = REAL(strchr)(s, c);
uptr len = internal_strlen(s);
@@ -432,6 +434,8 @@
#if SANITIZER_INTERCEPT_STRRCHR
INTERCEPTOR(char*, strrchr, const char *s, int c) {
void *ctx;
+ if (COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED)
+ return internal_strrchr(s, c);
COMMON_INTERCEPTOR_ENTER(ctx, strrchr, s, c);
uptr len = internal_strlen(s);
if (common_flags()->intercept_strchr)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19607.55270.patch
Type: text/x-patch
Size: 901 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160427/81ffe276/attachment.bin>
More information about the llvm-commits
mailing list