aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLittleboy2011-04-24 22:45:36 -0400
committerLittleboy2011-04-24 22:45:36 -0400
commitea9774f689a36e967c481c56999075671d2463b7 (patch)
tree81a1b1017a8b1a3dab6828434b2ee2d0f629568a
parentde5ec741ffbc491ec33100f7b60d1e4928e8f302 (diff)
downloadscummvm-rg350-ea9774f689a36e967c481c56999075671d2463b7.tar.gz
scummvm-rg350-ea9774f689a36e967c481c56999075671d2463b7.tar.bz2
scummvm-rg350-ea9774f689a36e967c481c56999075671d2463b7.zip
GUI: Add basic validity check to ThemeEngine::themeConfigParseHeader (workaround for #3103051)
When loading a corrupted zip, the data returned for THEMERC will be garbage, which will cause an assert in isspace() when trying to trim the data. This checks that the first character of the header is in the range [0;127] and bails out if not.
-rw-r--r--gui/ThemeEngine.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 82104eb7ae..2f9c7ae279 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -1502,6 +1502,12 @@ Common::String ThemeEngine::genLocalizedFontFilename(const Common::String &filen
*********************************************************/
bool ThemeEngine::themeConfigParseHeader(Common::String header, Common::String &themeName) {
+ // Check that header is not corrupted
+ if (header[0] < 0 || header[0] > 127) {
+ warning("Corrupted theme header found");
+ return false;
+ }
+
header.trim();
if (header.empty())