From 6893eae70aea6f7c6762c9bea8c4cc9a81a7b71f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Ch=C3=A9ron?= Date: Sat, 4 May 2019 15:06:07 +0200 Subject: [PATCH] Make os2ip loop argument strict --- Crypto/Number/Serialize/Internal.hs | 2 +- Crypto/Number/Serialize/Internal/LE.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Crypto/Number/Serialize/Internal.hs b/Crypto/Number/Serialize/Internal.hs index b691edf..bfa9622 100644 --- a/Crypto/Number/Serialize/Internal.hs +++ b/Crypto/Number/Serialize/Internal.hs @@ -69,7 +69,7 @@ os2ip ptr ptrSz | otherwise = gmpImportInteger ptrSz ptr `onGmpUnsupported` loop 0 0 ptr where loop :: Integer -> Int -> Ptr Word8 -> IO Integer - loop !acc i p + loop !acc i !p | i == ptrSz = return acc | otherwise = do w <- peekByteOff p i :: IO Word8 diff --git a/Crypto/Number/Serialize/Internal/LE.hs b/Crypto/Number/Serialize/Internal/LE.hs index 52c5658..473d1de 100644 --- a/Crypto/Number/Serialize/Internal/LE.hs +++ b/Crypto/Number/Serialize/Internal/LE.hs @@ -68,7 +68,7 @@ os2ip ptr ptrSz | otherwise = gmpImportIntegerLE ptrSz ptr `onGmpUnsupported` loop 0 (ptrSz-1) ptr where loop :: Integer -> Int -> Ptr Word8 -> IO Integer - loop !acc i p + loop !acc i !p | i < 0 = return acc | otherwise = do w <- peekByteOff p i :: IO Word8