fix ASAN for DeleteFilesInRange test case
Summary: error message was ``` ==3095==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7ffd18216c40 at pc 0x0000005edda1 bp 0x7ffd18215550 sp 0x7ffd18214d00 ... Address 0x7ffd18216c40 is located in stack of thread T0 at offset 1952 in frame #0 internal_repo_rocksdb/db_compaction_test.cc:1520 rocksdb::DBCompactionTest_DeleteFileRangeFileEndpointsOverlapBug_Test::TestBody() ``` It was unsafe to have slices referring to the temporary string objects' buffers, as those strings were destroyed before the slices were used. Fixed it by assigning the strings returned by `Key()` to local variables. Closes https://github.com/facebook/rocksdb/pull/3238 Differential Revision: D6507864 Pulled By: ajkr fbshipit-source-id: dd07de1a0070c6748c1ab4f3d7bd31f9a81889d0
This commit is contained in:
parent
e1c569c324
commit
2e3a00987e
@ -1563,8 +1563,8 @@ TEST_F(DBCompactionTest, DeleteFileRangeFileEndpointsOverlapBug) {
|
|||||||
|
|
||||||
// Verify `DeleteFilesInRange` can't drop only file 0 which would cause
|
// Verify `DeleteFilesInRange` can't drop only file 0 which would cause
|
||||||
// "1 -> vals[0]" to reappear.
|
// "1 -> vals[0]" to reappear.
|
||||||
Slice begin = Key(0);
|
std::string begin_str = Key(0), end_str = Key(1);
|
||||||
Slice end = Key(1);
|
Slice begin = begin_str, end = end_str;
|
||||||
ASSERT_OK(DeleteFilesInRange(db_, db_->DefaultColumnFamily(), &begin, &end));
|
ASSERT_OK(DeleteFilesInRange(db_, db_->DefaultColumnFamily(), &begin, &end));
|
||||||
ASSERT_EQ(vals[1], Get(Key(1)));
|
ASSERT_EQ(vals[1], Get(Key(1)));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user