summaryrefslogtreecommitdiff
path: root/strings/json_lib.c
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2019-09-12 11:12:55 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2019-09-12 11:12:55 +0400
commit9554ef067878c4650ef4b9ad44e0b222cdb313a5 (patch)
tree5f5ae63b4407fcf95d1e7560a7aff256119417e1 /strings/json_lib.c
parent0fa5ad3acfadfedba6f89d05745bbd1aee8d8d45 (diff)
downloadmariadb-git-9554ef067878c4650ef4b9ad44e0b222cdb313a5.tar.gz
MDEV-19670 json escaped unicode parse error.
Fixed 4-byte length characters handled incorrectly.
Diffstat (limited to 'strings/json_lib.c')
-rw-r--r--strings/json_lib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/strings/json_lib.c b/strings/json_lib.c
index 24c79cb9044..77b41dceb20 100644
--- a/strings/json_lib.c
+++ b/strings/json_lib.c
@@ -320,15 +320,17 @@ static int json_handle_esc(json_string_t *s)
if (s->c_next != '\\')
return s->error= JE_SYN;
+ s->c_str+= c_len;
if ((c_len= json_next_char(s)) <= 0)
return s->error= json_eos(s) ? JE_EOS : JE_BAD_CHR;
if (s->c_next != 'u')
return s->error= JE_SYN;
+ s->c_str+= c_len;
if (read_4_hexdigits(s, code+2))
return 1;
- if ((c_len= my_utf16_uni(0, &s->c_next, code, code+4)) == 2)
+ if ((c_len= my_utf16_uni(0, &s->c_next, code, code+4)) == 4)
return 0;
}
return s->error= JE_BAD_CHR;