Details
-
Bug
-
Status: Approved (View Workflow)
-
Blocker
-
Resolution: Unresolved
-
13.0.1
-
None
-
MariaDB Server 13.0.1 (tag mariadb-13.0.1); also present on main tip. Confirmed by source review on macOS arm64.
-
Can result in hang or crash
-
Q3/2026 Replic. Development
Description
In `sql/slave.cc`, `queue_event()` uses a fixed stack buffer for fake ROTATE checksum special-cases:
```c
uchar rot_buf[LOG_EVENT_HEADER_LEN + ROTATE_HEADER_LEN + FN_REFLEN]; /* 539 bytes */
```
On the RSC_1 path (fake Rotate, master checksum OFF, relay-log checksum ON):
```c
if (uint4korr(&buf[0]) == 0 && checksum_alg == BINLOG_CHECKSUM_ALG_OFF &&
mi->rli.relay_log.relay_log_checksum_alg != BINLOG_CHECKSUM_ALG_OFF)
```
There is no check that `event_len` fits in `rot_buf`.
`Rotate_log_event` ctor caps `ident_len` to `FN_REFLEN-1`, but RSC still uses the original `event_len`. A max-sized rotate already makes the final `int4store` write past the 539-byte buffer; a larger fake ROTATE overflows further via `memcpy`.
RSC_2 (strip checksum) has the same missing bound on `memcpy(rot_buf, buf, event_len)`.
-
- Impact
Slave IO thread can stack-overflow / crash when queuing a crafted fake ROTATE under checksum policy mismatch.
- Impact
Attachments
Issue Links
- relates to
-
MDEV-39689 Slave Overflow on Malformed Table_map_log_event
-
- Closed
-