diff options
author | Daniel Kirchner <daniel@ekpyron.org> | 2018-08-10 02:37:49 +0800 |
---|---|---|
committer | Daniel Kirchner <daniel@ekpyron.org> | 2018-08-11 01:26:48 +0800 |
commit | 954d7433bd8c10bce917326f70070077f0cfc165 (patch) | |
tree | f73a2699f3fc369fd9ae3783b271e9a11171fe80 /solc/CommandLineInterface.cpp | |
parent | 43db88b8363d73ee2f5ffa094ff506414261bd11 (diff) | |
download | dexon-solidity-954d7433bd8c10bce917326f70070077f0cfc165.tar.gz dexon-solidity-954d7433bd8c10bce917326f70070077f0cfc165.tar.zst dexon-solidity-954d7433bd8c10bce917326f70070077f0cfc165.zip |
Disallow remappings with empty prefix.
Diffstat (limited to 'solc/CommandLineInterface.cpp')
-rw-r--r-- | solc/CommandLineInterface.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 429bd637..f7d1c748 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -392,7 +392,18 @@ bool CommandLineInterface::readInputFilesAndConfigureRemappings() { auto eq = find(path.begin(), path.end(), '='); if (eq != path.end()) - path = string(eq + 1, path.end()); + { + if (auto r = CompilerStack::parseRemapping(path)) + { + m_remappings.emplace_back(std::move(*r)); + path = string(eq + 1, path.end()); + } + else + { + cerr << "Invalid remapping: \"" << path << "\"." << endl; + return false; + } + } else if (path == "-") addStdin = true; else @@ -808,7 +819,7 @@ bool CommandLineInterface::processInput() if (m_args.count(g_argMetadataLiteral) > 0) m_compiler->useMetadataLiteralSources(true); if (m_args.count(g_argInputFile)) - m_compiler->setRemappings(m_args[g_argInputFile].as<vector<string>>()); + m_compiler->setRemappings(m_remappings); for (auto const& sourceCode: m_sourceCodes) m_compiler->addSource(sourceCode.first, sourceCode.second); if (m_args.count(g_argLibraries)) |