MDEV-37060: Don’t check Encrpyted Server IDs in mariadb-binlog

MSAN found that `mariadb-binlog --force-read` checks encrypted events
too for whether `--do-server-ids`/`ignore-server-ids` includes any of
their (uninitialized) Server IDs.
This fix extends the condition to stop skipping `UNKNOWN_EVENT`s by
Server ID in addition to `ROTATE_EVENT`s.

An alternative solution is to zero-initialize the `server_id` field of
`Unknown_log_event` or even its supertype, `Log_event`.
Though to avoid hiding `use-of-uninitialized-value` mistakes in the
future, leaving unset fields uninitialized is more assured;
not to mention the potential of ID 0 still in use.

Reviewed-by: Brandon Nesterenko <brandon.nesterenko@mariadb.com>
Acked-by: Daniel Black <daniel@mariadb.org>
This commit is contained in:
ParadoxV5 2025-07-17 19:52:27 -06:00 committed by Daniel Black
parent 687c8be813
commit 76c79d4fd8

View File

@ -1201,9 +1201,16 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
binlog, even if they have a server_id. Also, we have to read
the format_description event so that we can parse subsequent
events.
Don't skip Unknown events either since we don't know their `server_id`s.
*/
if (ev_type != ROTATE_EVENT && is_server_id_excluded(ev->server_id))
goto end;
switch (ev_type) {
case ROTATE_EVENT:
case UNKNOWN_EVENT:
break;
default:
if (is_server_id_excluded(ev->server_id))
goto end;
}
}
if ((ev->when >= stop_datetime)
|| (pos >= stop_position_mot))