Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[BUGFIX] Reject duplicate input names in C Predict API #21141

Open
wants to merge 1 commit into
base: v1.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/c_api/c_predict_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ int _CreatePartialOut(const char* symbol_json_str,
std::unordered_map<std::string, size_t> key2arg;
for (size_t i = 0; i < arg_names.size(); ++i) {
std::string key = arg_names[i];
key2arg[key] = i;
auto emplace_res = key2arg.emplace(key, i);
CHECK(emplace_res.second)
<< "Input parameter name appears more than once";
}

try {
Expand Down