Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix heap use after free ASAN/Valgrind #1535

Closed

Conversation

IslamAbdelRahman
Copy link
Contributor

Dont use c_str() of temp std::string in RocksLuaCompactionFilter::Name()

@facebook-github-bot
Copy link
Contributor

@IslamAbdelRahman has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@@ -134,7 +134,7 @@ bool RocksLuaCompactionFilter::Filter(int level, const Slice& key,
}

const char* RocksLuaCompactionFilter::Name() const {
std::string name = "";
name_ = "";
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm approving it to unblock the build. But I think we shouldn't recalculate the name if we already have it in name_.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed. Thanks for spotting and fixing the issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, let me update it before landing

@facebook-github-bot
Copy link
Contributor

@IslamAbdelRahman updated the pull request - view changes - changes since last import

@IslamAbdelRahman
Copy link
Contributor Author

Update to use cached name_

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.

4 participants