mirror of
https://github.com/MariaDB/server.git
synced 2025-03-26 08:58:40 +01:00
MDEV-35687 Various UBSAN function-type-mismatch debug_sync and myisam
storage/maria/ma_open.c:352:7: runtime error: call to function debug_sync(THD*, char const*, unsigned long) through pointer to incorrect function type 'void (*)(void *, const char *, unsigned long)' The THD argument is a void *. Because of the way myisam is .c files the function prototype is mismatched. As Marko pointed out the MYSQL_THD is declared as void * in C. Thanks Jimmy Hú for noting that struct THD is the equalivalant in C to the class THD. The C NULL was also different to the C++ nullptr. Corrected the definations of MYSQL_THD and DEBUG_SYNC_C to be C and C++ compatible.
This commit is contained in:
parent
6e86fe0063
commit
04408fff40
2 changed files with 6 additions and 1 deletions
include/mysql
|
@ -44,7 +44,8 @@ class THD;
|
|||
class Item;
|
||||
#define MYSQL_THD THD*
|
||||
#else
|
||||
#define MYSQL_THD void*
|
||||
struct THD;
|
||||
typedef struct THD* MYSQL_THD;
|
||||
#endif
|
||||
|
||||
typedef char my_bool;
|
||||
|
|
|
@ -351,7 +351,11 @@ extern void (*debug_sync_C_callback_ptr)(MYSQL_THD, const char *, size_t);
|
|||
#endif /* defined(ENABLED_DEBUG_SYNC) */
|
||||
|
||||
/* compatibility macro */
|
||||
#ifdef __cplusplus
|
||||
#define DEBUG_SYNC_C(name) DEBUG_SYNC(nullptr, name)
|
||||
#else
|
||||
#define DEBUG_SYNC_C(name) DEBUG_SYNC(NULL, name)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue