Do not crash on invalid JSON input

This commit is contained in:
Alex Beregszaszi 2017-04-24 22:38:03 +01:00
parent 6202664d70
commit 2f66c69bd1

View File

@ -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();