mirror of https://github.com/facebook/rocksdb.git
Fix the bug of using freed memory introduced by recent plain table reader patch
Summary: Recent patch introduced a bug that if non-mmap mode is used, in prefix encoding case, there is a resizing of cur_key_ within the same prefix, we still read prefix from the released buffer. It fails ASAN tests and this commit fixes it. Test Plan: Run the ASAN tests for the failing test case. Reviewers: IslamAbdelRahman, yhchiang, anthony, igor, kradhakrishnan, rven Subscribers: leveldb, dhruba Differential Revision: https://reviews.facebook.net/D47457
This commit is contained in:
parent
628216fc1f
commit
a70d08ec07
|
@ -407,6 +407,7 @@ Status PlainTableKeyDecoder::NextPrefixEncodingKey(
|
|||
cur_key_.SetInternalKey(tmp, *parsed_key);
|
||||
parsed_key->user_key =
|
||||
Slice(cur_key_.GetKey().data(), prefix_len_ + size);
|
||||
saved_user_key_ = cur_key_.GetKey();
|
||||
} else {
|
||||
cur_key_.Reserve(prefix_len_ + size);
|
||||
cur_key_.SetInternalKey(Slice(saved_user_key_.data(), prefix_len_),
|
||||
|
|
Loading…
Reference in New Issue