Check OOR exception intflite_benchmark (#7260)
author오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Fri, 6 Sep 2019 10:15:57 +0000 (19:15 +0900)
committer이춘석/On-Device Lab(SR)/Staff Engineer/삼성전자 <chunseok.lee@samsung.com>
Fri, 6 Sep 2019 10:15:57 +0000 (19:15 +0900)
Add try-catch to catch OOR exception by substr

Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
tests/tools/tflite_benchmark/src/tflite_benchmark.cc

index 634b149..21eee4a 100644 (file)
@@ -52,11 +52,21 @@ void help(std::ostream &out, const int argc, char **argv)
 
 bool checkParams(const int argc, char **argv)
 {
-  if (argc < 2)
+  try
   {
-    help(std::cerr, argc, argv);
+    if (argc < 2)
+    {
+      help(std::cerr, argc, argv);
+      return false;
+    }
+  }
+  catch (const std::exception &e)
+  {
+    std::cerr << e.what() << std::endl;
+
     return false;
   }
+
   return true;
 }