summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.h
diff options
context:
space:
mode:
authorSergey Vojtovich <sergey.vojtovich@oracle.com>2011-02-18 11:10:30 +0300
committerSergey Vojtovich <sergey.vojtovich@oracle.com>2011-02-18 11:10:30 +0300
commit659ff29394c458e3dc9fd44d453c21c54bf4cb31 (patch)
tree74c965907b21ae126768c1c28085c46dd10f426c /sql/item_timefunc.h
parent093d94cc1d811676f7c2213606426afba0e29382 (diff)
downloadmariadb-git-659ff29394c458e3dc9fd44d453c21c54bf4cb31.tar.gz
BUG#11766720 - setting storage engine to null segfaults mysqld
MONTHNAME(0) claims that it is about to return NOT NULL value, whereas it actually returns NULL. As a result storage_engine variable (which cannot be NULL) protection was bypassed and NULL value was accepted, causing server crash. Fixed MONTHNAME(0) to report valid NULL flag. mysql-test/r/func_time.result: A test case for BUG#11766720. mysql-test/t/func_time.test: A test case for BUG#11766720. sql/item_timefunc.cc: MONTHNAME(0) must report NULL, as opposed to base class MONTH(0) which is NOT NULL. Fixed Item_func_monthname to inherit from Item_str_func instead of Item_func_month. sql/item_timefunc.h: MONTHNAME(0) must report NULL, as opposed to base class MONTH(0) which is NOT NULL. Fixed Item_func_monthname to inherit from Item_str_func instead of Item_func_month.
Diffstat (limited to 'sql/item_timefunc.h')
-rw-r--r--sql/item_timefunc.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 9732e8dc360..92e24d75111 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -163,16 +163,19 @@ public:
};
-class Item_func_monthname :public Item_func_month
+class Item_func_monthname :public Item_str_func
{
MY_LOCALE *locale;
public:
- Item_func_monthname(Item *a) :Item_func_month(a) {}
+ Item_func_monthname(Item *a) :Item_str_func(a) {}
const char *func_name() const { return "monthname"; }
String *val_str(String *str);
- enum Item_result result_type () const { return STRING_RESULT; }
void fix_length_and_dec();
bool check_partition_func_processor(uchar *int_arg) {return TRUE;}
+ bool check_valid_arguments_processor(uchar *int_arg)
+ {
+ return !has_date_args();
+ }
};