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 | |
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')
-rw-r--r-- | solc/CommandLineInterface.cpp | 15 | ||||
-rw-r--r-- | solc/CommandLineInterface.h | 2 |
2 files changed, 15 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)) diff --git a/solc/CommandLineInterface.h b/solc/CommandLineInterface.h index 45ec1eb5..010dce34 100644 --- a/solc/CommandLineInterface.h +++ b/solc/CommandLineInterface.h @@ -97,6 +97,8 @@ private: boost::program_options::variables_map m_args; /// map of input files to source code strings std::map<std::string, std::string> m_sourceCodes; + /// list of remappings + std::vector<dev::solidity::CompilerStack::Remapping> m_remappings; /// list of allowed directories to read files from std::vector<boost::filesystem::path> m_allowedDirectories; /// map of library names to addresses |