Bug #83608 Assertion `m_cpp_buf <= pt r && ptr <= m_cpp_buf + m_buf_length' failed
Submitted: 29 Oct 2016 10:51 Modified: 29 Oct 2016 12:12
Reporter: Elena Stepanova Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Parser Severity:S3 (Non-critical)
Version:5.5, 5.6, 5.7 OS:Any
Assigned to: CPU Architecture:Any

[29 Oct 2016 10:51] Elena Stepanova
Description:
mysqld: /data/src/mysql-5.7/sql/sql_lex.cc:302: void Lex_input_stream::body_utf8_append(const char*, const char*): Assertion `m_cpp_buf <= ptr && ptr <= m_cpp_buf + m_buf_length' failed.
10:48:55 UTC - mysqld got signal 6 ;

#7  0x00007f6166c37312 in __GI___assert_fail (assertion=0x1fd19c0 "m_cpp_buf <= ptr && ptr <= m_cpp_buf + m_buf_length", file=0x1fd18f8 "/data/src/mysql-5.7/sql/sql_lex.cc", line=302, function=0x1fd2800 <Lex_input_stream::body_utf8_append(char const*, char const*)::__PRETTY_FUNCTION__> "void Lex_input_stream::body_utf8_append(const char*, const char*)") at assert.c:101
#8  0x000000000153c5d6 in Lex_input_stream::body_utf8_append (this=0x7f616057b6a8, ptr=0x7f6114e6939e "\217\217\320\061\265\002", end_ptr=0x7f6114e6939e "\217\217\320\061\265\002") at /data/src/mysql-5.7/sql/sql_lex.cc:302
#9  0x000000000153c6e5 in Lex_input_stream::body_utf8_append (this=0x7f616057b6a8, ptr=0x7f6114e6939e "\217\217\320\061\265\002") at /data/src/mysql-5.7/sql/sql_lex.cc:331
#10 0x00000000014bbd3d in sp_head::set_body_end (this=0x7f611400bba0, thd=0x7f611413fb10) at /data/src/mysql-5.7/sql/sp_head.cc:367
#11 0x00000000014b8be3 in sp_finish_parsing (thd=0x7f611413fb10) at /data/src/mysql-5.7/sql/sp.cc:2424
#12 0x00000000016ce7da in MYSQLparse (YYTHD=0x7f611413fb10) at /data/src/mysql-5.7/sql/sql_yacc.yy:15083
#13 0x000000000157e18c in parse_sql (thd=0x7f611413fb10, parser_state=0x7f616057b6a0, creation_ctx=0x0) at /data/src/mysql-5.7/sql/sql_parse.cc:7089
#14 0x000000000157ad38 in mysql_parse (thd=0x7f611413fb10, parser_state=0x7f616057b6a0) at /data/src/mysql-5.7/sql/sql_parse.cc:5454
#15 0x00000000015709ba in dispatch_command (thd=0x7f611413fb10, com_data=0x7f616057bdf0, command=COM_QUERY) at /data/src/mysql-5.7/sql/sql_parse.cc:1427
#16 0x000000000156f940 in do_command (thd=0x7f611413fb10) at /data/src/mysql-5.7/sql/sql_parse.cc:995
#17 0x000000000169a0f4 in handle_connection (arg=0x40b8de0) at /data/src/mysql-5.7/sql/conn_handler/connection_handler_per_thread.cc:300
#18 0x00000000018ca256 in pfs_spawn_thread (arg=0x4064c60) at /data/src/mysql-5.7/storage/perfschema/pfs.cc:2188
#19 0x00007f616822e0a4 in start_thread (arg=0x7f616057c700) at pthread_create.c:309
#20 0x00007f6166cf187d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

How to repeat:
drop table if exists t1;
create table t1 (id int);
create trigger tr AFTER DELETE ON t1 FOR EACH ROW SET @a = 1\;;
[29 Oct 2016 12:12] MySQL Verification Team
Interesting report,  thanks.

Version: '8.0.1-dmr-debug' (Built on 2016/10/27)
Assertion failed: m_cpp_buf <= ptr && ptr <= m_cpp_buf + m_buf_length, file sql_lex.cc, line 329
abort() has been called
12:10:07 UTC - mysqld got exception 0x80000003 ;

mysqld-debug.exe!my_sigabrt_handler()[my_thr_init.cc:474]
mysqld-debug.exe!raise()[signal.cpp:522]
mysqld-debug.exe!abort()[abort.cpp:71]
mysqld-debug.exe!common_assert_to_stderr_direct()[assert.cpp:124]
mysqld-debug.exe!common_assert_to_stderr<wchar_t>()[assert.cpp:142]
mysqld-debug.exe!common_assert<wchar_t>()[assert.cpp:383]
mysqld-debug.exe!_wassert()[assert.cpp:405]
mysqld-debug.exe!Lex_input_stream::body_utf8_append()[sql_lex.cc:329]
mysqld-debug.exe!Lex_input_stream::body_utf8_append()[sql_lex.cc:359]
mysqld-debug.exe!sp_head::set_body_end()[sp_head.cc:1840]
mysqld-debug.exe!sp_finish_parsing()[sp.cc:2175]
mysqld-debug.exe!MYSQLparse()[sql_yacc.yy:14938]
mysqld-debug.exe!parse_sql()[sql_parse.cc:6928]
mysqld-debug.exe!mysql_parse()[sql_parse.cc:5193]
mysqld-debug.exe!dispatch_command()[sql_parse.cc:1516]
mysqld-debug.exe!do_command()[sql_parse.cc:1107]
mysqld-debug.exe!handle_connection()[connection_handler_per_thread.cc:323]
mysqld-debug.exe!pfs_spawn_thread()[pfs.cc:2365]
mysqld-debug.exe!win_thread_start()[my_thread.cc:41]
mysqld-debug.exe!invoke_thread_procedure()[thread.cpp:92]
mysqld-debug.exe!thread_start<unsigned int (__cdecl*)(void * __ptr64)>()[thread.cpp:115]

Query (195305b0): create trigger tr AFTER DELETE ON t1 FOR EACH ROW SET @a = 1\
[29 Oct 2016 12:15] MySQL Verification Team
reminds me of similar old bug,  fixed in 5.6.9
Bug 14788443 - ASSERTION FAILED: M_CPP_BUF <= PTR && PTR <= M_CPP_BUF + M_BUF_LENGTH