[MDEV-22520] Assertion `gathered_length == thd->lex->comment.length' failed in binlog_defragment Created: 2020-05-10  Updated: 2023-07-01  Resolved: 2020-05-19

Status: Closed
Project: MariaDB Server
Component/s: Replication
Affects Version/s: 10.1, 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.5.4, 10.1.46, 10.2.33, 10.3.24, 10.4.14

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Andrei Elkin
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-31598 UBSAN: runtime error: null pointer pa... Open

 Description   

SET @a= '42';
--error ER_BASE64_DECODE_ERROR
BINLOG @a, @a;

10.4 6adb0d2f

mysqld: /data/src/10.4/sql/sql_binlog.cc:164: int binlog_defragment(THD*): Assertion `gathered_length == thd->lex->comment.length' failed.
200510 16:09:29 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f4356031f12 in __GI___assert_fail (assertion=0x5619ce0cff48 "gathered_length == thd->lex->comment.length", file=0x5619ce0cff78 "/data/src/10.4/sql/sql_binlog.cc", line=164, function=0x5619ce0d0100 <binlog_defragment(THD*)::__PRETTY_FUNCTION__> "int binlog_defragment(THD*)") at assert.c:101
#8  0x00005619cd4f6445 in binlog_defragment (thd=0x7f42f4000af0) at /data/src/10.4/sql/sql_binlog.cc:164
#9  0x00005619cd4f674e in mysql_client_binlog_statement (thd=0x7f42f4000af0) at /data/src/10.4/sql/sql_binlog.cc:235
#10 0x00005619cd3ae05a in mysql_execute_command (thd=0x7f42f4000af0) at /data/src/10.4/sql/sql_parse.cc:6020
#11 0x00005619cd3b3ad3 in mysql_parse (thd=0x7f42f4000af0, rawbuf=0x7f42f4012f88 "BINLOG @a, @a", length=13, parser_state=0x7f43480c95c0, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7900
#12 0x00005619cd3a0083 in dispatch_command (command=COM_QUERY, thd=0x7f42f4000af0, packet=0x7f42f414de31 "BINLOG @a, @a", packet_length=13, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
#13 0x00005619cd39e825 in do_command (thd=0x7f42f4000af0) at /data/src/10.4/sql/sql_parse.cc:1360
#14 0x00005619cd526394 in do_handle_one_connection (connect=0x5619d05bdfc0) at /data/src/10.4/sql/sql_connect.cc:1412
#15 0x00005619cd5260e3 in handle_one_connection (arg=0x5619d05bdfc0) at /data/src/10.4/sql/sql_connect.cc:1316
#16 0x00007f4357fba4a4 in start_thread (arg=0x7f43480ca700) at pthread_create.c:456
#17 0x00007f43560eed0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Reproducible on 10.1-10.5 debug builds.
Non-debug builds return ER_BASE64_DECODE_ERROR as they probably should.



 Comments   
Comment by Andrei Elkin [ 2020-05-15 ]

Hello, Sujatha!

The patch is pretty straightforward, I hope you'll review it quickly.
Thank you!

Andrei

Comment by Sujatha Sivakumar (Inactive) [ 2020-05-18 ]

Hello Andrei,

Thank you for the fix.
Changes look good.

Generated at Thu Feb 08 09:15:21 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.