[commit: ghc] ghc-8.2: Fix string escaping in JSON (1778256)
git at git.haskell.org
git at git.haskell.org
Fri Aug 25 19:11:59 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.2
Link : http://ghc.haskell.org/trac/ghc/changeset/177825687916e8295d9bc0c1f694cecf76fd3d81/ghc
>---------------------------------------------------------------
commit 177825687916e8295d9bc0c1f694cecf76fd3d81
Author: Dmitry Malikov <malikov.d.y at gmail.com>
Date: Sat Aug 5 16:28:40 2017 +0200
Fix string escaping in JSON
It seems to that double quotes is not escaped well at the moment.
We'd noticed this with @alexbiehl during the work on https://github.com/haskell/haddock/pull/645
(cherry picked from commit e8fe12f83b17dc39d9272d44c4168946fa54e7a0)
>---------------------------------------------------------------
177825687916e8295d9bc0c1f694cecf76fd3d81
compiler/utils/Json.hs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/compiler/utils/Json.hs b/compiler/utils/Json.hs
index 1318ce2..ffbff50 100644
--- a/compiler/utils/Json.hs
+++ b/compiler/utils/Json.hs
@@ -39,7 +39,7 @@ escapeJsonString = concatMap escapeChar
escapeChar '\n' = "\\n"
escapeChar '\r' = "\\r"
escapeChar '\t' = "\\t"
- escapeChar '"' = "\""
+ escapeChar '"' = "\\\""
escapeChar '\\' = "\\\\"
escapeChar c | isControl c || fromEnum c >= 0x7f = uni_esc c
escapeChar c = [c]
More information about the ghc-commits
mailing list