[MySQL Bug]Bug#13986705 CRASH IN GET_INTERVAL_VALUE() WITH DATE CALCULATION WITH UTF32 INTERVALS

upstream link:
test case:
select space(date_add(101, INTERVAL (CAST(CHAR(‘1’ USING utf16) AS CHAR(1)))hour_second))
只影响5.5

根据crash的backtrace
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff4643700 (LWP 5874)]
0x0000000000706602 in get_interval_value (args=0x7fff84004e98, int_type=INTERVAL_HOUR_SECOND, str_value=<value optimized out>, interval=0x7ffff4640c40)
    at /u01/project/PS5518/trunk/Percona-Server-5.5.18/sql/item_timefunc.cc:1460
1460        while (str != end && my_isspace(cs,*str))

在my_isspace(cs,*str)这里crash,my_isspace是一个宏:
#define my_isspace(s, c)  (((s)->ctype+1)[(uchar) (c)] & _MY_SPC)
而对于utf16(my_charset_utf16_general_ci)或者utf32(my_charset_utf32_general_ci)类型的字符集,ctype为NULL(ctype-ucs2.c)
因此这里直接导致段错误。


Solution: convert input to ASCII before parsing,
and use the character set of the returned ASCII string. 
.

Post Footer automatically generated by wp-posturl plugin for wordpress.


Comments

Leave a Reply

Your email address will not be published. Name and email are required


Current month ye@r day *