summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kryczka <andrewkr@fb.com>2017-12-07 11:07:44 -0800
committerAndrew Kryczka <andrewkr@fb.com>2017-12-07 11:47:51 -0800
commit004237e62790320d8e630456cbeb6f4a1f3579c2 (patch)
tree1fc6e9cacf451ec661bff550543c3eeab3b0a21d
parentea3a279bbe573b43ec08760081aa225438d841ac (diff)
fix ASAN for DeleteFilesInRange test casev5.9.2rocksdb-5.9.2
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
-rw-r--r--db/db_compaction_test.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/db/db_compaction_test.cc b/db/db_compaction_test.cc
index 13c30995f..6458519d0 100644
--- a/db/db_compaction_test.cc
+++ b/db/db_compaction_test.cc
@@ -1563,8 +1563,8 @@ TEST_F(DBCompactionTest, DeleteFileRangeFileEndpointsOverlapBug) {
// Verify `DeleteFilesInRange` can't drop only file 0 which would cause
// "1 -> vals[0]" to reappear.
- Slice begin = Key(0);
- Slice end = Key(1);
+ std::string begin_str = Key(0), end_str = Key(1);
+ Slice begin = begin_str, end = end_str;
ASSERT_OK(DeleteFilesInRange(db_, db_->DefaultColumnFamily(), &begin, &end));
ASSERT_EQ(vals[1], Get(Key(1)));