diff --git a/src/ObjCommon/InfoString/InfoString.cpp b/src/ObjCommon/InfoString/InfoString.cpp index 2f39d60a..14efada8 100644 --- a/src/ObjCommon/InfoString/InfoString.cpp +++ b/src/ObjCommon/InfoString/InfoString.cpp @@ -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)) {