aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-04-25 05:38:03 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-04-25 05:38:03 +0800
commit2f66c69bd107928ede7b52d1404fdf7e94c84a28 (patch)
tree270f7ed1121349373d4be4b121919746f97b7f84 /libsolidity
parent6202664d702289f77b6464f22bbe480478abafba (diff)
downloaddexon-solidity-2f66c69bd107928ede7b52d1404fdf7e94c84a28.tar.gz
dexon-solidity-2f66c69bd107928ede7b52d1404fdf7e94c84a28.tar.zst
dexon-solidity-2f66c69bd107928ede7b52d1404fdf7e94c84a28.zip
Do not crash on invalid JSON input
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/interface/StandardCompiler.cpp4
1 files changed, 4 insertions, 0 deletions
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();