From 9e743ffa92b9f59e67714ad70e50f2c6112949bb Mon Sep 17 00:00:00 2001 From: Alex Lin Date: Wed, 27 Apr 2016 11:24:03 -0500 Subject: [PATCH] Invoking trick-ICG without any arguments results in a Segmentation fault ICG dies on a strdup if the the input file is empty. Added a check for an empty input file name. We exit with an error message if there is no input file given. refs #229 --- trick_source/codegen/Interface_Code_Gen/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/trick_source/codegen/Interface_Code_Gen/main.cpp b/trick_source/codegen/Interface_Code_Gen/main.cpp index a4624d11..71be82e6 100644 --- a/trick_source/codegen/Interface_Code_Gen/main.cpp +++ b/trick_source/codegen/Interface_Code_Gen/main.cpp @@ -88,6 +88,11 @@ int main( int argc , char * argv[] ) { return 0 ; } + if ( input_file_names.empty() ) { + std::cerr << "No header file specified" << std::endl ; + return 1 ; + } + ci.createDiagnostics(); clang::DiagnosticOptions & diago = ci.getDiagnosticOpts() ; diago.ShowColors = 1 ;