[Scummvm-cvs-logs] SF.net SVN: scummvm:[48972] scummvm/trunk/tools/create_kyradat

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sat May 8 23:25:18 CEST 2010


Revision: 48972
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48972&view=rev
Author:   lordhoto
Date:     2010-05-08 21:25:18 +0000 (Sat, 08 May 2010)

Log Message:
-----------
Fix possible out of bounds access.

Modified Paths:
--------------
    scummvm/trunk/tools/create_kyradat/create_kyradat.cpp
    scummvm/trunk/tools/create_kyradat/extract.cpp

Modified: scummvm/trunk/tools/create_kyradat/create_kyradat.cpp
===================================================================
--- scummvm/trunk/tools/create_kyradat/create_kyradat.cpp	2010-05-08 21:16:05 UTC (rev 48971)
+++ scummvm/trunk/tools/create_kyradat/create_kyradat.cpp	2010-05-08 21:25:18 UTC (rev 48972)
@@ -329,7 +329,7 @@
 };
 
 byte getGameID(int game) {
-	return std::find(gameTable, gameTable + ARRAYSIZE(gameTable), game)->value;
+	return std::find(gameTable, gameTable + ARRAYSIZE(gameTable) - 1, game)->value;
 }
 
 const TypeTable languageTable[] = {
@@ -344,7 +344,7 @@
 };
 
 byte getLanguageID(int lang) {
-	return std::find(languageTable, languageTable + ARRAYSIZE(languageTable), lang)->value;
+	return std::find(languageTable, languageTable + ARRAYSIZE(languageTable) - 1, lang)->value;
 }
 
 const TypeTable platformTable[] = {
@@ -357,7 +357,7 @@
 };
 
 byte getPlatformID(int platform) {
-	return std::find(platformTable, platformTable + ARRAYSIZE(platformTable), platform)->value;
+	return std::find(platformTable, platformTable + ARRAYSIZE(platformTable) - 1, platform)->value;
 }
 
 const TypeTable specialTable[] = {
@@ -369,7 +369,7 @@
 };
 
 byte getSpecialID(int special) {
-	return std::find(specialTable, specialTable + ARRAYSIZE(specialTable), special)->value;
+	return std::find(specialTable, specialTable + ARRAYSIZE(specialTable) - 1, special)->value;
 }
 
 // filename processing

Modified: scummvm/trunk/tools/create_kyradat/extract.cpp
===================================================================
--- scummvm/trunk/tools/create_kyradat/extract.cpp	2010-05-08 21:16:05 UTC (rev 48971)
+++ scummvm/trunk/tools/create_kyradat/extract.cpp	2010-05-08 21:25:18 UTC (rev 48972)
@@ -108,7 +108,7 @@
 	{ kLolTypeSpellData, 9 },
 	{ kLolTypeCompassData, 10 },
 	{ kLolTypeFlightShpData, 11 },
-	{ -1, 0 }
+	{ -1, 1 }
 };
 
 } // end of anonymous namespace
@@ -124,7 +124,7 @@
 }
 
 byte getTypeID(int type) {
-	return std::find(typeTable, typeTable + ARRAYSIZE(typeTable), type)->value;
+	return std::find(typeTable, typeTable + ARRAYSIZE(typeTable) - 1, type)->value;
 }
 // Extractor implementation
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list