MDEV-27415 main.json_normalize and main.json_equals fail with UBSAN runtime error

UBSAN: out of bound array read in json

json_lib.c:847:25: runtime error: index 200 out of bounds for type 'json_string_char_classes [128]'
json_lib.c:847:25: runtime error: load of address 0x56286f7175a0 with insufficient space for an object of type 'json_string_char_classes'

fixes main.json_equals  and main.json_normalize
This commit is contained in:
Sergei Golubchik 2022-02-18 16:21:08 +01:00
parent fd132be117
commit 0a1d9d0681

View file

@ -844,7 +844,7 @@ static int skip_key(json_engine_t *j)
{
int t_next, c_len;
if (json_instr_chr_map[j->s.c_next] == S_BKSL &&
if (j->s.c_next< 128 && json_instr_chr_map[j->s.c_next] == S_BKSL &&
json_handle_esc(&j->s))
return 1;