Skip to content

Commit

Permalink
Check that json data is an array or object (triton-inference-server#143)
Browse files Browse the repository at this point in the history
Co-authored-by: Elias Bermudez <dbermudez@nvidia.com>
  • Loading branch information
debermudez and debermudez authored Aug 4, 2022
1 parent 00702e8 commit 32df4a7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/c++/perf_analyzer/data_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,11 @@ DataLoader::ReadTensorData(

const rapidjson::Value* content;

// Check if the input data file is malformed
if (!(tensor.IsArray() || tensor.IsObject())) {
return cb::Error("Input data file is malformed.", pa::GENERIC_ERROR);
}

if (tensor.IsArray()) {
content = &tensor;
} else if (tensor.HasMember("b64")) {
Expand Down

0 comments on commit 32df4a7

Please sign in to comment.