mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
Neither the binary-parsing Format Description Event constructor nor the constructor-bypassing `get_checksum_alg()` function validated the content length of the passed event buffer. If they receive an FDE with undersized contents, they would obtain corrupt results from an erronous memory location, if not outright crash the program with that memory error. This commit fixes both sites by adding content length checks. Because the goal is not to solve the existence of two binary parsers, `get_checksum_alg()` receives a check duplicated from the Format Description constructor and is no longer a function that never errors. Note, it is implementation detail that `get_checksum_alg()`’s fix catches the invalidity before any code reaches the parser-contructor’s fix, though the latter would come to effect if we refactor `get_checksum_alg()` away. Reviewed-by: Kristian Nielsen <knielsen@knielsen-hq.org>
161 KiB
161 KiB