[commit: base] master: Fix #7853 (2b47052)

Max Bolingbroke batterseapower at hotmail.com
Tue Apr 23 22:14:09 CEST 2013


Repository : ssh://darcs.haskell.org//srv/darcs/packages/base

On branch  : master

https://github.com/ghc/packages-base/commit/2b4705254638f5b06a0e83359e28e361f40d2ac4

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

commit 2b4705254638f5b06a0e83359e28e361f40d2ac4
Author: Max Bolingbroke <batterseapower at hotmail.com>
Date:   Mon Apr 22 21:23:07 2013 +0100

    Fix #7853

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

 GHC/IO/Encoding/UTF8.hs |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/GHC/IO/Encoding/UTF8.hs b/GHC/IO/Encoding/UTF8.hs
index 0d82113..6d887bb 100644
--- a/GHC/IO/Encoding/UTF8.hs
+++ b/GHC/IO/Encoding/UTF8.hs
@@ -156,7 +156,8 @@ utf8_decode
                 _ | c0 <= 0x7f -> do 
                            ow' <- writeCharBuf oraw ow (unsafeChr (fromIntegral c0))
                            loop (ir+1) ow'
-                  | c0 >= 0xc0 && c0 <= 0xdf ->
+                  | c0 >= 0xc0 && c0 <= 0xc1 -> invalid -- Overlong forms
+                  | c0 >= 0xc2 && c0 <= 0xdf ->
                            if iw - ir < 2 then done InputUnderflow ir ow else do
                            c1 <- readWord8Buf iraw (ir+1)
                            if (c1 < 0x80 || c1 >= 0xc0) then invalid else do





More information about the ghc-commits mailing list