Allow to call strchr() from __asan_init().
Fixes PR13794.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@163493 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/asan/asan_interceptors.cc b/lib/asan/asan_interceptors.cc
index db0e00b..900bf5a 100644
--- a/lib/asan/asan_interceptors.cc
+++ b/lib/asan/asan_interceptors.cc
@@ -271,6 +271,11 @@
 #if MAC_INTERPOSE_FUNCTIONS
   if (!asan_inited) return REAL(strchr)(str, c);
 #endif
+  // strchr is called inside create_purgeable_zone() when MallocGuardEdges=1 is
+  // used.
+  if (asan_init_is_running) {
+    return REAL(strchr)(str, c);
+  }
   ENSURE_ASAN_INITED();
   char *result = REAL(strchr)(str, c);
   if (flags()->replace_str) {