aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/interface/StandardCompiler.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2018-02-28 17:36:07 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-02-28 17:36:07 +0800
commit83fec0232d38eb6214eb41104b6cd51b6f21f282 (patch)
tree53ef607821e1a4cc747ffd72a56fc0cf9ce5a57d /libsolidity/interface/StandardCompiler.cpp
parent908b46e9a7f56a06c76db9e702fb9b25d8b0d344 (diff)
downloaddexon-solidity-83fec0232d38eb6214eb41104b6cd51b6f21f282.tar.gz
dexon-solidity-83fec0232d38eb6214eb41104b6cd51b6f21f282.tar.zst
dexon-solidity-83fec0232d38eb6214eb41104b6cd51b6f21f282.zip
Add more comprehensive tests and checks for libraries in JSONIO
Diffstat (limited to 'libsolidity/interface/StandardCompiler.cpp')
-rw-r--r--libsolidity/interface/StandardCompiler.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp
index fb973d51..6b113654 100644
--- a/libsolidity/interface/StandardCompiler.cpp
+++ b/libsolidity/interface/StandardCompiler.cpp
@@ -327,10 +327,14 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input)
m_compilerStack.setOptimiserSettings(optimize, optimizeRuns);
map<string, h160> libraries;
- Json::Value jsonLibraries = settings.get("libraries", Json::Value());
+ Json::Value jsonLibraries = settings.get("libraries", Json::Value(Json::objectValue));
+ if (!jsonLibraries.isObject())
+ return formatFatalError("JSONError", "\"libraries\" is not a JSON object.");
for (auto const& sourceName: jsonLibraries.getMemberNames())
{
auto const& jsonSourceName = jsonLibraries[sourceName];
+ if (!jsonSourceName.isObject())
+ return formatFatalError("JSONError", "library entry is not a JSON object.");
for (auto const& library: jsonSourceName.getMemberNames())
// @TODO use libraries only for the given source
libraries[library] = h160(jsonSourceName[library].asString());