[Scummvm-git-logs] scummvm master -> d3002c20d02448f74ebba4184a8b6493b4460c24
lephilousophe
noreply at scummvm.org
Sun May 25 18:27:39 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
d3002c20d0 COMMON: Don't crash on buggy INI files
Commit: d3002c20d02448f74ebba4184a8b6493b4460c24
https://github.com/scummvm/scummvm/commit/d3002c20d02448f74ebba4184a8b6493b4460c24
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-05-25T20:27:15+02:00
Commit Message:
COMMON: Don't crash on buggy INI files
Instead warn the user and report a parsing failure.
Changed paths:
common/formats/ini-file.cpp
diff --git a/common/formats/ini-file.cpp b/common/formats/ini-file.cpp
index a8826b95ab7..81867effcb7 100644
--- a/common/formats/ini-file.cpp
+++ b/common/formats/ini-file.cpp
@@ -144,10 +144,14 @@ bool INIFile::loadFromStream(SeekableReadStream &stream) {
while (*p && ((_allowNonEnglishCharacters && *p != ']') || isAlnum(*p) || *p == '-' || *p == '_' || *p == '.' || *p == ' ' || *p == ':'))
p++;
- if (*p == '\0')
- error("INIFile::loadFromStream: missing ] in line %d", lineno);
- else if (*p != ']')
- error("INIFile::loadFromStream: Invalid character '%c' occurred in section name in line %d", *p, lineno);
+ if (*p == '\0') {
+ warning("INIFile::loadFromStream: missing ] in line %d", lineno);
+ return false;
+ }
+ else if (*p != ']') {
+ warning("INIFile::loadFromStream: Invalid character '%c' occurred in section name in line %d", *p, lineno);
+ return false;
+ }
// Previous section is finished now, store it.
if (!section.name.empty())
@@ -167,7 +171,8 @@ bool INIFile::loadFromStream(SeekableReadStream &stream) {
// If no section has been set, this config file is invalid!
if (section.name.empty()) {
- error("INIFile::loadFromStream: Key/value pair found outside a section in line %d", lineno);
+ warning("INIFile::loadFromStream: Key/value pair found outside a section in line %d", lineno);
+ return false;
}
// Split string at '=' into 'key' and 'value'. First, find the "=" delimeter.
More information about the Scummvm-git-logs
mailing list