[PATCH] D21310: [asan] Fix an overflow with an Allocator constant

Wang Wei via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 13 14:18:58 PDT 2016


wang0109 created this revision.
wang0109 added reviewers: etienneb, rnk.
wang0109 added a subscriber: llvm-commits.
Herald added a subscriber: kubabrecka.

In asan on Windows 64-bit, this is one of the broken things
that makes allocation fail. "UL" is 32-bit and shift by 40 will make
the value overflow and become 0.

http://reviews.llvm.org/D21310

Files:
  lib/asan/asan_allocator.cc

Index: lib/asan/asan_allocator.cc
===================================================================
--- lib/asan/asan_allocator.cc
+++ lib/asan/asan_allocator.cc
@@ -223,7 +223,7 @@
 
 struct Allocator {
   static const uptr kMaxAllowedMallocSize =
-      FIRST_32_SECOND_64(3UL << 30, 1UL << 40);
+      FIRST_32_SECOND_64(3UL << 30, 1ULL << 40);
   static const uptr kMaxThreadLocalQuarantine =
       FIRST_32_SECOND_64(1 << 18, 1 << 20);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21310.60608.patch
Type: text/x-patch
Size: 446 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160613/322d881e/attachment.bin>


More information about the llvm-commits mailing list