diff options
author | surmeh01 <surabhi.mehta@arm.com> | 2018-05-18 16:31:43 +0100 |
---|---|---|
committer | telsoa01 <telmo.soares@arm.com> | 2018-05-23 13:09:07 +0100 |
commit | 3537c2ca7ebf31c1673b9ec2bb0c17b0406bbae0 (patch) | |
tree | 5950603ad78ec3fe56fb31ddc7f4d52a19f5bc60 /tests/ExecuteNetwork/ExecuteNetwork.cpp | |
parent | bceff2fb3fc68bb0aa88b886900c34b77340c826 (diff) | |
download | armnn-3537c2ca7ebf31c1673b9ec2bb0c17b0406bbae0.tar.gz |
Release 18.05
Diffstat (limited to 'tests/ExecuteNetwork/ExecuteNetwork.cpp')
-rw-r--r-- | tests/ExecuteNetwork/ExecuteNetwork.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/ExecuteNetwork/ExecuteNetwork.cpp b/tests/ExecuteNetwork/ExecuteNetwork.cpp index 04ab195816..74737e2718 100644 --- a/tests/ExecuteNetwork/ExecuteNetwork.cpp +++ b/tests/ExecuteNetwork/ExecuteNetwork.cpp @@ -31,7 +31,16 @@ std::vector<T> ParseArrayImpl(std::istream& stream, TParseElementFunc parseEleme while (std::getline(stream, line)) { std::vector<std::string> tokens; - boost::split(tokens, line, boost::algorithm::is_any_of("\t ,;:"), boost::token_compress_on); + try + { + // Coverity fix: boost::split() may throw an exception of type boost::bad_function_call. + boost::split(tokens, line, boost::algorithm::is_any_of("\t ,;:"), boost::token_compress_on); + } + catch (const std::exception& e) + { + BOOST_LOG_TRIVIAL(error) << "An error occurred when splitting tokens: " << e.what(); + continue; + } for (const std::string& token : tokens) { if (!token.empty()) // See https://stackoverflow.com/questions/10437406/ @@ -219,7 +228,17 @@ int main(int argc, char* argv[]) { std::stringstream ss(inputTensorShapeStr); std::vector<unsigned int> dims = ParseArray<unsigned int>(ss); - inputTensorShape = std::make_unique<armnn::TensorShape>(dims.size(), dims.data()); + + try + { + // Coverity fix: An exception of type armnn::InvalidArgumentException is thrown and never caught. + inputTensorShape = std::make_unique<armnn::TensorShape>(dims.size(), dims.data()); + } + catch (const armnn::InvalidArgumentException& e) + { + BOOST_LOG_TRIVIAL(fatal) << "Cannot create tensor shape: " << e.what(); + return 1; + } } // Forward to implementation based on the parser type |