From 27ec3b34667782d3a98176302e2206ea54f4bd19 Mon Sep 17 00:00:00 2001 From: sdong Date: Wed, 20 Nov 2019 10:35:56 -0800 Subject: [PATCH] Sanitize input in DB::MultiGet() API (#6054) Summary: The new DB::MultiGet() doesn't validate input for num_keys > 1 and GCC-9 complains about it. Fix it by directly return when num_keys == 0 Pull Request resolved: https://github.com/facebook/rocksdb/pull/6054 Test Plan: Build with GCC-9 and see it passes. Differential Revision: D18608958 fbshipit-source-id: 1c279aff3c7fe6e9d5a6d085ed02550ecea4fdb2 --- db/db_impl/db_impl.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/db/db_impl/db_impl.cc b/db/db_impl/db_impl.cc index 17b314978..13f928dfd 100644 --- a/db/db_impl/db_impl.cc +++ b/db/db_impl/db_impl.cc @@ -1881,6 +1881,9 @@ void DBImpl::MultiGet(const ReadOptions& read_options, const size_t num_keys, ColumnFamilyHandle** column_families, const Slice* keys, PinnableSlice* values, Status* statuses, const bool sorted_input) { + if (num_keys == 0) { + return; + } autovector key_context; autovector sorted_keys; sorted_keys.resize(num_keys);