Skip to content

Commit

Permalink
MDEV-16518 MYSQL57_GENERATED_FIELD: The code in TABLE_SHARE::init_fro…
Browse files Browse the repository at this point in the history
…m_binary_frm_image() is not safe
  • Loading branch information
abarkov committed Apr 26, 2019
1 parent 9a5a86f commit 5cfc779
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
Binary file added mysql-test/std_data/frm/mdev16518.frm
Binary file not shown.
16 changes: 16 additions & 0 deletions mysql-test/suite/vcol/r/vcol_misc.result
Expand Up @@ -409,3 +409,19 @@ Warning 1918 Encountered illegal value '\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7' when c
#
# End of 10.1 tests
#
#
# Start of 10.2 tests
#
#
# MDEV-16518 MYSQL57_GENERATED_FIELD: The code in TABLE_SHARE::init_from_binary_frm_image() is not safe
#
SHOW TABLES;
Tables_in_test
t1
SHOW CREATE TABLE t1;
ERROR HY000: Incorrect information in file: './test/t1.frm'
ALTER TABLE t1;
ERROR HY000: Incorrect information in file: './test/t1.frm'
#
# End of 10.2 tests
#
23 changes: 23 additions & 0 deletions mysql-test/suite/vcol/t/vcol_misc.test
Expand Up @@ -371,3 +371,26 @@ SELECT COLUMN_GET(@aaa, 'price' AS DOUBLE) aaa;
--echo #
--echo # End of 10.1 tests
--echo #


--echo #
--echo # Start of 10.2 tests
--echo #

--echo #
--echo # MDEV-16518 MYSQL57_GENERATED_FIELD: The code in TABLE_SHARE::init_from_binary_frm_image() is not safe
--echo #

--copy_file std_data/frm/mdev16518.frm $MYSQLD_DATADIR/test/t1.frm
SHOW TABLES;
--replace_result $MYSQLD_DATADIR ./
--error ER_NOT_FORM_FILE
SHOW CREATE TABLE t1;
--replace_result $MYSQLD_DATADIR ./
--error ER_NOT_FORM_FILE
ALTER TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.frm

--echo #
--echo # End of 10.2 tests
--echo #
3 changes: 2 additions & 1 deletion sql/table.cc
Expand Up @@ -1839,7 +1839,8 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
goto err;
vcol_info= new (&share->mem_root) Virtual_column_info();
vcol_info_length= uint2korr(vcol_screen_pos + 1);
DBUG_ASSERT(vcol_info_length);
if (!vcol_info_length) // Expect non-empty expression
goto err;
vcol_info->stored_in_db= vcol_screen_pos[3];
vcol_info->utf8= 0;
vcol_screen_pos+= vcol_info_length + MYSQL57_GCOL_HEADER_SIZE;;
Expand Down

0 comments on commit 5cfc779

Please sign in to comment.