Skip to content
Snippets Groups Projects
Commit 2925921b authored by bos's avatar bos
Browse files

Reset the lazy decoder state consistently if an error occurs

This fixes gh-87.
parent e661fd8e
No related branches found
No related tags found
No related merge requests found
......@@ -267,6 +267,7 @@ streamDecodeUtf8With onErr = decodeChunk B.empty 0 0
UTF8_REJECT -> do
-- We encountered an encoding error
x <- peek curPtr'
poke statePtr 0
case onErr desc (Just x) of
Nothing -> loop $ curPtr' `plusPtr` 1
Just c -> do
......@@ -274,7 +275,6 @@ streamDecodeUtf8With onErr = decodeChunk B.empty 0 0
w <- unsafeSTToIO $
unsafeWrite dest (fromIntegral destOff) (safe c)
poke destOffPtr (destOff + fromIntegral w)
poke statePtr 0
loop $ curPtr' `plusPtr` 1
_ -> do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment