[Scummvm-cvs-logs] scummvm master -> ff1bdc7f5840e2d281f99cd2f74144a5473a180f

criezy criezy at scummvm.org
Wed Apr 24 22:29:13 CEST 2013


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:
ff1bdc7f58 SWORD1: Avoid possible dereferencing of a null pointer


Commit: ff1bdc7f5840e2d281f99cd2f74144a5473a180f
    https://github.com/scummvm/scummvm/commit/ff1bdc7f5840e2d281f99cd2f74144a5473a180f
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2013-04-24T13:24:58-07:00

Commit Message:
SWORD1: Avoid possible dereferencing of a null pointer

CID 1003605

Changed paths:
    engines/sword1/resman.cpp



diff --git a/engines/sword1/resman.cpp b/engines/sword1/resman.cpp
index 878ba8e..3e8ee93 100644
--- a/engines/sword1/resman.cpp
+++ b/engines/sword1/resman.cpp
@@ -227,7 +227,8 @@ Header *ResMan::lockScript(uint32 scrID) {
 #else
 	openScriptResourceLittleEndian(scrID);
 #endif
-	return (Header *)resHandle(scrID)->data;
+	MemHandle *handle = resHandle(scrID);
+	return handle != NULL ? (Header *)handle->data : NULL;
 }
 
 void ResMan::unlockScript(uint32 scrID) {
@@ -343,8 +344,8 @@ MemHandle *ResMan::resHandle(uint32 id) {
 	uint8 cluster = (uint8)((id >> 24) - 1);
 	uint8 group = (uint8)(id >> 16);
 
-	// There is a know case of reading beyond array boundaries when trying to use
-	// portuguese subtitles (cluster file 2, group 6) with a version that do not
+	// There is a known case of reading beyond array boundaries when trying to use
+	// portuguese subtitles (cluster file 2, group 6) with a version that does not
 	// contain subtitles for this languages (i.e. has only 6 languages and not 7).
 	if (cluster >= _prj.noClu || group >= _prj.clu[cluster].noGrp)
 		return NULL;






More information about the Scummvm-git-logs mailing list