Commit 913f405d authored by Sujatha's avatar Sujatha

MDEV-18046: Assortment of crashes, assertion failures and ASAN errors in mysql_show_binlog_events

Problem:
========
SHOW BINLOG EVENTS FROM <pos> reports following assert when ASAN is enabled.

Rows_log_event::Rows_log_event(const char*, uint,
    const Format_description_log_event*):
Assertion `var_header_len >= 2'

Implemented part of upstream patch.
commit: mysql/mysql-server@a3a497ccf7ecacc900551fb1e47ea4078b45c351

Fix:
===
**Part2: Avoid reading out of buffer limits**
parent a6dd827a
...@@ -9546,7 +9546,14 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len, ...@@ -9546,7 +9546,14 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
which includes length bytes which includes length bytes
*/ */
var_header_len= uint2korr(post_start); var_header_len= uint2korr(post_start);
assert(var_header_len >= 2); /* Check length and also avoid out of buffer read */
if (var_header_len < 2 ||
event_len < static_cast<unsigned int>(var_header_len +
(post_start - buf)))
{
m_cols.bitmap= 0;
DBUG_VOID_RETURN;
}
var_header_len-= 2; var_header_len-= 2;
/* Iterate over var-len header, extracting 'chunks' */ /* Iterate over var-len header, extracting 'chunks' */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment