Skip to content

Commit 1578128

Browse files
committed
MDEV-18046: Assortment of crashes, assertion failures and ASAN errors in mysql_show_binlog_events
Problem: ======== SHOW BINLOG EVENTS FROM <pos> reports following ASAN error AddressSanitizer: heap-buffer-overflow on address String::append(char const*, unsigned int) Query_log_event::pack_info(Protocol*) Fix: === **Part5: Added check to catch buffer overflow**
1 parent a42ef10 commit 1578128

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sql/log_event.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3815,7 +3815,9 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
38153815

38163816
uint32 max_length= uint32(event_len - ((const char*)(end + db_len + 1) -
38173817
(buf - common_header_len)));
3818-
if (q_len != max_length)
3818+
if (q_len != max_length ||
3819+
(event_len < uint((const char*)(end + db_len + 1) -
3820+
(buf - common_header_len))))
38193821
{
38203822
q_len= 0;
38213823
query= NULL;

0 commit comments

Comments
 (0)