[llvm-commits] [compiler-rt] r150499 - in /compiler-rt/trunk/lib/asan: asan_interceptors.cc asan_interceptors.h asan_rtl.cc
Timur Iskhodzhanov
timurrrr at google.com
Tue Feb 14 11:33:04 PST 2012
Author: timurrrr
Date: Tue Feb 14 13:33:04 2012
New Revision: 150499
URL: http://llvm.org/viewvc/llvm-project?rev=150499&view=rev
Log:
[ASan] Define an internal implementation of strchr to make stack OOB tests pass on Windows
Modified:
compiler-rt/trunk/lib/asan/asan_interceptors.cc
compiler-rt/trunk/lib/asan/asan_interceptors.h
compiler-rt/trunk/lib/asan/asan_rtl.cc
Modified: compiler-rt/trunk/lib/asan/asan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interceptors.cc?rev=150499&r1=150498&r2=150499&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_interceptors.cc Tue Feb 14 13:33:04 2012
@@ -120,6 +120,16 @@
return i;
}
+char* internal_strchr(const char *s, int c) {
+ while (true) {
+ if (*s == (char)c)
+ return (char*)s;
+ if (*s == 0)
+ return NULL;
+ s++;
+ }
+}
+
void* internal_memchr(const void* s, int c, size_t n) {
const char* t = (char*)s;
for (size_t i = 0; i < n; ++i, ++t)
Modified: compiler-rt/trunk/lib/asan/asan_interceptors.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interceptors.h?rev=150499&r1=150498&r2=150499&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_interceptors.h (original)
+++ compiler-rt/trunk/lib/asan/asan_interceptors.h Tue Feb 14 13:33:04 2012
@@ -33,6 +33,7 @@
// __asan::internal_X() is the implementation of X() for use in RTL.
size_t internal_strlen(const char *s);
size_t internal_strnlen(const char *s, size_t maxlen);
+char* internal_strchr(const char *s, int c);
void* internal_memchr(const void* s, int c, size_t n);
int internal_memcmp(const void* s1, const void* s2, size_t n);
char *internal_strstr(const char *haystack, const char *needle);
Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=150499&r1=150498&r2=150499&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Tue Feb 14 13:33:04 2012
@@ -159,7 +159,7 @@
// where alloc_i looks like "offset size len ObjectName ".
CHECK(frame_descr);
// Report the function name and the offset.
- const char *name_end = REAL(strchr)(frame_descr, ' ');
+ const char *name_end = internal_strchr(frame_descr, ' ');
CHECK(name_end);
buf[0] = 0;
internal_strncat(buf, frame_descr,
More information about the llvm-commits
mailing list