summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorunknown <sergefp@mysql.com>2005-06-20 11:43:38 +0200
committerunknown <sergefp@mysql.com>2005-06-20 11:43:38 +0200
commitef920b28793302a532b87b4babfc224bb732941e (patch)
treed7414859ad9adf0e5ac7dce1ff50a30b66e1b866 /sql/item_cmpfunc.cc
parentf35c177a2a754c0b09b01c59d1d958f124382c19 (diff)
downloadmariadb-git-ef920b28793302a532b87b4babfc224bb732941e.tar.gz
Fix for BUG#10151: In Item_func_case::find_item don't assume that parameter str != &(this->str_value)
mysql-test/r/case.result: Testcase for BUG#10151 mysql-test/t/case.test: Testcase for BUG#10151
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 3098e5dc77e..f24638d1a93 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1174,6 +1174,8 @@ Item *Item_func_case::find_item(String *str)
String *first_expr_str,*tmp;
longlong first_expr_int;
double first_expr_real;
+ char buff[MAX_FIELD_WIDTH];
+ String buff_str(buff,sizeof(buff),default_charset());
/* These will be initialized later */
LINT_INIT(first_expr_str);
@@ -1186,7 +1188,7 @@ Item *Item_func_case::find_item(String *str)
{
case STRING_RESULT:
// We can't use 'str' here as this may be overwritten
- if (!(first_expr_str= args[first_expr_num]->val_str(&str_value)))
+ if (!(first_expr_str= args[first_expr_num]->val_str(&buff_str)))
return else_expr_num != -1 ? args[else_expr_num] : 0; // Impossible
break;
case INT_RESULT: