aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoichi Hirai <i@yoichihirai.com>2017-03-15 01:31:45 +0800
committerGitHub <noreply@github.com>2017-03-15 01:31:45 +0800
commit64e00e5371e2620a0bbd945d37e799e1e0309668 (patch)
tree23918719317fd0765cee32bff790471a0879671d
parent409eb9e3e494ad5a45c14eb7f550ad8fad2b5573 (diff)
parent14196f2621cbc3a7580ae05b6f7508c92467168a (diff)
downloaddexon-solidity-64e00e5371e2620a0bbd945d37e799e1e0309668.tar
dexon-solidity-64e00e5371e2620a0bbd945d37e799e1e0309668.tar.gz
dexon-solidity-64e00e5371e2620a0bbd945d37e799e1e0309668.tar.bz2
dexon-solidity-64e00e5371e2620a0bbd945d37e799e1e0309668.tar.lz
dexon-solidity-64e00e5371e2620a0bbd945d37e799e1e0309668.tar.xz
dexon-solidity-64e00e5371e2620a0bbd945d37e799e1e0309668.tar.zst
dexon-solidity-64e00e5371e2620a0bbd945d37e799e1e0309668.zip
Merge pull request #1767 from ethereum/longlibnames
Do not crash on long linker commandline argument.
-rw-r--r--Changelog.md1
-rw-r--r--solc/CommandLineInterface.cpp11
-rwxr-xr-xtest/cmdlineTests.sh3
3 files changed, 14 insertions, 1 deletions
diff --git a/Changelog.md b/Changelog.md
index 7cb1f562..68f0037b 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -13,6 +13,7 @@ Features:
Bugfixes:
* Commandline interface: Always escape filenames (replace ``/``, ``:`` and ``.`` with ``_``).
* Commandline interface: Do not try creating paths ``.`` and ``..``.
+ * Commandline interface: Allow long library names.
* Parser: Disallow octal literals.
* Type system: Fix a crash caused by continuing on fatal errors in the code.
* Type system: Disallow compound assignment for tuples.
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index 0c777c77..31f70272 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -420,7 +420,16 @@ void CommandLineInterface::readInputFilesAndConfigureRemappings()
bool CommandLineInterface::parseLibraryOption(string const& _input)
{
namespace fs = boost::filesystem;
- string data = fs::is_regular_file(_input) ? contentsString(_input) : _input;
+ string data = _input;
+ try
+ {
+ if (fs::is_regular_file(_input))
+ data = contentsString(_input);
+ }
+ catch (fs::filesystem_error const&)
+ {
+ // Thrown e.g. if path is too long.
+ }
vector<string> libraries;
boost::split(libraries, data, boost::is_space() || boost::is_any_of(","), boost::token_compress_on);
diff --git a/test/cmdlineTests.sh b/test/cmdlineTests.sh
index fc04bd7d..e2ee6a5e 100755
--- a/test/cmdlineTests.sh
+++ b/test/cmdlineTests.sh
@@ -50,6 +50,9 @@ echo "Testing library checksum..."
echo '' | "$SOLC" --link --libraries a:0x90f20564390eAe531E810af625A22f51385Cd222
! echo '' | "$SOLC" --link --libraries a:0x80f20564390eAe531E810af625A22f51385Cd222 2>/dev/null
+echo "Testing long library names..."
+echo '' | "$SOLC" --link --libraries aveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerylonglibraryname:0x90f20564390eAe531E810af625A22f51385Cd222
+
echo "Testing overwriting files"
TMPDIR=$(mktemp -d)
(