From bc2e640bda4cf116a1847bc9bffe33aa1520dd62 Mon Sep 17 00:00:00 2001 From: "Rohan P. Singh" Date: Mon, 13 Feb 2023 01:00:42 +0900 Subject: [PATCH 1/2] [utils][mc_bin_to_log] check for input file extension --- utils/mc_bin_to_log_main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/mc_bin_to_log_main.cpp b/utils/mc_bin_to_log_main.cpp index dc1e7ecea9..eb28a14f03 100644 --- a/utils/mc_bin_to_log_main.cpp +++ b/utils/mc_bin_to_log_main.cpp @@ -21,6 +21,11 @@ int main(int argc, char * argv[]) usage(argv[0]); return 1; } + if(bfs::path(argv[1]).filename().extension().string() != ".bin") + { + mc_rtc::log::error("Input file name (\"{}\") should end with .bin", argv[1]); + return 1; + } std::string in = argv[1]; std::string out = ""; if(argc == 3) From 39930a6d03c1fe67b2d9d703e29e530bc720a069 Mon Sep 17 00:00:00 2001 From: "Rohan P. Singh" Date: Mon, 13 Feb 2023 01:10:19 +0900 Subject: [PATCH 2/2] [utils][mc_bin_to_flat] check for input file extension --- utils/mc_bin_to_flat_main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/mc_bin_to_flat_main.cpp b/utils/mc_bin_to_flat_main.cpp index 8cdca7f115..10084d9b88 100644 --- a/utils/mc_bin_to_flat_main.cpp +++ b/utils/mc_bin_to_flat_main.cpp @@ -21,6 +21,11 @@ int main(int argc, char * argv[]) usage(argv[0]); return 1; } + if(bfs::path(argv[1]).filename().extension().string() != ".bin") + { + mc_rtc::log::error("Input file name (\"{}\") should end with .bin", argv[1]); + return 1; + } std::string in = argv[1]; std::string out = ""; if(argc == 3)