1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-05 13:16:09 +03:00

MDEV-24909 JSON functions don't respect KILL QUERY / max_statement_time limit

pass the pointer to thd->killed down to the json library,
check it while scanning,
use thd->check_killed() to generate the proper error message
This commit is contained in:
Sergei Golubchik
2021-07-02 19:13:26 +02:00
parent bae9fb5904
commit bc10f58a58
5 changed files with 115 additions and 3 deletions

View File

@@ -807,10 +807,13 @@ static json_state_handler json_actions[NR_JSON_STATES][NR_C_CLASSES]=
int json_scan_start(json_engine_t *je,
CHARSET_INFO *i_cs, const uchar *str, const uchar *end)
{
static const uchar no_time_to_die= 0;
json_string_setup(&je->s, i_cs, str, end);
je->stack[0]= JST_DONE;
je->stack_p= 0;
je->state= JST_VALUE;
je->killed_ptr = (uchar*)&no_time_to_die;
return 0;
}
@@ -971,7 +974,7 @@ int json_scan_next(json_engine_t *j)
int t_next;
get_first_nonspace(&j->s, &t_next, &j->sav_c_len);
return json_actions[j->state][t_next](j);
return *j->killed_ptr || json_actions[j->state][t_next](j);
}