MDEV-38463: subtraction of unsigned offset ... overflowed

row_log_table_apply_ops(), row_log_apply_ops(): When switching
buffers, do not subtract addresses of unrelated buffers, but
simply set mrec_end relative to mrec. This makes the code more
readable and will avoid a runtime error from clang -fsanitize=undefined
depending on what kind of addresses are being returned by
row_log_block_allocate().
This commit is contained in:
Marko Mäkelä 2026-01-02 10:25:13 +02:00
commit 37dce6b547

View file

@ -2806,10 +2806,10 @@ process_next_block:
ut_ad(0);
goto unexpected_eof;
} else {
memcpy(index->online_log->head.buf, mrec,
ulint(mrec_end - mrec));
mrec_end -= ulint(mrec - index->online_log->head.buf);
const size_t s = size_t(mrec_end - mrec);
memcpy(index->online_log->head.buf, mrec, s);
mrec = index->online_log->head.buf;
mrec_end = mrec + s;
goto process_next_block;
}
}
@ -3698,10 +3698,10 @@ process_next_block:
ut_ad(0);
goto unexpected_eof;
} else {
memcpy(index->online_log->head.buf, mrec,
ulint(mrec_end - mrec));
mrec_end -= ulint(mrec - index->online_log->head.buf);
const size_t s = size_t(mrec_end - mrec);
memcpy(index->online_log->head.buf, mrec, s);
mrec = index->online_log->head.buf;
mrec_end = mrec + s;
goto process_next_block;
}
}