Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data.Text.Lazy.decodeUtf8With ignore hangs on invalid data #87

Closed
NathanHowell opened this issue Sep 6, 2014 · 1 comment
Closed

Data.Text.Lazy.decodeUtf8With ignore hangs on invalid data #87

NathanHowell opened this issue Sep 6, 2014 · 1 comment

Comments

@NathanHowell
Copy link

This seems to be a difference between the strict and lazy modules.

import qualified Data.ByteString.Char8 as Bc8
import qualified Data.ByteString.Lazy as Bl
import qualified Data.Text as T
import qualified Data.Text.Lazy as Tl

main :: IO ()
main = do
  let bad = Bc8.pack ['\x6e', '\x64', '\x72', '\x65', '\x73', '\x20', '\x4c', '\xf6', '\x68', '\x2c', '\x20', '\x46', '\x72', '\x61', '\x6e', '\x6b']

  -- prints "ndres Lh, Frank"
  print (T.decodeUtf8With T.ignore bad)

  -- prints "ndres L\65533h, Frank"
  print (Tl.unpack (Tl.decodeUtf8With T.lenientDecode (Bl.fromStrict bad)))

  -- hangs
  print (Tl.unpack (Tl.decodeUtf8With T.ignore (Bl.fromStrict bad)))
@bos bos closed this as completed in 2925921 Sep 8, 2014
@bos
Copy link
Contributor

bos commented Sep 9, 2014

Thanks for reporting this. It's fixed in 1.2.

jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Sep 14, 2014
changelog:
1.2.0.0

* Fixed an integer overflow in the replace function
  (haskell/text#81)

* Fixed a hang in lazy decodeUtf8With
  (haskell/text#87)

* Reduced codegen bloat caused by use of empty and single-character
  literals

* Added an instance of IsList for GHC 7.8 and above
jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Oct 11, 2014
changelog:
1.2.0.0

* Fixed an integer overflow in the replace function
  (haskell/text#81)

* Fixed a hang in lazy decodeUtf8With
  (haskell/text#87)

* Reduced codegen bloat caused by use of empty and single-character
  literals

* Added an instance of IsList for GHC 7.8 and above
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants