mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-29152: Assertion failed ... upon TO_CHAR with wrong argument
Item_func_tochar::check_arguments() didn't check if its arguments each had one column. Failing to make this check and proceeding would eventually cause either an assertion failure or the execution would reach "MY_ASSERT_UNREACHABLE();" which would produce a crash with a misleading stack trace. * Fixed Item_func_tochar::check_arguments() to do the required check. * Also fixed MY_ASSERT_UNREACHABLE() to terminate the program. Just "executing" __builtin_unreachable() used to cause "undefined results", which in my experience was a crash with corrupted stack trace.
This commit is contained in:
@@ -40,7 +40,15 @@
|
||||
/* GNU C/C++ */
|
||||
#if defined __GNUC__
|
||||
# define MY_ALIGN_EXT
|
||||
# define MY_ASSERT_UNREACHABLE() __builtin_unreachable()
|
||||
|
||||
/*
|
||||
__builtin_unreachable() removes the "statement may fall through" warning-as-
|
||||
error when MY_ASSERT_UNREACHABLE() is used in "case xxx:" in switch (...)
|
||||
statements.
|
||||
abort() is there to prevent the execution from reaching the
|
||||
__builtin_unreachable() as this may cause misleading stack traces.
|
||||
*/
|
||||
# define MY_ASSERT_UNREACHABLE() { abort(); __builtin_unreachable(); }
|
||||
|
||||
/* Microsoft Visual C++ */
|
||||
#elif defined _MSC_VER
|
||||
@@ -88,7 +96,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef MY_ASSERT_UNREACHABLE
|
||||
# define MY_ASSERT_UNREACHABLE() do { assert(0); } while (0)
|
||||
# define MY_ASSERT_UNREACHABLE() do { abort(); } while (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user