diff --git a/vector/src/Data/Vector.hs b/vector/src/Data/Vector.hs index 731494a3..ff2c2989 100644 --- a/vector/src/Data/Vector.hs +++ b/vector/src/Data/Vector.hs @@ -2119,7 +2119,11 @@ fromList :: [a] -> Vector a {-# INLINE fromList #-} fromList = G.fromList --- | /O(n)/ Convert the first @n@ elements of a list to a vector. +-- | /O(n)/ Convert the first @n@ elements of a list to a vector. It's +-- expected that the supplied list will be exactly @n@ elements long. As +-- an optimization, this function allocates a buffer for @n@ elements, which +-- could be used for DoS-attacks by exhausting the memory if an attacker controls +-- that parameter. -- -- @ -- fromListN n xs = 'fromList' ('take' n xs) diff --git a/vector/src/Data/Vector/Fusion/Bundle/Monadic.hs b/vector/src/Data/Vector/Fusion/Bundle/Monadic.hs index d9d550fc..92ec0da1 100644 --- a/vector/src/Data/Vector/Fusion/Bundle/Monadic.hs +++ b/vector/src/Data/Vector/Fusion/Bundle/Monadic.hs @@ -664,7 +664,7 @@ unfoldrN n f = unfoldrNM n (return . f) -- | Unfold at most @n@ elements with a monadic function. unfoldrNM :: Monad m => Int -> (s -> m (Maybe (a, s))) -> s -> Bundle m u a {-# INLINE_FUSED unfoldrNM #-} -unfoldrNM n f s = fromStream (S.unfoldrNM n f s) (Max (delay_inline max n 0)) +unfoldrNM n f s = fromStream (S.unfoldrNM n f s) Unknown -- | Unfold exactly @n@ elements -- diff --git a/vector/src/Data/Vector/Generic.hs b/vector/src/Data/Vector/Generic.hs index 88f41333..5243d751 100644 --- a/vector/src/Data/Vector/Generic.hs +++ b/vector/src/Data/Vector/Generic.hs @@ -2297,7 +2297,11 @@ fromList :: Vector v a => [a] -> v a {-# INLINE fromList #-} fromList = unstream . Bundle.fromList --- | /O(n)/ Convert the first @n@ elements of a list to a vector. +-- | /O(n)/ Convert the first @n@ elements of a list to a vector. It's +-- expected that the supplied list will be exactly @n@ elements long. As +-- an optimization, this function allocates a buffer for @n@ elements, which +-- could be used for DoS-attacks by exhausting the memory if an attacker controls +-- that parameter. -- -- @ -- fromListN n xs = 'fromList' ('take' n xs) diff --git a/vector/src/Data/Vector/Primitive.hs b/vector/src/Data/Vector/Primitive.hs index e93863c4..3801c78d 100644 --- a/vector/src/Data/Vector/Primitive.hs +++ b/vector/src/Data/Vector/Primitive.hs @@ -1786,7 +1786,11 @@ fromList :: Prim a => [a] -> Vector a {-# INLINE fromList #-} fromList = G.fromList --- | /O(n)/ Convert the first @n@ elements of a list to a vector. +-- | /O(n)/ Convert the first @n@ elements of a list to a vector. It's +-- expected that the supplied list will be exactly @n@ elements long. As +-- an optimization, this function allocates a buffer for @n@ elements, which +-- could be used for DoS-attacks by exhausting the memory if an attacker controls +-- that parameter. -- -- @ -- fromListN n xs = 'fromList' ('take' n xs) diff --git a/vector/src/Data/Vector/Storable.hs b/vector/src/Data/Vector/Storable.hs index 89549074..e8eb5183 100644 --- a/vector/src/Data/Vector/Storable.hs +++ b/vector/src/Data/Vector/Storable.hs @@ -1832,7 +1832,11 @@ fromList :: Storable a => [a] -> Vector a {-# INLINE fromList #-} fromList = G.fromList --- | /O(n)/ Convert the first @n@ elements of a list to a vector. +-- | /O(n)/ Convert the first @n@ elements of a list to a vector. It's +-- expected that the supplied list will be exactly @n@ elements long. As +-- an optimization, this function allocates a buffer for @n@ elements, which +-- could be used for DoS-attacks by exhausting the memory if an attacker controls +-- that parameter. -- -- @ -- fromListN n xs = 'fromList' ('take' n xs) diff --git a/vector/src/Data/Vector/Unboxed.hs b/vector/src/Data/Vector/Unboxed.hs index 17fe1757..28675d3a 100644 --- a/vector/src/Data/Vector/Unboxed.hs +++ b/vector/src/Data/Vector/Unboxed.hs @@ -1878,7 +1878,11 @@ fromList :: Unbox a => [a] -> Vector a {-# INLINE fromList #-} fromList = G.fromList --- | /O(n)/ Convert the first @n@ elements of a list to a vector. +-- | /O(n)/ Convert the first @n@ elements of a list to a vector. It's +-- expected that the supplied list will be exactly @n@ elements long. As +-- an optimization, this function allocates a buffer for @n@ elements, which +-- could be used for DoS-attacks by exhausting the memory if an attacker controls +-- that parameter. -- -- @ -- fromListN n xs = 'fromList' ('take' n xs)