[commit: ghc] master: Fix string escaping in JSON (e8fe12f)

git at git.haskell.org git at git.haskell.org
Mon Aug 7 01:56:14 UTC 2017


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/e8fe12f83b17dc39d9272d44c4168946fa54e7a0/ghc

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

commit e8fe12f83b17dc39d9272d44c4168946fa54e7a0
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


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

e8fe12f83b17dc39d9272d44c4168946fa54e7a0
 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