diff options
author | Kostya Serebryany <kcc@google.com> | 2013-01-25 11:46:22 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2013-01-25 11:46:22 +0000 |
commit | fa79cd65e2a08979c0d76b6f0dec6192161e5611 (patch) | |
tree | 751e282870a97e182c8979a0455b6008e59cf003 /compiler-rt/lib/asan/asan_allocator2.cc | |
parent | 4899fb5cfba666ebfe88c5b817f3b4436f108b25 (diff) | |
download | bcm5719-llvm-fa79cd65e2a08979c0d76b6f0dec6192161e5611.tar.gz bcm5719-llvm-fa79cd65e2a08979c0d76b6f0dec6192161e5611.zip |
[sanitizer] fix calloc overflow in asan/tsan/msan
llvm-svn: 173441
Diffstat (limited to 'compiler-rt/lib/asan/asan_allocator2.cc')
-rw-r--r-- | compiler-rt/lib/asan/asan_allocator2.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler-rt/lib/asan/asan_allocator2.cc b/compiler-rt/lib/asan/asan_allocator2.cc index 7bfa5fd24b2..184627a586a 100644 --- a/compiler-rt/lib/asan/asan_allocator2.cc +++ b/compiler-rt/lib/asan/asan_allocator2.cc @@ -607,6 +607,7 @@ void *asan_malloc(uptr size, StackTrace *stack) { } void *asan_calloc(uptr nmemb, uptr size, StackTrace *stack) { + if (CallocShouldReturnNullDueToOverflow(size, nmemb)) return 0; void *ptr = Allocate(nmemb * size, 8, stack, FROM_MALLOC); if (ptr) REAL(memset)(ptr, 0, nmemb * size); |