[Scummvm-cvs-logs] SF.net SVN: scummvm:[53777] scummvm/trunk/engines/lastexpress/data/subtitle .cpp

littleboy at users.sourceforge.net littleboy at users.sourceforge.net
Mon Oct 25 00:15:25 CEST 2010


Revision: 53777
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53777&view=rev
Author:   littleboy
Date:     2010-10-24 22:15:25 +0000 (Sun, 24 Oct 2010)

Log Message:
-----------
LASTEXPRESS: Fix crash in subtitle handling

Modified Paths:
--------------
    scummvm/trunk/engines/lastexpress/data/subtitle.cpp

Modified: scummvm/trunk/engines/lastexpress/data/subtitle.cpp
===================================================================
--- scummvm/trunk/engines/lastexpress/data/subtitle.cpp	2010-10-24 21:53:27 UTC (rev 53776)
+++ scummvm/trunk/engines/lastexpress/data/subtitle.cpp	2010-10-24 22:15:25 UTC (rev 53777)
@@ -96,14 +96,18 @@
 
 	// Create the buffers
 	if (_topLength) {
-		_topText = newArray<uint16>(_topLength);
+		_topText = newArray<uint16>(_topLength + 1);
 		if (!_topText)
 			return false;
+
+		_topText[_topLength] = 0;
 	}
 	if (_bottomLength) {
-		_bottomText = newArray<uint16>(_bottomLength);
+		_bottomText = newArray<uint16>(_bottomLength + 1);
 		if (!_bottomText)
 			return false;
+
+		_bottomText[_bottomLength] = 0;
 	}
 
 	// Read the texts
@@ -142,6 +146,7 @@
 SubtitleManager::~SubtitleManager() {
 	reset();
 
+	// Zero passed pointers
 	_font = NULL;
 }
 
@@ -152,9 +157,6 @@
 	_subtitles.clear();
 	_currentIndex = -1;
 	_lastIndex = -1;
-
-	// Zero passed pointers
-	_font = NULL;
 }
 
 bool SubtitleManager::load(Common::SeekableReadStream *stream) {


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