Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.6
-
None
Description
IS_IPV4_COMPAT is called 8 times in type_inet.type_inet6. 4 initially without casting varchar to binary, and then 4 casting to binary:
mysql-test/mtr --gdb='b Inet6::is_v4compat; r;p *this;c;p *this;c; p *this;c; p *this;c; p *this;c; p *this;' type_inet.type_inet6 |
|
Thread 6 "mariadbd" hit Breakpoint 1, Inet6::is_v4compat (this=0x7ffff1add130) at /home/dan/repos/mariadb-server-10.6/plugin/type_inet/sql_type_inet.h:222
|
222 return IN6_IS_ADDR_V4COMPAT((struct in6_addr *) m_buffer);
|
$1 = {m_buffer = '\000' <repeats 12 times>, "\300\250\000\001"}
|
|
Thread 6 "mariadbd" hit Breakpoint 1, Inet6::is_v4compat (this=0x7ffff1add130) at /home/dan/repos/mariadb-server-10.6/plugin/type_inet/sql_type_inet.h:222
|
222 return IN6_IS_ADDR_V4COMPAT((struct in6_addr *) m_buffer);
|
$2 = {m_buffer = '\000' <repeats 12 times>, "\300\250\no"}
|
|
Thread 6 "mariadbd" hit Breakpoint 1, Inet6::is_v4compat (this=0x7ffff1add130) at /home/dan/repos/mariadb-server-10.6/plugin/type_inet/sql_type_inet.h:222
|
222 return IN6_IS_ADDR_V4COMPAT((struct in6_addr *) m_buffer);
|
$3 = {m_buffer = "\000\000\000\000\000\000\000\000\000\000\377\377\n\n\000\001"}
|
|
Thread 6 "mariadbd" hit Breakpoint 1, Inet6::is_v4compat (this=0x7ffff1add130) at /home/dan/repos/mariadb-server-10.6/plugin/type_inet/sql_type_inet.h:222
|
222 return IN6_IS_ADDR_V4COMPAT((struct in6_addr *) m_buffer);
|
$4 = {m_buffer = "\000\000\000\000\000\000\000\000\000\000\377\377\300\250\000\001"}
|
|
Thread 6 "mariadbd" hit Breakpoint 1, Inet6::is_v4compat (this=0x7ffff1add130) at /home/dan/repos/mariadb-server-10.6/plugin/type_inet/sql_type_inet.h:222
|
222 return IN6_IS_ADDR_V4COMPAT((struct in6_addr *) m_buffer);
|
$5 = {m_buffer = "::192.168.10.111"}
|
|
Thread 6 "mariadbd" hit Breakpoint 1, Inet6::is_v4compat (this=0x7ffff1add130) at /home/dan/repos/mariadb-server-10.6/plugin/type_inet/sql_type_inet.h:222
|
222 return IN6_IS_ADDR_V4COMPAT((struct in6_addr *) m_buffer);
|
$6 = {m_buffer = "::ffff:10.10.0.1"}
|
|
The first 4 seem to encode the buffer correctly. The next 2 (not 4), have a text representation in the m_buffer. Given Inet6::is_v4compat is implemented with IN6_IS_ADDR_V4COMPAT, the existence of a text encoded IP in the buffer is incorrect.
From the type_inet.type_inet6.result, are the results meant to be the same:
SELECT id, length(a), a, IS_IPV4_COMPAT(a) FROM t1 ORDER BY id;
|
id length(a) a IS_IPV4_COMPAT(a)
|
1 13 ::192.168.0.1 1
|
2 16 ::192.168.10.111 1
|
3 16 ::ffff:10.10.0.1 0
|
4 18 ::ffff:192.168.0.1 0
|
...
|
SELECT id, length(a), a, IS_IPV4_COMPAT(BINARY a) FROM t1 ORDER BY id;
|
id length(a) a IS_IPV4_COMPAT(BINARY a)
|
1 13 ::192.168.0.1 0
|
2 16 ::192.168.10.111 0
|
3 16 ::ffff:10.10.0.1 0
|
4 18 ::ffff:192.168.0.1 0
|
Warnings:
|
Warning 1292 Incorrect inet6 value: '::192.168.0.1'
|
Warning 1292 Incorrect inet6 value: '::ffff:192.168.0.1'
|
Same difference on IS_IPV4_MAPPED.