mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-19235 MariaDB Server compiled for 128 Indexes crashes at startup
With MAX_INDEXIES=64(default), key_map=Bitmap<64> is just a wrapper around ulonglong and thus "trivial" (can be bzero-ed, or memcpy-ed, and stays valid still) With MAX_INDEXES=128, key_map = Bitmap<128> is not a "trivial" type anymore. The implementation uses MY_BITMAP, and MY_BITMAP contains pointers which make Bitmap invalid, when it is memcpy-ed/bzero-ed. The problem in 10.4 is that there are many new key_map members, inside TABLE or KEY, and those are often memcopied and bzeroed The fix makes Bitmap "trivial", by inlining most of MY_BITMAP functionality. pointers/heap allocations are not used anymore.
This commit is contained in:
@@ -122,6 +122,14 @@ static inline uint64 my_set_bits(int n)
|
||||
return (((1ULL << (n - 1)) - 1) << 1) | 1;
|
||||
}
|
||||
|
||||
/* Create a mask of the significant bits for the last byte (1,3,7,..255) */
|
||||
static inline uchar last_byte_mask(uint bits)
|
||||
{
|
||||
/* Get the number of used bits-1 (0..7) in the last byte */
|
||||
unsigned int const used = (bits - 1U) & 7U;
|
||||
/* Return bitmask for the significant bits */
|
||||
return ((2U << used) - 1);
|
||||
}
|
||||
C_MODE_END
|
||||
|
||||
#endif /* MY_BIT_INCLUDED */
|
||||
|
Reference in New Issue
Block a user