Fixed a crash bug that incorrectly parse deprecated options in options_helper

Summary: Fixed a crash bug that incorrectly parse deprecated options in options_helper

Test Plan:
run db_bench with an old options file with memtable_prefix_bloom_probes
./db_bench --options_file=AN_OLD_OPTIONS_FILE --num=100 --benchmarks=fillseq

Reviewers: sdong, IslamAbdelRahman

Subscribers: andrewkr, dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D59787
main
Yueh-Hsuan Chiang 9 years ago
parent cf8adc971e
commit 3a2bccc845
  1. 6
      util/options_helper.cc

@ -845,7 +845,8 @@ Status ParseColumnFamilyOption(const std::string& name,
"Unable to parse the specified CF option " + name); "Unable to parse the specified CF option " + name);
} }
const auto& opt_info = iter->second; const auto& opt_info = iter->second;
if (ParseOptionHelper( if (opt_info.verification != OptionVerificationType::kDeprecated &&
ParseOptionHelper(
reinterpret_cast<char*>(new_options) + opt_info.offset, reinterpret_cast<char*>(new_options) + opt_info.offset,
opt_info.type, value)) { opt_info.type, value)) {
return Status::OK(); return Status::OK();
@ -1037,7 +1038,8 @@ Status ParseDBOption(const std::string& name,
return Status::InvalidArgument("Unrecognized option DBOptions:", name); return Status::InvalidArgument("Unrecognized option DBOptions:", name);
} }
const auto& opt_info = iter->second; const auto& opt_info = iter->second;
if (ParseOptionHelper( if (opt_info.verification != OptionVerificationType::kDeprecated &&
ParseOptionHelper(
reinterpret_cast<char*>(new_options) + opt_info.offset, reinterpret_cast<char*>(new_options) + opt_info.offset,
opt_info.type, value)) { opt_info.type, value)) {
return Status::OK(); return Status::OK();

Loading…
Cancel
Save