diff options
author | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2023-04-13 16:43:30 +0530 |
---|---|---|
committer | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2023-05-16 01:52:16 +0530 |
commit | b7b8a9ee439f8d3c9457a6eb480001cae37307b8 (patch) | |
tree | b3c7ef87c18ea0d445b27a33520a663d72f77095 /include/json_lib.h | |
parent | 996b040f9384cf03e814182053b12945d3df5732 (diff) | |
download | mariadb-git-bb-10.4-MDEV-23187.tar.gz |
MDEV-23187: Assorted assertion failures in json_find_path with certainbb-10.4-MDEV-23187
collations
Fix by Alexey Botchkov
The 'value_len' is calculated wrong for the multibyte charsets. In the
read_strn() function we get the length of the string with the final ' " '
character. So have to subtract it's length from the value_len. And the
length of '1' isn't correct for the ucs2 charset (must be 2).
Diffstat (limited to 'include/json_lib.h')
-rw-r--r-- | include/json_lib.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/json_lib.h b/include/json_lib.h index 2ec3e9de8f8..71e5d578855 100644 --- a/include/json_lib.h +++ b/include/json_lib.h @@ -35,6 +35,7 @@ typedef struct st_json_string_t const uchar *c_str; /* Current position in JSON string */ const uchar *str_end; /* The end on the string. */ my_wc_t c_next; /* UNICODE of the last read character */ + int c_next_len; /* character lenght of the last read character. */ int error; /* error code. */ CHARSET_INFO *cs; /* Character set of the JSON string. */ @@ -48,7 +49,7 @@ void json_string_set_cs(json_string_t *s, CHARSET_INFO *i_cs); void json_string_set_str(json_string_t *s, const uchar *str, const uchar *end); #define json_next_char(j) \ - (j)->wc((j)->cs, &(j)->c_next, (j)->c_str, (j)->str_end) + ((j)->c_next_len= (j)->wc((j)->cs, &(j)->c_next, (j)->c_str, (j)->str_end)) #define json_eos(j) ((j)->c_str >= (j)->str_end) /* read_string_const_chr() reads the next character of the string constant |