feat: fail to parse info strings on empty keys

This commit is contained in:
Jan 2024-05-12 22:33:39 +02:00
parent 5d913acfef
commit 3efd9534fb
No known key found for this signature in database
GPG Key ID: 44B581F78FF5C57C

View File

@ -185,6 +185,16 @@ bool InfoString::FromStream(const std::string& prefix, std::istream& stream)
std::string key;
while (infoStream.NextField(key))
{
if (key.empty())
{
if (m_keys_by_insertion.empty())
std::cerr << "Invalid info string: Got empty key at the start of the info string\n";
else
std::cerr << "Invalid info string: Got empty key after key \"" << m_keys_by_insertion[m_keys_by_insertion.size() - 1] << "\"\n";
return false;
}
std::string value;
if (!infoStream.NextField(value))
{