Skip to content

MDEV-40324 use-of-uninitialized-value after creation of FULLTEXT table failure - #5693

Open
Thirunarayanan wants to merge 1 commit into
10.11from
MDEV-40324
Open

Thirunarayanan wants to merge 1 commit into
10.11from
MDEV-40324

Conversation

@Thirunarayanan

Copy link
Copy Markdown
Member

Problem:

For fulltext index, row_create_index_for_mysql() calls fts_create_index_tables(). If creating FTS auxiliary table fails, error handling performs trx->rollback() of the dictionary transaction. Rollback removes the parent table from dictionary cache and frees it. After that,
convert_error_code_to_mysql() reads table->flags after table->heap. This leads to read of freed memory.

Solution:

create_index(): Read table->flags into a local variable before calling row_create_index_for_mysql()

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@iMineLink iMineLink left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix a trivial test failure under RelWithDebInfoBuild, thanks.

# FULLTEXT table failure
#
call mtr.add_suppression("InnoDB: Failed to create FTS index table");
SET STATEMENT DEBUG_DBUG="+d,fts_index_table_fail" FOR

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails in RelWithDebInfo build, please move to a _debug.test variant which includes have_debug.inc.

innodb_fts.create 'orig'                 w1 [ fail ]
        Test ended at 2026-09-18 15:10:13

CURRENT_TEST: innodb_fts.create
mysqltest: At line 162: query 'SET STATEMENT DEBUG_DBUG="+d,fts_index_table_fail" FOR
CREATE TABLE t1(f1 TEXT, FULLTEXT(f1))ENGINE=InnoDB' failed with wrong errno ER_UNKNOWN_SYSTEM_VARIABLE (1193): 'Unknown system variable 'DEBUG_DBUG'', instead of ER_CANT_CREATE_TABLE (1005)...

@iMineLink

Copy link
Copy Markdown
Contributor

I think the .rdiff files need to be re-generated for the debug test.

…e failure

Problem:
=======
For fulltext index, row_create_index_for_mysql() calls
fts_create_index_tables(). If creating FTS auxiliary table fails,
error handling performs trx->rollback() of the dictionary
transaction. Rollback removes the parent table from
dictionary cache and frees it. After that,
convert_error_code_to_mysql() reads table->flags after table->heap.
This leads to read of freed memory.

Solution:
========
create_index(): Read table->flags into a local variable before
calling row_create_index_for_mysql()

@iMineLink iMineLink left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants