From: Anton Nikishaev Date: Wed, 21 Jul 2010 19:42:08 +0000 (+0000) Subject: Fix numeric escape sequences parsing X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=fd9f6472d9bb9b521533fdb0cd4a4bf0a742b840 Fix numeric escape sequences parsing This fixes trac bug #1344 --- diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index 05fe063..cadd56d 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -1349,11 +1349,13 @@ readNum2 is_digit base conv i = do where read i input = do case alexGetChar' input of Just (c,input') | is_digit c -> do - read (i*base + conv c) input' + let i' = i*base + conv c + if i' > 0x10ffff + then setInput input >> lexError "numeric escape sequence out of range" + else read i' input' _other -> do - if i >= 0 && i <= 0x10FFFF - then do setInput input; return (chr i) - else lit_error input + setInput input; return (chr i) + silly_escape_chars :: [(String, Char)] silly_escape_chars = [