Commit 53e8dc26 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 e3d0b6d7
...@@ -379,7 +379,7 @@ static bool extract_date_time(DATE_TIME_FORMAT *format, ...@@ -379,7 +379,7 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
if (tmp - val > 6) if (tmp - val > 6)
tmp= (char*) val + 6; tmp= (char*) val + 6;
l_time->second_part= (int) my_strtoll10(val, &tmp, &error); 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) if (frac_part > 0)
l_time->second_part*= (ulong) log_10_int[frac_part]; l_time->second_part*= (ulong) log_10_int[frac_part];
val= tmp; val= tmp;
...@@ -870,7 +870,7 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs, ...@@ -870,7 +870,7 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs,
value= value*LL(10) + (longlong) (*str - '0'); value= value*LL(10) + (longlong) (*str - '0');
if (transform_msec && i == count - 1) // microseconds always last if (transform_msec && i == count - 1) // microseconds always last
{ {
long msec_length= 6 - (uint) (str - start); long msec_length= 6 - (int) (str - start);
if (msec_length > 0) if (msec_length > 0)
value*= (long) log_10_int[msec_length]; value*= (long) log_10_int[msec_length];
} }
......
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