From 30468d8eb44dc861576b98827853e836292df7ad Mon Sep 17 00:00:00 2001 From: Maysam Yabandeh Date: Fri, 1 Feb 2019 09:38:00 -0800 Subject: [PATCH] Fix analyze error on possible un-initialized value (#4937) Summary: The patch fixes the following analyze error by checking the return status of ParseInternalKey. ``` db/merge_helper.cc:306:23: warning: The right operand of '==' is a garbage value assert(kTypeMerge == orig_ikey.type); ``` Pull Request resolved: https://github.com/facebook/rocksdb/pull/4937 Differential Revision: D13908506 Pulled By: maysamyabandeh fbshipit-source-id: 68d7771e75519da3d4bd807fd231675ec12093f6 --- db/merge_helper.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/db/merge_helper.cc b/db/merge_helper.cc index 0f73576c0..b03e9dafe 100644 --- a/db/merge_helper.cc +++ b/db/merge_helper.cc @@ -138,7 +138,11 @@ Status MergeHelper::MergeUntil(InternalIterator* iter, // orig_ikey is backed by original_key if keys_.empty() // orig_ikey is backed by keys_.back() if !keys_.empty() ParsedInternalKey orig_ikey; - ParseInternalKey(original_key, &orig_ikey); + bool succ = ParseInternalKey(original_key, &orig_ikey); + assert(succ); + if (!succ) { + return Status::Corruption("Cannot parse key in MergeUntil"); + } Status s; bool hit_the_next_user_key = false;