Skip to content

Commit 59fd0e6

Browse files
committed
Merge branch '11.1' into mariadb-11.1.3
2 parents 0f5613a + 28c86f8 commit 59fd0e6

File tree

5 files changed

+28
-4
lines changed

5 files changed

+28
-4
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
MYSQL_VERSION_MAJOR=11
22
MYSQL_VERSION_MINOR=1
3-
MYSQL_VERSION_PATCH=3
3+
MYSQL_VERSION_PATCH=4
44
SERVER_MATURITY=stable

mysql-test/main/func_json.result

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4699,4 +4699,11 @@ NULL
46994699
SELECT JSON_SCHEMA_VALID(NULL, NULL);
47004700
JSON_SCHEMA_VALID(NULL, NULL)
47014701
NULL
4702+
#
4703+
# MDEV-31599: Assertion `0' failed in Item_param::can_return_value from Item::val_json,
4704+
# UBSAN: member access within null pointer of type 'struct String' in
4705+
# sql/item_jsonfunc.cc
4706+
#
4707+
PREPARE s FROM 'SELECT JSON_SCHEMA_VALID (?,''{}'') FROM DUAL';
4708+
ERROR HY000: Variable schema is not supported.
47024709
# End of 11.1 test

mysql-test/main/func_json.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3668,4 +3668,13 @@ SELECT JSON_SCHEMA_VALID('{}', NULL);
36683668
SELECT JSON_SCHEMA_VALID(NULL, '{}');
36693669
SELECT JSON_SCHEMA_VALID(NULL, NULL);
36703670

3671+
--echo #
3672+
--echo # MDEV-31599: Assertion `0' failed in Item_param::can_return_value from Item::val_json,
3673+
--echo # UBSAN: member access within null pointer of type 'struct String' in
3674+
--echo # sql/item_jsonfunc.cc
3675+
--echo #
3676+
3677+
--error ER_JSON_NO_VARIABLE_SCHEMA
3678+
PREPARE s FROM 'SELECT JSON_SCHEMA_VALID (?,''{}'') FROM DUAL';
3679+
36713680
--echo # End of 11.1 test

sql/item_jsonfunc.cc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4798,15 +4798,21 @@ If any of them fails, return false, else return true.
47984798
bool Item_func_json_schema_valid::fix_length_and_dec(THD *thd)
47994799
{
48004800
json_engine_t je;
4801-
bool res= 0;
4801+
bool res= 0, is_schema_constant= args[0]->const_item();
48024802

4803-
String *js= args[0]->val_json(&tmp_js);
4803+
String *js= NULL;
48044804

4805-
if ((null_value= args[0]->null_value))
4805+
if (!is_schema_constant || (null_value= args[0]->null_value))
48064806
{
4807+
if (!is_schema_constant)
4808+
{
4809+
my_error(ER_JSON_NO_VARIABLE_SCHEMA, MYF(0));
4810+
}
48074811
null_value= 1;
48084812
return 0;
48094813
}
4814+
js= args[0]->val_json(&tmp_js);
4815+
48104816
json_scan_start(&je, js->charset(), (const uchar *) js->ptr(),
48114817
(const uchar *) js->ptr() + js->length());
48124818
if (!create_object_and_handle_keyword(thd, &je, &keyword_list,

sql/share/errmsg-utf8.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11972,3 +11972,5 @@ ER_JSON_INVALID_VALUE_FOR_KEYWORD
1197211972
ER_JSON_SCHEMA_KEYWORD_UNSUPPORTED
1197311973
eng "%s keyword is not supported"
1197411974
sw "%s neno kuu halitumiki"
11975+
ER_JSON_NO_VARIABLE_SCHEMA
11976+
eng "Variable schema is not supported."

0 commit comments

Comments
 (0)