[llvm-commits] [compiler-rt] r157048 - /compiler-rt/trunk/lib/tsan/rtl/tsan_mman.cc
Dmitry Vyukov
dvyukov at google.com
Fri May 18 02:41:52 PDT 2012
Author: dvyukov
Date: Fri May 18 04:41:52 2012
New Revision: 157048
URL: http://llvm.org/viewvc/llvm-project?rev=157048&view=rev
Log:
tsan: check for overflow in malloc()
Modified:
compiler-rt/trunk/lib/tsan/rtl/tsan_mman.cc
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_mman.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_mman.cc?rev=157048&r1=157047&r2=157048&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_mman.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_mman.cc Fri May 18 04:41:52 2012
@@ -30,6 +30,8 @@
void *user_alloc(ThreadState *thr, uptr pc, uptr sz) {
CHECK_GT(thr->in_rtl, 0);
+ if (sz + sizeof(MBlock) < sz)
+ return 0;
MBlock *b = (MBlock*)Alloc(sz + sizeof(MBlock));
b->size = sz;
void *p = b + 1;
More information about the llvm-commits
mailing list