CommandLineInterface::link(): Report an error if a placeholder does not have exactly four underscores

This commit is contained in:
Kamil Śliwak 2020-11-14 00:24:08 +01:00
parent bd1989bd0b
commit f099d48b34

View File

@ -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;
}