From 0e1b4787ed76e99e0f39da227ccd80efc781d773 Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang Date: Wed, 23 Jul 2014 10:22:21 -0700 Subject: [PATCH] Fixed a bug in Compaction.cc where input_levels_ was not properly resized. Summary: Fixed a bug in Compaction.cc where input_levels_ was not properly resized. Without this fix, there would be invalid access in input_levels_ when more than two levels are involved in one compaction run. This fix will go to master instead of compaction branch. Test Plan: tested in compaction branch. Reviewers: ljin, sdong, igor Reviewed By: igor Subscribers: leveldb Differential Revision: https://reviews.facebook.net/D20481 --- db/compaction.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/db/compaction.cc b/db/compaction.cc index 20d4fae2f..620474dbc 100644 --- a/db/compaction.cc +++ b/db/compaction.cc @@ -62,6 +62,7 @@ Compaction::Compaction(Version* input_version, int start_level, int out_level, level_ptrs_[i] = 0; } int num_levels = output_level_ - start_level_ + 1; + input_levels_.resize(num_levels); inputs_.resize(num_levels); for (int i = 0; i < num_levels; ++i) { inputs_[i].level = start_level_ + i;