diff options
author | dlenev@mysql.com <> | 2004-12-30 21:37:32 +0300 |
---|---|---|
committer | dlenev@mysql.com <> | 2004-12-30 21:37:32 +0300 |
commit | 4ef7ac5c09657afaa09838f9642a9c3f8eff38fd (patch) | |
tree | 8e50594a30d4d0d2a0239ab976ce23fe93ec089c /sql | |
parent | e0280694cd5066beecd55766924a321c6b7940b1 (diff) | |
parent | 2600fb3bdf1c00ad5464429d2c112664795709bf (diff) | |
download | mariadb-git-4ef7ac5c09657afaa09838f9642a9c3f8eff38fd.tar.gz |
Manual merge of fix for bugs of #7297 and #7515 into 4.1 tree.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_timefunc.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 054a9966e73..6198043b576 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1636,11 +1636,12 @@ longlong Item_func_from_unixtime::val_int() bool Item_func_from_unixtime::get_date(TIME *ltime, uint fuzzy_date __attribute__((unused))) { - longlong tmp= args[0]->val_int(); - - if ((null_value= (args[0]->null_value || - tmp < TIMESTAMP_MIN_VALUE || - tmp > TIMESTAMP_MAX_VALUE))) + ulonglong tmp= (ulonglong)(args[0]->val_int()); + /* + "tmp > TIMESTAMP_MAX_VALUE" check also covers case of negative + from_unixtime() argument since tmp is unsigned. + */ + if ((null_value= (args[0]->null_value || tmp > TIMESTAMP_MAX_VALUE))) return 1; thd->variables.time_zone->gmt_sec_to_TIME(ltime, (my_time_t)tmp); |