Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

readJSString: gracefully handle unterminated strings (again)

  • Loading branch information...
commit 436240e79cd4c9dabf58ee0cd6993f166aacdb4e 1 parent 9b9ed63
Sigbjorn Finne authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 Text/JSON/String.hs
4 Text/JSON/String.hs
View
@@ -121,7 +121,6 @@ readJSString = do
case x of
'"' : cs -> parse [] cs
_ -> fail $ "Malformed JSON: expecting string: " ++ context x
-
where
parse rs cs =
case cs of
@@ -131,10 +130,11 @@ readJSString = do
c : ds
| c >= '\x20' && c <= '\xff' -> parse (c:rs) ds
| c < '\x20' -> fail $ "Illegal unescaped character in string: " ++ context cs
- | i <= 0x10fffff -> parse (c:rs) ds
+ | i <= 0x10ffff -> parse (c:rs) ds
| otherwise -> fail $ "Illegal unescaped character in string: " ++ context cs
where
i = (fromIntegral (fromEnum c) :: Integer)
+ _ -> fail $ "Unable to parse JSON String: unterminated String: " ++ context cs
esc rs c cs = case c of
'\\' -> parse ('\\' : rs) cs
Please sign in to comment.
Something went wrong with that request. Please try again.