8 messages in com.mysql.lists.bugsRe: date functions crash
FromSent OnAttachments
Max Hammond03 Apr 2001 09:10 
Max Hammond04 Apr 2001 03:03 
Sinisa Milivojevic04 Apr 2001 04:39 
Max Hammond04 Apr 2001 04:54 
Sinisa Milivojevic04 Apr 2001 05:57 
Michael Widenius04 Apr 2001 06:26 
Sasha Pachev05 Apr 2001 17:30 
Sinisa Milivojevic06 Apr 2001 06:32 
Subject:Re: date functions crash
From:Sasha Pachev (sas@mysql.com)
Date:04/05/2001 05:30:08 PM
List:com.mysql.lists.bugs

On Wednesday 04 April 2001 04:03, Max Hammond wrote:

I'll just add that if anyone wants a dump of the data causing this, drop me a note at ma@flipstorm.net and I'll mail it to you, it's about 2500 rows, and only that one field necessary to crash it.

Cheers,

Fix:

--- 1.11/sql/time.cc Wed Nov 15 13:59:54 2000 +++ edited/time.cc Thu Apr 5 17:48:04 2001 @@ -428,11 +428,15 @@ uint field_length,year_length,digits,i,number_of_fields,date[7]; bool date_used=0; const char *pos; - const char *end=str+length; DBUG_ENTER("str_to_TIME"); DBUG_PRINT("enter",("str: %.*s",length,str));

- for (; !isdigit(*str) && str != end ; str++) ; // Skipp garbage + if(!str) + DBUG_RETURN(TIMESTAMP_NONE); + + const char *end=str+length; + + for (; !isdigit(*str) && str != end ; str++) ; // Skip garbage if (str == end) DBUG_RETURN(TIMESTAMP_NONE); /*

The problem was actually not in deally with invalid wannabe-fuzzy dates, but rather in converting an empty string text/blob field to a date.

Monty - I have considered several ways to fix it, and decided that checking for the NULL pointer in str_to_TIME() was the safest - it would take care of other potential buggy calls, if there happen to be any.