From f099d48b341e4e3be91aa40a2cc5db1ca9d9e858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Sat, 14 Nov 2020 00:24:08 +0100 Subject: [PATCH] CommandLineInterface::link(): Report an error if a placeholder does not have exactly four underscores --- solc/CommandLineInterface.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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; }