[compiler-rt] r204925 - Add support for _expand[_dbg] so we don't crash when _aligned_* allocation functions are used
Timur Iskhodzhanov
timurrrr at google.com
Thu Mar 27 07:01:11 PDT 2014
Author: timurrrr
Date: Thu Mar 27 09:01:11 2014
New Revision: 204925
URL: http://llvm.org/viewvc/llvm-project?rev=204925&view=rev
Log:
Add support for _expand[_dbg] so we don't crash when _aligned_* allocation functions are used
Modified:
compiler-rt/trunk/lib/asan/asan_dll_thunk.cc
compiler-rt/trunk/lib/asan/asan_malloc_win.cc
Modified: compiler-rt/trunk/lib/asan/asan_dll_thunk.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_dll_thunk.cc?rev=204925&r1=204924&r2=204925&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_dll_thunk.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_dll_thunk.cc Thu Mar 27 09:01:11 2014
@@ -201,6 +201,11 @@ WRAP_W_WWW(_realloc_dbg)
WRAP_W_WWW(_recalloc)
WRAP_W_W(_msize)
+WRAP_W_W(_expand)
+WRAP_W_W(_expand_dbg)
+
+// TODO(timurrrr): Might want to add support for _aligned_* allocation
+// functions to detect a bit more bugs. Those functions seem to wrap malloc().
// TODO(timurrrr): Do we need to add _Crt* stuff here? (see asan_malloc_win.cc).
Modified: compiler-rt/trunk/lib/asan/asan_malloc_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_malloc_win.cc?rev=204925&r1=204924&r2=204925&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_malloc_win.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_malloc_win.cc Thu Mar 27 09:01:11 2014
@@ -103,6 +103,21 @@ size_t _msize(void *ptr) {
return asan_malloc_usable_size(ptr, pc, bp);
}
+SANITIZER_INTERFACE_ATTRIBUTE
+void *_expand(void *memblock, size_t size) {
+ // _expand is used in realloc-like functions to resize the buffer if possible.
+ // We don't want memory to stand still while resizing buffers, so return 0.
+ return 0;
+}
+
+SANITIZER_INTERFACE_ATTRIBUTE
+void *_expand_dbg(void *memblock, size_t size) {
+ return 0;
+}
+
+// TODO(timurrrr): Might want to add support for _aligned_* allocation
+// functions to detect a bit more bugs. Those functions seem to wrap malloc().
+
int _CrtDbgReport(int, const char*, int,
const char*, const char*, ...) {
ShowStatsAndAbort();
More information about the llvm-commits
mailing list