From 29111e92b4dac98c7748f6fa2be7c894f38e3673 Mon Sep 17 00:00:00 2001 From: anand76 Date: Fri, 12 Apr 2019 18:01:00 -0700 Subject: [PATCH] Add bounds check in FilePickerMultiGet::PrepareNextLevel() (#5189) Summary: Add bounds check when looping through empty levels in FilePickerMultiGet Pull Request resolved: https://github.com/facebook/rocksdb/pull/5189 Differential Revision: D14925334 Pulled By: anand1976 fbshipit-source-id: 65d53247cf443153e28ce2b8b753fa51c6ae4566 --- db/version_set.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/db/version_set.cc b/db/version_set.cc index 08286c41a..50dfbe3c1 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -672,8 +672,11 @@ class FilePickerMultiGet { fp_ctx.search_right_bound = FileIndexer::kLevelMaxIndex; } // Skip all subsequent empty levels - while ((*level_files_brief_)[++curr_level_].num_files == 0) { - } + do { + ++curr_level_; + } while ((curr_level_ < num_levels_) && + (*level_files_brief_)[curr_level_].num_files == 0); + continue; } // Some files may overlap each other. We find