Skip to content

Commit 0618f4b

Browse files
committed
Merge pull request #38 from mainland/master
Fix overflow check.
2 parents 5f44b58 + b8bfd93 commit 0618f4b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Data/Vector/Fusion/Bundle/Size.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ instance Num Size where
5151
{-# INLINE checkedAdd #-}
5252
checkedAdd :: (Int -> Size) -> Int -> Int -> Size
5353
checkedAdd con m n
54-
| r <= m =
54+
-- Note: we assume m and n are >= 0.
55+
| r < m || r < n =
5556
error $ "Data.Vector.Fusion.Bundle.Size.checkedAdd: overflow: " ++ show r
5657
| otherwise = con r
5758
where

0 commit comments

Comments
 (0)