[commit: packages/binary] master: Bug fix isolate; decoder must use all input (521705c)

git at git.haskell.org git at git.haskell.org
Sun Dec 14 17:54:45 UTC 2014


Repository : ssh://git@git.haskell.org/binary

On branch  : master
Link       : http://git.haskell.org/packages/binary.git/commitdiff/521705c08c4608fadf34b19e2e04d694625b24a5

>---------------------------------------------------------------

commit 521705c08c4608fadf34b19e2e04d694625b24a5
Author: Lennart Kolmodin <kolmodin at gmail.com>
Date:   Sun May 11 13:20:12 2014 +0400

    Bug fix isolate; decoder must use all input
    
    A decoder could have been given the final chuck, but not used
    all its input, and still succeed.
    This change corrects the behavior and makes sure that isolate
    must use all input in order to succeed.


>---------------------------------------------------------------

521705c08c4608fadf34b19e2e04d694625b24a5
 src/Data/Binary/Get/Internal.hs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Data/Binary/Get/Internal.hs b/src/Data/Binary/Get/Internal.hs
index 85f56df..7d9a518 100644
--- a/src/Data/Binary/Get/Internal.hs
+++ b/src/Data/Binary/Get/Internal.hs
@@ -194,7 +194,7 @@ isolate n0 act
   | otherwise = go n0 (runCont act B.empty Done)
   where
   go !n (Done left x)
-    | n == 0 = return x
+    | n == 0 && B.null left = return x
     | otherwise = do
         pushFront left
         let consumed = n0 - n



More information about the ghc-commits mailing list