From b2423f8ddea1d70d859c5571640fae68c79161ea Mon Sep 17 00:00:00 2001 From: Levi Tamasi Date: Thu, 10 Feb 2022 11:12:18 -0800 Subject: [PATCH] Fix off-by-one bug in VersionStorageInfo::ComputeFilesMarkedForForcedBlobGC (#9542) Summary: Fixes a bug introduced in https://github.com/facebook/rocksdb/issues/9526 where we index one position past the end of a `vector`. Pull Request resolved: https://github.com/facebook/rocksdb/pull/9542 Test Plan: `make asan_check` Will add a unit test in a separate PR. Reviewed By: akankshamahajan15 Differential Revision: D34145825 Pulled By: ltamasi fbshipit-source-id: 4e87c948407dee489d669a3e41f59e2fcc1228d8 --- db/version_set.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/version_set.cc b/db/version_set.cc index 942b3d5f4..a28b186e1 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -2982,7 +2982,7 @@ void VersionStorageInfo::ComputeFilesMarkedForForcedBlobGC( uint64_t sum_total_blob_bytes = oldest_meta->GetTotalBlobBytes(); uint64_t sum_garbage_blob_bytes = oldest_meta->GetGarbageBlobBytes(); - while (true) { + while (count < blob_files_.size()) { const auto& meta = blob_files_[count]; assert(meta); -- GitLab