List:Commits« Previous MessageNext Message »
From:ramil Date:November 9 2006 1:17pm
Subject:bk commit into 4.1 tree (ramil:1.2555) BUG#23653
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of ram. When ram does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-11-09 16:17:50+04:00, ramil@stripped +3 -0
  Fix for bug #23653: Crash if last_day('0000-00-00')
  
  As get_arg0_date() in the Item_func_last_day::get_date() returns 
  0000-00-00 date sometimes, we have to check ltime->month for 0 after the call.

  mysql-test/r/func_time.result@stripped, 2006-11-09 16:17:47+04:00, ramil@stripped +3 -0
    Fix for bug #23653: Crash if last_day('0000-00-00')
      - test result.

  mysql-test/t/func_time.test@stripped, 2006-11-09 16:17:47+04:00, ramil@stripped +6 -0
    Fix for bug #23653: Crash if last_day('0000-00-00')
      - test case.

  sql/item_timefunc.cc@stripped, 2006-11-09 16:17:47+04:00, ramil@stripped +2 -1
    Fix for bug #23653: Crash if last_day('0000-00-00')
      - return error if month is 0.
    

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	ramil
# Host:	myoffice.izhnet.ru
# Root:	/usr/home/ram/work/bug23653/my41-bug23653

--- 1.110/sql/item_timefunc.cc	2006-11-09 16:17:55 +04:00
+++ 1.111/sql/item_timefunc.cc	2006-11-09 16:17:55 +04:00
@@ -3058,7 +3058,8 @@ String *Item_func_str_to_date::val_str(S
 
 bool Item_func_last_day::get_date(TIME *ltime, uint fuzzy_date)
 {
-  if (get_arg0_date(ltime, fuzzy_date & ~TIME_FUZZY_DATE))
+  if (get_arg0_date(ltime, fuzzy_date & ~TIME_FUZZY_DATE) ||
+      (ltime->month == 0))
     return 1;
   uint month_idx= ltime->month-1;
   ltime->day= days_in_month[month_idx];

--- 1.44/mysql-test/r/func_time.result	2006-11-09 16:17:55 +04:00
+++ 1.45/mysql-test/r/func_time.result	2006-11-09 16:17:55 +04:00
@@ -815,4 +815,7 @@ union
 (select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H);
 H
 5
+select last_day('0000-00-00');
+last_day('0000-00-00')
+NULL
 End of 4.1 tests

--- 1.39/mysql-test/t/func_time.test	2006-11-09 16:17:55 +04:00
+++ 1.40/mysql-test/t/func_time.test	2006-11-09 16:17:55 +04:00
@@ -446,4 +446,10 @@ union
 union
 (select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H);
 
+#
+# Bug #23653: crash if last_day('0000-00-00')
+#
+
+select last_day('0000-00-00');
+
 --echo End of 4.1 tests
Thread
bk commit into 4.1 tree (ramil:1.2555) BUG#23653ramil9 Nov