1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00
Files
mariadb/mysql-test/main/thread_stack_overrun.test
Vladislav Vaintroub 2be9ba2537 MDEV-37781 ASAN build crashes on deep query with low thread stack
check_stack_overrun() was compiled out under ASAN, so a deeply nested
expression recursed in Item_func::fix_fields() until the stack was
exhausted and the server crashed instead of reporting
ER_STACK_OVERRUN_NEED_MORE.

Since MDEV-34533 (Monty) the stack usage seems to be accounted correctly
under ASAN via my_get_stack_pointer(), so the check seems to works there
too.

Fix:
Remove the #ifndef __SANITIZE_ADDRESS__  guard from check_stack_overrun()

Add a test for ER_STACK_OVERRUN_NEED_MORE
2026-07-07 14:16:35 +03:00

18 lines
640 B
Plaintext

--echo #
--echo # MDEV-37781 ASAN build crashes with low thread stack
--echo #
--source include/not_embedded.inc
# Expression like 1+1+...+1 recurses once per term in fix_fields().
# As each recursion level consumes at least one byte of stack, we use
# @@global.thread_stack terms to have a guaranteed stack overrun
# on any platform, no matter the frame size.
--replace_regex /[0-9]+ bytes used of a [0-9]+ byte stack, and [0-9]+ bytes needed/# bytes used of a # byte stack, and # bytes needed/
--error ER_STACK_OVERRUN_NEED_MORE
EXECUTE IMMEDIATE CONCAT('SELECT 1', REPEAT('+1', @@global.thread_stack));
--echo # End of 10.11 tests