From 207da9ef0f8c67bc39393652d995b55cbfd0eb97 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Thu, 11 Dec 2014 00:22:35 +0100 Subject: [PATCH] Fixing segfault for solc if stdin is given as input file - Solc should now check its input files and skip them if they don't exist or if they are not a valid file --- CommandLineInterface.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CommandLineInterface.cpp b/CommandLineInterface.cpp index d3dd39459..6ace332f7 100644 --- a/CommandLineInterface.cpp +++ b/CommandLineInterface.cpp @@ -255,7 +255,22 @@ bool CommandLineInterface::processInput() } else for (string const& infile: m_args["input-file"].as>()) + { + auto path = boost::filesystem::path(infile); + if (!boost::filesystem::exists(path)) + { + cout << "Skipping non existant input file \"" << infile << "\"" << endl; + continue; + } + + if (!boost::filesystem::is_regular_file(path)) + { + cout << "\"" << infile << "\" is not a valid file. Skipping" << endl; + continue; + } + m_sourceCodes[infile] = asString(dev::contents(infile)); + } try {