Skip to content

Commit 07be7a6

Browse files
committed
MDEV-37782: Assertion buf < end failed in mtr_t::encrypt()
mtr_t::encrypt(): Handle the special case that the type and length are at the very end of a m_log snippet, followed by another snippet that contains the rest of the payload. It should be noted that in log_decrypt_mtr(), the mini-transaction consists of a single contiguous memory area. Furthermore, for the initial log record in mtr_t::encrypt() at least the page identifier will always be included in the initial m_log snippet. Tested by: Alice Sherepa
1 parent d0afe4b commit 07be7a6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

storage/innobase/log/log0crypt.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -670,8 +670,11 @@ ATTRIBUTE_NOINLINE size_t mtr_t::encrypt() noexcept
670670
{
671671
while (buf + rlen > end)
672672
{
673-
rlen-= uint32_t(end - buf);
674-
c.append(buf, end - buf);
673+
if (size_t size= end - buf)
674+
{
675+
rlen-= uint32_t(size);
676+
c.append(buf, size);
677+
}
675678
++i;
676679
ut_ad(i != m_log.end());
677680
buf= i->start();
@@ -690,7 +693,7 @@ ATTRIBUTE_NOINLINE size_t mtr_t::encrypt() noexcept
690693
}
691694

692695
buf= const_cast<byte*>(mtr_t::parse_length(buf, &rlen));
693-
ut_ad(buf < end);
696+
ut_ad(buf <= end);
694697
}
695698
}
696699

0 commit comments

Comments
 (0)