Commit c74609b1 authored by Christopher Powers's avatar Christopher Powers

Bug #48739 MySQL crashes on specific INTERVAL in select query

Fixed crash caused by x64 int/long incompatibility introduced
in Bug #29125.

sql/item_timefunc.cc:
  Fixed crash caused by int/long incompatibility on x64 systems.
  
  Changed two "uint" casts and a "long" declartion to "int" in order to
  ensure that the integer sign is preserved.
  
  See Bug #48739 for details.
parent 2f78abd2
......@@ -386,7 +386,7 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
if (tmp - val > 6)
tmp= (char*) val + 6;
l_time->second_part= (int) my_strtoll10(val, &tmp, &error);
frac_part= 6 - (uint) (tmp - val);
frac_part= 6 - (int) (tmp - val);
if (frac_part > 0)
l_time->second_part*= (ulong) log_10_int[frac_part];
val= tmp;
......@@ -876,9 +876,9 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs,
value= value*LL(10) + (longlong) (*str - '0');
if (transform_msec && i == count - 1) // microseconds always last
{
long msec_length= 6 - (uint) (str - start);
int msec_length= 6 - (int)(str - start);
if (msec_length > 0)
value*= (long) log_10_int[msec_length];
value*= (long)log_10_int[msec_length];
}
values[i]= value;
while (str != end && !my_isdigit(cs,*str))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment