Fix an arithmetic overflow bug causing crashes with multi-GB heaps
authorSimon Marlow <marlowsd@gmail.com>
Thu, 24 Jun 2010 10:46:54 +0000 (10:46 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Thu, 24 Jun 2010 10:46:54 +0000 (10:46 +0000)
rts/sm/BlockAlloc.c

index 68c3330..9d92c6b 100644 (file)
@@ -283,7 +283,7 @@ alloc_mega_group (nat mblocks)
     if (best)
     {
         // we take our chunk off the end here.
-        nat best_mblocks  = BLOCKS_TO_MBLOCKS(best->blocks);
+        StgWord best_mblocks  = BLOCKS_TO_MBLOCKS(best->blocks);
         bd = FIRST_BDESCR((StgWord8*)MBLOCK_ROUND_DOWN(best) + 
                           (best_mblocks-mblocks)*MBLOCK_SIZE);