mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
Fix a UBSAN runtime error on MacOSX.
When running on MacOSX with `-DWITH_UBSAN` I get the following error at runtime: ``` 2026-10-23 13:28:31 0 [Note] InnoDB: Number of transaction pools: 1 2026-10-23 13:28:31 0 [Note] InnoDB: Using generic crc32 instructions 2026-10-23 13:28:31 0 [Note] InnoDB: innodb_buffer_pool_size_max=8388608m, innodb_buffer_pool_size=128m 2026-10-23 13:28:31 0 [Note] InnoDB: Completed initialization of buffer pool 2026-10-23 13:28:31 0 [Note] InnoDB: End of log at LSN=51660 2026-10-23 13:28:31 0 [Note] InnoDB: 128 rollback segments are active. 2026-10-23 13:28:31 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1" 2026-10-23 13:28:31 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ... 2026-10-23 13:28:31 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB. 2026-10-23 13:28:31 0 [Note] InnoDB: log sequence number 51660; transaction id 14 2026-10-23 13:28:31 0 [Note] InnoDB: Loading buffer pool(s) from /Users/gkodinov/dev/mdev-35715/bld/x/ib_buffer_pool 2026-10-23 13:28:31 0 [Note] Plugin 'FEEDBACK' is disabled. /Users/gkodinov/dev/mdev-35715/mysys/my_stack.c:74:38: runtime error: addition of unsigned offset to 0x00016bcc0050 overflowed to 0x00016b1c2050 ``` This is caused by STACK_DIRECTION being negative and, when multiplied by an unsigned, being converted to a large unsigned before the multiplication. Change stack_size type from size_t to ssize_t to avoid this.
This commit is contained in:
committed by
Georgi (Joro) Kodinov
parent
16aa5d6f4a
commit
62f972f324
@@ -71,5 +71,5 @@ extern void my_get_stack_bounds(void **stack_start, void **stack_end,
|
||||
*stack_start= my_get_stack_pointer(fallback_stack_start);
|
||||
stack_size= (fallback_stack_size -
|
||||
MY_MIN(fallback_stack_size, MY_STACK_SAFE_MARGIN));
|
||||
*stack_end= (char *)(*stack_start) + stack_size * STACK_DIRECTION;
|
||||
*stack_end= (char *)(*stack_start) + ((ssize_t)stack_size) * STACK_DIRECTION;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user