diff options
author | Georgi Kodinov <Georgi.Kodinov@Oracle.com> | 2010-07-14 14:54:51 +0300 |
---|---|---|
committer | Georgi Kodinov <Georgi.Kodinov@Oracle.com> | 2010-07-14 14:54:51 +0300 |
commit | dbb643d64e0981f56b6c7b35586f430b08091834 (patch) | |
tree | aaa5dfcca721b7e1c7b57bfea71d29a683c66583 /sql/item_func.cc | |
parent | 678640019debce6c77109dc5f52e323eaee45a9f (diff) | |
download | mariadb-git-dbb643d64e0981f56b6c7b35586f430b08091834.tar.gz |
Bug #51876: crash/memory underrun when loading data with ucs2
and reverse() function
3 problems fixed :
1. The reported problem : caused by incorrect parsing of
the file as ucs data resulting in wrong length of the parsed
string. Fixed by truncating the invalid trailing bytes
(non-complete multibyte characters) when reading from the file
2. LOAD DATA when reading from a proper UCS2 file wasn't
recognizing the new line characters. Fixed by first looking
if a byte is a new line (or any other special) character before
reading it as a part of a multibyte character.
3. When using user variables to hold the column data in LOAD
DATA the character set of the user variable was set incorrectly
to the database charset. Fixed by setting it to the charset
specified by LOAD DATA (if any).
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index 1e31755179b..1bec4700bff 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -4715,6 +4715,7 @@ bool Item_func_get_user_var::set_value(THD *thd, bool Item_user_var_as_out_param::fix_fields(THD *thd, Item **ref) { DBUG_ASSERT(fixed == 0); + DBUG_ASSERT(thd->lex->exchange); if (Item::fix_fields(thd, ref) || !(entry= get_variable(&thd->user_vars, name, 1))) return TRUE; @@ -4724,7 +4725,9 @@ bool Item_user_var_as_out_param::fix_fields(THD *thd, Item **ref) of fields in LOAD DATA INFILE. (Since Item_user_var_as_out_param is used only there). */ - entry->collation.set(thd->variables.collation_database); + entry->collation.set(thd->lex->exchange->cs ? + thd->lex->exchange->cs : + thd->variables.collation_database); entry->update_query_id= thd->query_id; return FALSE; } |