From 2f66c69bd107928ede7b52d1404fdf7e94c84a28 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 24 Apr 2017 22:38:03 +0100 Subject: Do not crash on invalid JSON input --- libsolidity/interface/StandardCompiler.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp index 2b280dd5..a1e6deb0 100644 --- a/libsolidity/interface/StandardCompiler.cpp +++ b/libsolidity/interface/StandardCompiler.cpp @@ -181,6 +181,10 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) for (auto const& sourceName: sources.getMemberNames()) { string hash; + + if (!sources[sourceName].isObject()) + return formatFatalError("JSONError", "Source input is not a JSON object."); + if (sources[sourceName]["keccak256"].isString()) hash = sources[sourceName]["keccak256"].asString(); -- cgit v1.2.3