[Scummvm-git-logs] scummvm master -> 7c7cb6c836ad901b31849782238cd9226dc651ec
criezy
criezy at scummvm.org
Fri Dec 28 21:15:12 CET 2018
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
7c7cb6c836 GLK: Fix out of bound access in detection code
Commit: 7c7cb6c836ad901b31849782238cd9226dc651ec
https://github.com/scummvm/scummvm/commit/7c7cb6c836ad901b31849782238cd9226dc651ec
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2018-12-28T21:13:40+01:00
Commit Message:
GLK: Fix out of bound access in detection code
This caused some random asserts when for example trying to add any
game as Common::Str::hasSuffixIgnoreCase could be called with a null
pointer.
Changed paths:
engines/glk/alan2/detection.cpp
engines/glk/magnetic/detection.cpp
diff --git a/engines/glk/alan2/detection.cpp b/engines/glk/alan2/detection.cpp
index f4be3f1..d51a109 100644
--- a/engines/glk/alan2/detection.cpp
+++ b/engines/glk/alan2/detection.cpp
@@ -46,7 +46,7 @@ Alan2Descriptor Alan2MetaEngine::findGame(const char *gameId) {
}
bool Alan2MetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) {
- const char *const EXTENSIONS[3] = { ".acd", ".dat" };
+ const char *const EXTENSIONS[2] = { ".acd", ".dat" };
// Loop through the files of the folder
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
@@ -55,7 +55,7 @@ bool Alan2MetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g
continue;
Common::String filename = file->getName();
bool hasExt = false;
- for (int idx = 0; idx < 3 && !hasExt; ++idx)
+ for (int idx = 0; idx < 2 && !hasExt; ++idx)
hasExt = filename.hasSuffixIgnoreCase(EXTENSIONS[idx]);
if (!hasExt)
continue;
diff --git a/engines/glk/magnetic/detection.cpp b/engines/glk/magnetic/detection.cpp
index 279f509..91d63cc 100644
--- a/engines/glk/magnetic/detection.cpp
+++ b/engines/glk/magnetic/detection.cpp
@@ -46,7 +46,7 @@ MagneticDescriptor MagneticMetaEngine::findGame(const char *gameId) {
}
bool MagneticMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) {
- const char *const EXTENSIONS[3] = { ".magnetic" };
+ const char *const EXTENSIONS[1] = { ".magnetic" };
// Loop through the files of the folder
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
@@ -55,7 +55,7 @@ bool MagneticMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames
continue;
Common::String filename = file->getName();
bool hasExt = false;
- for (int idx = 0; idx < 3 && !hasExt; ++idx)
+ for (int idx = 0; idx < 1 && !hasExt; ++idx)
hasExt = filename.hasSuffixIgnoreCase(EXTENSIONS[idx]);
if (!hasExt)
continue;
More information about the Scummvm-git-logs
mailing list