Allow to call strchr() from __asan_init().

Fixes PR13794.

llvm-svn: 163493
This commit is contained in:
Alexander Potapenko 2012-09-10 08:35:12 +00:00
parent 464a7f7e89
commit 67192d41ee
1 changed files with 5 additions and 0 deletions

View File

@ -271,6 +271,11 @@ INTERCEPTOR(char*, strchr, const char *str, int c) {
#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) {