Bug #83021 Assertion "buf != end" failed
Submitted: 16 Sep 2016 10:02 Modified: 16 Sep 2016 10:12
Reporter: Tomislav Plavcic Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.6.33, 5.5.52 OS:Any
Assigned to: CPU Architecture:Any

[16 Sep 2016 10:02] Tomislav Plavcic
Description:
Visible on 5.6.33 debug build but not on 5.7.15.

Version: '5.6.33-debug'  socket: '/home/tomislav.plavcic/workdir/oracle-mysql-5.6.33-linux-x86_64-debug/socket.sock'  port: 12779  MySQL Community Server (GPL)                                                                        
mysqld: /home/tomislav.plavcic/workdir/mysql-server/strings/decimal.c:2247: decimal_mul: Assertion `buf != end' failed.                                                                                                                
10:01:24 UTC - mysqld got signal 6 ;

GDB:
#0  0x00007feb94851741 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
#1  0x0000000000a97646 in my_write_core (sig=6) at /home/tomislav.plavcic/workdir/mysql-server/mysys/stacktrace.c:422
#2  0x000000000072897c in handle_fatal_signal (sig=6) at /home/tomislav.plavcic/workdir/mysql-server/sql/signal_handler.cc:230
#3  <signal handler called>
#4  0x00007feb932395f7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007feb9323ace8 in __GI_abort () at abort.c:90
#6  0x00007feb93232566 in __assert_fail_base (fmt=0x7feb93382ce8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x106e4dd "buf != end", file=file@entry=0x106e140 "/home/tomislav.plavcic/workdir/mysql-server/strings/decimal.c", line=line@entry=2247, function=function@entry=0x106e712 <__PRETTY_FUNCTION__.10622> "decimal_mul") at assert.c:92
#7  0x00007feb93232612 in __GI___assert_fail (assertion=0x106e4dd "buf != end", file=0x106e140 "/home/tomislav.plavcic/workdir/mysql-server/strings/decimal.c", line=2247, function=0x106e712 <__PRETTY_FUNCTION__.10622> "decimal_mul") at assert.c:101
#8  0x0000000000e25e9d in decimal_mul (from1=0x7feb94e4dad0, from2=0x7feb94e4db20, to=0x7feb94e4dc10) at /home/tomislav.plavcic/workdir/mysql-server/strings/decimal.c:2247
#9  0x00000000006bf2cd in my_decimal_mul (mask=28, res=0x7feb94e4dc10, a=0x7feb94e4dad0, b=0x7feb94e4db20) at /home/tomislav.plavcic/workdir/mysql-server/sql/my_decimal.h:477
#10 0x00000000006acc1c in Item_func_mul::decimal_op (this=0x7feb6001fa50, decimal_value=0x7feb94e4dc10) at /home/tomislav.plavcic/workdir/mysql-server/sql/item_func.cc:1645
#11 0x00000000006aacc7 in Item_func_numhybrid::val_decimal (this=0x7feb6001fa50, decimal_value=0x7feb94e4dc10) at /home/tomislav.plavcic/workdir/mysql-server/sql/item_func.cc:1032
#12 0x00000000006adfcc in Item_func_mod::decimal_op (this=0x7feb6001fe10, decimal_value=0x7feb94e4dd00) at /home/tomislav.plavcic/workdir/mysql-server/sql/item_func.cc:1901
#13 0x00000000006aa3c5 in Item_func_numhybrid::val_str (this=0x7feb6001fe10, str=0x7feb94e4de50) at /home/tomislav.plavcic/workdir/mysql-server/sql/item_func.cc:891
#14 0x0000000000662a17 in Item::send (this=0x7feb6001fe10, protocol=0x7feb6cb484d8, buffer=0x7feb94e4de50) at /home/tomislav.plavcic/workdir/mysql-server/sql/item.cc:6898
#15 0x00000000007207dc in Protocol::send_result_set_row (this=0x7feb6cb484d8, row_items=0x7feb6cb4a5f0) at /home/tomislav.plavcic/workdir/mysql-server/sql/protocol.cc:844
#16 0x000000000078d887 in select_send::send_data (this=0x7feb6001ffd0, items=...) at /home/tomislav.plavcic/workdir/mysql-server/sql/sql_class.cc:2538
#17 0x00000000007a31d2 in JOIN::exec (this=0x7feb6001fff8) at /home/tomislav.plavcic/workdir/mysql-server/sql/sql_executor.cc:151
#18 0x0000000000803327 in mysql_execute_select (thd=0x7feb6cb48000, select_lex=0x7feb6cb4a4d0, free_join=true) at /home/tomislav.plavcic/workdir/mysql-server/sql/sql_select.cc:1101
#19 0x0000000000803619 in mysql_select (thd=0x7feb6cb48000, tables=0x0, wild_num=0, fields=..., conds=0x0, order=0x7feb6cb4a698, group=0x7feb6cb4a5d0, having=0x0, select_options=2147748608, result=0x7feb6001ffd0, unit=0x7feb6cb49e88, select_lex=0x7feb6cb4a4d0) at /home/tomislav.plavcic/workdir/mysql-server/sql/sql_select.cc:1222
#20 0x0000000000801712 in handle_select (thd=0x7feb6cb48000, result=0x7feb6001ffd0, setup_tables_done_option=0) at /home/tomislav.plavcic/workdir/mysql-server/sql/sql_select.cc:110
#21 0x00000000007db952 in execute_sqlcom_select (thd=0x7feb6cb48000, all_tables=0x0) at /home/tomislav.plavcic/workdir/mysql-server/sql/sql_parse.cc:5133
#22 0x00000000007d484d in mysql_execute_command (thd=0x7feb6cb48000) at /home/tomislav.plavcic/workdir/mysql-server/sql/sql_parse.cc:2655
#23 0x00000000007de45e in mysql_parse (thd=0x7feb6cb48000, rawbuf=0x7feb6001f010 "SELECT (-325 / 6934) * (-309 DIV CEIL(-44) / 567) % (679 MOD -902)", length=66, parser_state=0x7feb94e4f6a0) at /home/tomislav.plavcic/workdir/mysql-server/sql/sql_parse.cc:6385
#24 0x00000000007d18a3 in dispatch_command (command=COM_QUERY, thd=0x7feb6cb48000, packet=0x7feb6cb61001 "", packet_length=66) at /home/tomislav.plavcic/workdir/mysql-server/sql/sql_parse.cc:1339
#25 0x00000000007d09b6 in do_command (thd=0x7feb6cb48000) at /home/tomislav.plavcic/workdir/mysql-server/sql/sql_parse.cc:1036
#26 0x00000000007983ac in do_handle_one_connection (thd_arg=0x7feb6cb48000) at /home/tomislav.plavcic/workdir/mysql-server/sql/sql_connect.cc:982
#27 0x0000000000797ec2 in handle_one_connection (arg=0x7feb6cb48000) at /home/tomislav.plavcic/workdir/mysql-server/sql/sql_connect.cc:898
#28 0x0000000000dc4921 in pfs_spawn_thread (arg=0x7feb787476a0) at /home/tomislav.plavcic/workdir/mysql-server/storage/perfschema/pfs.cc:1860
#29 0x00007feb9484cdc5 in start_thread (arg=0x7feb94e50700) at pthread_create.c:308
#30 0x00007feb932faced in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

How to repeat:
SET @@SESSION.div_precision_increment=-1125899906842624;
SELECT (-325 / 6934) * (-309 DIV CEIL(-44) / 567) % (679 MOD -902);
[16 Sep 2016 10:12] MySQL Verification Team
Hello Tomislav,

Thank you for the report.
Observed that 5.6.33 debug build is affected.

Thanks,
Umesh
[16 Sep 2016 10:15] MySQL Verification Team
-- 5.5.52 debug build also affected