Skip to content
/ server Public
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions mysql-test/main/dyncol.result
Original file line number Diff line number Diff line change
Expand Up @@ -1974,3 +1974,9 @@ var {"jsn":"\u0000\u0005\u0000l\u0000'\u0000\u0002\u0000)\u0000\u0002\u0000+\u00
zzz {"jsn":"\u0000\u0009\u0000�\u0000C\u0000\u0002\u0000E\u0000\u0002\u0000G\u0000\u0003\u0000J\u0000\u0004\u0000N\u0000\u0005\u0000S\u0000\u0005\u0000X\u0000\u0005\u0000]\u0000\u0005\u0000b\u0000\u0005\u0000\u000Cg\u0000\u000Cj\u0000\u000Cm\u0000\u000Cp\u0000\u0005,\u0000\u0005\u001B\u0000\u0005,\u0000\u000C�\u0000\u0007�\u0000f8f9f10pic2box_cbox_gbox_kbox_vf5_id\u000244\u000244\u000232Ahttp://oss.hdb88.com/0/photo/078ee7e7c6464ab68a0483733266a52a.gif\u00080.052272$O\u001E\u0000","volume":193.6}
drop table t1;
# End of 10.5 tests
#
# MDEV-36929: COLUMN_JSON() does not free an internal dynamic string
#
SELECT COLUMN_JSON(1000);
ERROR HY000: Encountered illegal format of dynamic column string
# End of 10.6 tests
8 changes: 8 additions & 0 deletions mysql-test/main/dyncol.test
Original file line number Diff line number Diff line change
Expand Up @@ -1026,3 +1026,11 @@ select c1,column_json(d1) as not_crashing from t1 order by c1;
drop table t1;

--echo # End of 10.5 tests

--echo #
--echo # MDEV-36929: COLUMN_JSON() does not free an internal dynamic string
--echo #
--error ER_DYN_COL_WRONG_FORMAT
SELECT COLUMN_JSON(1000);

--echo # End of 10.6 tests
3 changes: 1 addition & 2 deletions sql/item_strfunc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4796,9 +4796,9 @@ String *Item_func_dyncol_json::val_str(String *str)
if ((rc= mariadb_dyncol_json(&col, &json)))
{
dynamic_column_error_message(rc);
dynstr_free(&json);
goto null;
}
bzero(&col, sizeof(col));
{
/* Move result from DYNAMIC_COLUMN to str */
char *ptr;
Expand All @@ -4811,7 +4811,6 @@ String *Item_func_dyncol_json::val_str(String *str)
return str;

null:
bzero(&col, sizeof(col));
null_value= TRUE;
return NULL;
}
Expand Down