diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 47af37d46..7d3f7d763 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -1780,9 +1780,14 @@ bool CommandLineInterface::link() { while (it != end && *it != '_') ++it; if (it == end) break; - if (end - it < placeholderSize) + if ( + end - it < placeholderSize || + *(it + 1) != '_' || + *(it + placeholderSize - 2) != '_' || + *(it + placeholderSize - 1) != '_' + ) { - serr() << "Error in binary object file " << src.first << " at position " << (end - src.second.begin()) << endl; + serr() << "Error in binary object file " << src.first << " at position " << (it - src.second.begin()) << endl; return false; }