on master help sign in
Add back 'ensure 1' to avoid overflowing an output buffer
22dc447Simon Meier
Data/Text/Encoding.hs+1−1
@@ -384,7 +384,7 @@ encodeUtf8 (Text arr off len) = unsafeDupablePerformIO $ do
384 start newSize n m fp'
384 start newSize n m fp'
385 {-# INLINE ensure #-}
385 {-# INLINE ensure #-}
386 case A.unsafeIndex arr n of
386 case A.unsafeIndex arr n of
387− w| w <= 0x7F -> do
387+ w| w <= 0x7F -> ensure 1 $ do
388 poke (ptr `plusPtr` m) (fromIntegral w :: Word8)
388 poke (ptr `plusPtr` m) (fromIntegral w :: Word8)
389 go (n+1) (m+1)
389 go (n+1) (m+1)
390 | w <= 0x7FF -> ensure 2 $ do
390 | w <= 0x7FF -> ensure 2 $ do