Skip to content

Commit 1e2d4f6

Browse files
author
Alexey Botchkov
committed
MDEV-13971 crash in skip_num_constant.
Character bigger than 0x60 wasn't handled properly inside a numeric constant.
1 parent dcbf282 commit 1e2d4f6

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

mysql-test/r/func_json.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,3 +725,6 @@ json_contains_path('{"foo":"bar"}', 'one', '$[]')
725725
NULL
726726
Warnings:
727727
Warning 4042 Syntax error in JSON path in argument 3 to function 'json_contains_path' at position 3
728+
select JSON_VALID(0x36f0c8dccd83c5eac156da);
729+
JSON_VALID(0x36f0c8dccd83c5eac156da)
730+
0

mysql-test/t/func_json.test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,3 +378,7 @@ SELECT JSON_OBJECT("user","Jožko Mrkvičká") as json_data;
378378

379379
select json_contains_path('{"foo":"bar"}', 'one', '$[]');
380380

381+
#
382+
# MDEV-13971 crash in skip_num_constant.
383+
#
384+
select JSON_VALID(0x36f0c8dccd83c5eac156da);

strings/json_lib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ static int skip_num_constant(json_engine_t *j)
503503
for (;;)
504504
{
505505
j->num_flags|= json_num_state_flags[state];
506-
if ((c_len= json_next_char(&j->s)) > 0)
506+
if ((c_len= json_next_char(&j->s)) > 0 && j->s.c_next < 128)
507507
{
508508
if ((state= json_num_states[state][json_num_chr_map[j->s.c_next]]) > 0)
509509
{

0 commit comments

Comments
 (0)