on master help sign in
Perform safe deserialization of list length
commitfaf50b6be1957843b646d8473f5752d3e3b74d71 authorHarendra Kumar <harendra@composewell.com> dateTue 22 Aug 2023, 20:25 (3 years ago) parent3e93e22
1 file changed+1−2
core/src/Streamly/Internal/Data/Serialize.hs+1−2
core/src/Streamly/Internal/Data/Serialize.hs+1−2
@@ -215,8 +215,7 @@ instance forall a. Serialize a => Serialize [a] where
215215 -- Inlining this causes large compilation times for tests
216216 {-# INLINABLE deserialize #-}
217217 deserialize off arr sz = do
218− len <- Unbox.peekByteIndex off arr :: IO Int
219− let off1 = off + Unbox.sizeOf (Proxy :: Proxy Int)
218+ (off1, len) <- deserialize off arr sz :: IO (Int, Int)
220219 let
221220 peekList f o i | i >= 3 = do
222221 -- Unfold the loop three times