mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge vvagin@bk-internal.mysql.com:/home/bk/mysql-4.1
into eagle.mysql.r18.ru:/home/vva/work/BUG_2310/mysql-4.1
This commit is contained in:
@ -6,10 +6,19 @@ inet_ntoa(inet_aton("255.255.255.255.255.255.255.255"))
|
||||
NULL
|
||||
select inet_aton("255.255.255.255.255"),inet_aton("255.255.1.255"),inet_aton("0.1.255");
|
||||
inet_aton("255.255.255.255.255") inet_aton("255.255.1.255") inet_aton("0.1.255")
|
||||
1099511627775 4294902271 511
|
||||
1099511627775 4294902271 65791
|
||||
select inet_ntoa(1099511627775),inet_ntoa(4294902271),inet_ntoa(511);
|
||||
inet_ntoa(1099511627775) inet_ntoa(4294902271) inet_ntoa(511)
|
||||
NULL 255.255.1.255 0.0.1.255
|
||||
select hex(inet_aton('127'));
|
||||
hex(inet_aton('127'))
|
||||
7F
|
||||
select hex(inet_aton('127.1'));
|
||||
hex(inet_aton('127.1'))
|
||||
7F000001
|
||||
select hex(inet_aton('127.1.1'));
|
||||
hex(inet_aton('127.1.1'))
|
||||
7F010001
|
||||
select length(format('nan', 2)) > 0;
|
||||
length(format('nan', 2)) > 0
|
||||
1
|
||||
|
@ -8,6 +8,10 @@ select inet_ntoa(inet_aton("255.255.255.255.255.255.255.255"));
|
||||
select inet_aton("255.255.255.255.255"),inet_aton("255.255.1.255"),inet_aton("0.1.255");
|
||||
select inet_ntoa(1099511627775),inet_ntoa(4294902271),inet_ntoa(511);
|
||||
|
||||
select hex(inet_aton('127'));
|
||||
select hex(inet_aton('127.1'));
|
||||
select hex(inet_aton('127.1.1'));
|
||||
|
||||
#
|
||||
# Test for core dump with nan
|
||||
#
|
||||
|
@ -2618,6 +2618,7 @@ longlong Item_func_inet_aton::val_int()
|
||||
const char *p,* end;
|
||||
char c = '.'; // we mark c to indicate invalid IP in case length is 0
|
||||
char buff[36];
|
||||
int dot_count= 0;
|
||||
|
||||
String *s,tmp(buff,sizeof(buff),&my_charset_bin);
|
||||
if (!(s = args[0]->val_str(&tmp))) // If null value
|
||||
@ -2636,6 +2637,7 @@ longlong Item_func_inet_aton::val_int()
|
||||
}
|
||||
else if (c == '.')
|
||||
{
|
||||
dot_count++;
|
||||
result= (result << 8) + (ulonglong) byte_result;
|
||||
byte_result = 0;
|
||||
}
|
||||
@ -2643,7 +2645,14 @@ longlong Item_func_inet_aton::val_int()
|
||||
goto err; // Invalid character
|
||||
}
|
||||
if (c != '.') // IP number can't end on '.'
|
||||
{
|
||||
switch (dot_count)
|
||||
{
|
||||
case 1: result<<= 8;
|
||||
case 2: result<<= 8;
|
||||
}
|
||||
return (result << 8) + (ulonglong) byte_result;
|
||||
}
|
||||
|
||||
err:
|
||||
null_value=1;
|
||||
|
Reference in New Issue
Block a user