IniFile: Disallow section headers from starting at other line offsets than 0.

See #21479
This commit is contained in:
Henrik Rydgård
2026-03-26 13:04:02 -06:00
parent 12d3d3e761
commit 0153761de0
+5 -2
View File
@@ -172,7 +172,10 @@ ParsedIniLine::ParsedIniLine(std::string_view line) {
value.clear();
comment = line;
} else {
ParseLine(line, &key, &value, &comment);
if (!ParseLine(line, &key, &value, &comment)) {
// Preserve bogus input but turn it into comments.
comment = "# " + std::string(line);
}
}
}
@@ -473,7 +476,7 @@ bool IniFile::Load(std::istream &in) {
std::string linebuf;
while (std::getline(in, linebuf)) {
std::string_view line = StripSpaces(std::string_view(linebuf));
std::string_view line = std::string_view(linebuf);
// Remove UTF-8 byte order marks.
if (line.substr(0, 3) == "\xEF\xBB\xBF") {
line = line.substr(3);