[MDEV-31521] bzero wipes more bytes than necessary in set_global_from_ddl_log_entry Created: 2023-06-22  Updated: 2023-07-13  Resolved: 2023-07-13

Status: Closed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.6, 10.7, 10.8, 10.9, 10.10, 10.11, 11.0, 11.1
Fix Version/s: 10.8.8, 10.6.15, 10.9.8, 10.10.6

Type: Bug Priority: Blocker
Reporter: Yury Chaikou Assignee: Alexey Botchkov
Resolution: Fixed Votes: 0
Labels: None


 Description   

This call of bzero in ddl_log.cc will use a wrong number of bytes to wipe: "global_ddl_log.name_pos - 18 + 16 + 8" instead of "global_ddl_log.name_pos - (18 + 16 + 8)"

#define DDL_LOG_UUID_POS 18
#define MY_UUID_SIZE 16
#define DDL_LOG_ID_POS DDL_LOG_UUID_POS + MY_UUID_SIZE
#define DDL_LOG_END_POS DDL_LOG_ID_POS + 8
...
  bzero(file_entry_buf+DDL_LOG_END_POS,
        global_ddl_log.name_pos - DDL_LOG_END_POS);

Expressions in #defines should be wrapped in ( ).



 Comments   
Comment by Sergei Golubchik [ 2023-06-22 ]

... or rewritten as static constexpr variables

Generated at Thu Feb 08 10:24:30 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.