Bug #108806 view definer causes mysql crash
Submitted: 18 Oct 2022 4:33 Modified: 18 Oct 2022 12:45
Reporter: Loker C Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:8.0.13 OS:CentOS (7.5.1804)
Assigned to: CPU Architecture:Any
Tags: crash, Definer, SHOW CREATE TABLE, VIEW

[18 Oct 2022 4:33] Loker C
Description:
we create a view like " CREATE ALGORITHM = UNDEFINED DEFINER = `testuser`@`%` SQL SECURITY DEFINER VIEW `testview` AS SELECT xxxxx",it's a very complex view defination.
when we use "show create table testview;" 
mysql suddenly crashes .

error log shows the next

Thread pointer: 0x7f28e4000b50
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7f363bb25d80 thread_stack 0x46000
/home/mysql/8.0.13/bin/mysqld(my_print_stacktrace(unsigned char*, unsigned long)+0x2e) [0x1b9247e]
/home/mysql/8.0.13/bin/mysqld(handle_fatal_signal+0x413) [0xda3173]
/lib64/libpthread.so.0(+0xf6d0) [0x7f3654ee56d0]
/lib64/libc.so.6(+0x16eff1) [0x7f3653360ff1]
/home/mysql/8.0.13/bin/mysqld(acl_getroot(THD*, Security_context*, char*, char*, char*, char const*)+0x3da) [0xdf913a]
/home/mysql/8.0.13/bin/mysqld(TABLE_LIST::prepare_view_security_context(THD*)+0x56) [0xd620a6]
/home/mysql/8.0.13/bin/mysqld(TABLE_LIST::prepare_security(THD*)+0x2a) [0xd6225a]
/home/mysql/8.0.13/bin/mysqld(parse_view_definition(THD*, TABLE_LIST*)+0xdc7) [0xd4c6e7]
/home/mysql/8.0.13/bin/mysqld(open_table(THD*, TABLE_LIST*, Open_table_context*)+0xb2a) [0xc3bb7a]
/home/mysql/8.0.13/bin/mysqld(open_tables(THD*, TABLE_LIST**, unsigned int*, unsigned int, Prelocking_strategy*)+0x4cc) [0xc4161c]
/home/mysql/8.0.13/bin/mysqld(mysqld_show_create(THD*, TABLE_LIST*)+0x176) [0xcf77a6]
/home/mysql/8.0.13/bin/mysqld(mysql_execute_command(THD*, bool)+0x20c8) [0xc98ad8]
/home/mysql/8.0.13/bin/mysqld(mysql_parse(THD*, Parser_state*, bool)+0x33f) [0xc9afef]
/home/mysql/8.0.13/bin/mysqld(dispatch_command(THD*, COM_DATA const*, enum_server_command)+0x2b4b) [0xc9dfab]
/home/mysql/8.0.13/bin/mysqld(do_command(THD*)+0x179) [0xc9ea79]
/home/mysql/8.0.13/bin/mysqld() [0xd96010]
/home/mysql/8.0.13/bin/mysqld() [0x201e19f]
/lib64/libpthread.so.0(+0x7e25) [0x7f3654edde25]

How to repeat:
we change the definer as "root@localhost",and mysql doesn't crash when we use "show create table testview".

but if only wo use other definer,mysql will crash.

i'm sorry i can't provide the view defination  because of the company privacy.
[18 Oct 2022 12:45] MySQL Verification Team
Hi Mr. C,

Thank you for taking the time to report a problem.  Unfortunately you are not using a current version of the product you reported a problem with -- the problem might already be fixed. Please download a new version from http://www.mysql.com/downloads/

If you are able to reproduce the bug with one of the latest versions, please change the version on this bug report to the version you tested and change the status back to "Open".  Again, thank you for your continued support of MySQL.

You have to try to repeat the behaviour with our binary for 8.0.31. There are many thousands of bugs fixed between 8.0.13 and 8.0.31, which is why we can not accept reports on the ancient releases.

Unsupported.