diff options
author | Monty <monty@mariadb.org> | 2017-11-02 14:39:54 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2017-11-02 17:05:53 +0200 |
commit | 5d0153c408ff8c7282fc387c4041fdbffd35727d (patch) | |
tree | 30296001e294566c12425223e9cef43fa01dab9e /sql/datadict.cc | |
parent | d8a9b524f2e4efec675725c4c32acefe1d8dcb15 (diff) | |
download | mariadb-git-5d0153c408ff8c7282fc387c4041fdbffd35727d.tar.gz |
MDEV-12633 Error from valgrind related to dd_frm_type
"Conditional jump or move depends on uninitialised value in
my_scan_weight_utf8_general_ci, main.mysql_client_test fails in biuldbot
with valgrind"
- Fixed by ensuring that engine_name is set to empty string even in case
errors in the .frm file
- Added some error checking to ha_table_exists()
Diffstat (limited to 'sql/datadict.cc')
-rw-r--r-- | sql/datadict.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sql/datadict.cc b/sql/datadict.cc index ee0d8805f95..f01d61f531b 100644 --- a/sql/datadict.cc +++ b/sql/datadict.cc @@ -45,6 +45,8 @@ static int read_string(File file, uchar**to, size_t length) engine_name is a LEX_STRING, where engine_name->str must point to a buffer of at least NAME_CHAR_LEN+1 bytes. + If engine_name is 0, then the function will only test if the file is a + view or not @retval FRMTYPE_ERROR error @retval FRMTYPE_TABLE table @@ -72,12 +74,23 @@ frm_type_enum dd_frm_type(THD *thd, char *path, LEX_STRING *engine_name) goto err; } + /* + We return FRMTYPE_TABLE if we can read the .frm file. This allows us + to drop a bad .frm file with DROP TABLE + */ type= FRMTYPE_TABLE; - if (!is_binary_frm_header(header) || !engine_name) + /* engine_name is 0 if we only want to know if table is view or not */ + if (!engine_name) goto err; + /* Initialize engine name in case we are not able to find it out */ engine_name->length= 0; + engine_name->str[0]= 0; + + if (!is_binary_frm_header(header)) + goto err; + dbt= header[3]; /* cannot use ha_resolve_by_legacy_type without a THD */ |