Skip to content

Conversation

@tigerzhang
Copy link

@tigerzhang tigerzhang commented May 9, 2019

There is a chance meta table is uninitialized. A segment fault will occur.

@kmuthukk
Copy link

Thanks @tigerzhang for the pull request submission and contribution.

Would you mind completing this CLA (contributor license agreement) form https://docs.google.com/forms/d/11hn-vBGhOZRunclC3NKmSX1cvQVrU--r0ldDLqasRIo/edit.

@tigerzhang
Copy link
Author

signed

@kmuthukk
Copy link

kmuthukk commented May 26, 2019

Thx @tigerzhang.

@OlegLoginov - could you please review the pull request?


KeyspaceMetadata* keyspace = NULL;
TableMetadata::Ptr table;
TableMetadata::Ptr table(NULL);

Choose a reason for hiding this comment

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

No need to init it by NULL due to default constructor of the object:
explicit SharedRefPtr(T* ptr = NULL)
So, please undo the change.

}

table->add_index(IndexMetadata::from_row(index_name, buffer, row));
if (table) {

Choose a reason for hiding this comment

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

Agree.
(Just for rare case when 'temp_table_name' is empty string.)

table_name = temp_table_name;
table = keyspace->get_table(table_name);
if (!table) continue;
table->clear_indexes();

Choose a reason for hiding this comment

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

The main problem is here. If the table is not found the 'table_name' must be reset!
So, the line
if (!table) continue;
must be changed into:
if (!table) { table_name.clear(); continue; }

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants