diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2015-06-04 16:04:05 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2015-06-05 10:44:11 +0400 |
commit | a2bb9d263993783923ba8fc83d5b9ddd36dbe09d (patch) | |
tree | 71b17cc8abe7c29972d0a66b95412502afb43e80 /sql | |
parent | b611ac06a736a5d8d4fcf0d81316343745d4113d (diff) | |
download | mariadb-git-a2bb9d263993783923ba8fc83d5b9ddd36dbe09d.tar.gz |
MDEV-7505 - Too large scale in DECIMAL dynamic column getter crashes mysqld
Server may crash if sanity checks of COLUMN_GET() fail.
COLUMN_GET() description generator expects parent CAST item, which may not have
been created due to failure of sanity checks. Then further attempt to report
an error may crash the server.
Fixed COLUMN_GET() description generator to handle such case.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_strfunc.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index eedf1499403..aca66fc29e0 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -4467,6 +4467,16 @@ null: void Item_dyncol_get::print(String *str, enum_query_type query_type) { + /* + Parent cast doesn't exist yet, only print dynamic column name. This happens + when called from create_func_cast() / wrong_precision_error(). + */ + if (!str->length()) + { + args[1]->print(str, query_type); + return; + } + /* see create_func_dyncol_get */ DBUG_ASSERT(str->length() >= 5); DBUG_ASSERT(strncmp(str->ptr() + str->length() - 5, "cast(", 5) == 0); |