haskell / base16-bytestring

Fast base16 (hexadecimal) encoding and decoding for Haskell bytestrings.
Other
27 stars 10 forks source link

Lazy decoding broken when chunks don't have even length #7

Closed tvh closed 6 years ago

tvh commented 6 years ago

Steps to reproduce:

Prelude> import qualified Data.ByteString.Base16.Lazy as BL16
Prelude BL16> import qualified Data.ByteString.Lazy as BSL
Prelude BL16 BSL> :set -XOverloadedStrings
Prelude BL16 BSL> BL16.encode "aB9"
"614239"
Prelude BL16 BSL> let encoded1 = BL16.encode "aB9"
Prelude BL16 BSL> let encoded2 = BSL.fromChunks ["614","239"]
Prelude BL16 BSL> BL16.decode encoded2
("aI#","")
Prelude BL16 BSL> BL16.decode encoded1
("aB9","")