From: Martin Mares Date: Wed, 8 Jul 2015 22:00:36 +0000 (+0200) Subject: JSON: Reject denormalized UTF-8 sequences X-Git-Tag: v6.5~13 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=2b7e06d3c5d93dc8bfd3ba1bee558610cfe37b38;p=libucw.git JSON: Reject denormalized UTF-8 sequences --- diff --git a/ucw-json/json-test.t b/ucw-json/json-test.t index cece0d23..db747e7f 100644 --- a/ucw-json/json-test.t +++ b/ucw-json/json-test.t @@ -205,6 +205,12 @@ In: "<80>" Exit: 1 Err: ERROR: Invalid surrogate character in string at line 1:2 +# Denormalized U+07FF +Name: UTF-8 denormalized +In: "" +Exit: 1 +Err: ERROR: Malformed UTF-8 character at line 1:1 + # U+FEFF Name: UTF-8 BOM In: diff --git a/ucw-json/parse.c b/ucw-json/parse.c index 8ed97e3b..7873d13f 100644 --- a/ucw-json/parse.c +++ b/ucw-json/parse.c @@ -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++;