]> mj.ucw.cz Git - libucw.git/commitdiff
JSON: Reject denormalized UTF-8 sequences
authorMartin Mares <mj@ucw.cz>
Wed, 8 Jul 2015 22:00:36 +0000 (00:00 +0200)
committerMartin Mares <mj@ucw.cz>
Wed, 8 Jul 2015 22:00:36 +0000 (00:00 +0200)
ucw-json/json-test.t
ucw-json/parse.c

index cece0d233ab8db3a2f7e764ff01437e5de395d1c..db747e7f5f1cbc4ccb2ac064e690d720cb44991a 100644 (file)
@@ -205,6 +205,12 @@ In:        "<ed><b0><80>"
 Exit:  1
 Err:   ERROR: Invalid surrogate character in string at line 1:2
 
+# Denormalized U+07FF
+Name:  UTF-8 denormalized
+In:    "<c1><bf>"
+Exit:  1
+Err:   ERROR: Malformed UTF-8 character at line 1:1
+
 # U+FEFF
 Name:  UTF-8 BOM
 In:    <ef><bb><bf>
index 8ed97e3b423fa31b5f4fbea9c8680a1274e53936..7873d13f889d77cfe3552022913ea22b029b6d44 100644 (file)
@@ -40,7 +40,6 @@ static int json_get_char(struct json_context *js)
       if (c == -2)
        json_parse_error(js, "Malformed UTF-8 character");
       js->in_eof = 1;
-      // FIXME: Reject alternative sequences
       return c;
     }
   js->in_column++;