[llvm-commits] [compiler-rt] PATCH: asan_interceptors.cc: strncmp does not call ENSURE_ASAN_INITED();
Nick Kralevich
nnk at google.com
Thu Jul 26 13:57:55 PDT 2012
I filed http://code.google.com/p/address-sanitizer/issues/detail?id=94,
but I was told that this mailing list is a better place to submit
patches.
If ASAN's strncmp function is called early enough in a program's
lifecycle, ASAN will segfault. This is due to ASAN's strncmp not
calling ENSURE_ASAN_INITED(). More details are in the bug above.
A 1 line patch is attached which resolves this issue.
A similar bug is present in ASAN's strcmp function. It too does not
call ENSURE_ASAN_INITED(). It's not clear to me whether this is
intentional or not.
-- Nick
-------------- next part --------------
Index: asan_interceptors.cc
===================================================================
--- asan_interceptors.cc (revision 160797)
+++ asan_interceptors.cc (working copy)
@@ -494,6 +494,7 @@
if (asan_init_is_running) {
return REAL(strncmp)(s1, s2, size);
}
+ ENSURE_ASAN_INITED();
unsigned char c1 = 0, c2 = 0;
uptr i;
for (i = 0; i < size; i++) {
More information about the llvm-commits
mailing list