Skip to content

Commit 26f931d

Browse files
committed
Check for overflow in submapBitmapIndexed
Fixes #491.
1 parent 63b310b commit 26f931d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Data/HashMap/Internal.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,6 +1556,12 @@ submapBitmapIndexed comp !b1 !ary1 !b2 !ary2 = subsetBitmaps && go 0 0 (b1Orb2 .
15561556
go !i !j !m
15571557
| m > b1Orb2 = True
15581558

1559+
#if (WORD_SIZE_IN_BITS == 32)
1560+
-- m can overflow to 0 on 32-bit platforms.
1561+
-- See #491.
1562+
| m == 0 = True
1563+
#endif
1564+
15591565
-- In case a key is both in ary1 and ary2, check ary1[i] <= ary2[j] and
15601566
-- increment the indices i and j.
15611567
| b1Andb2 .&. m /= 0 = comp (A.index ary1 i) (A.index ary2 j) &&

0 commit comments

Comments
 (0)