aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Templier2010-10-24 22:15:25 +0000
committerJulien Templier2010-10-24 22:15:25 +0000
commite4dc5336db4f2e864aa5b7d1496c00169ef69b50 (patch)
treec26b899c30ea1696007aebc1c5fca6adc74078de
parent77d20f6962f0978de365ff6c19f129fdd4b1e203 (diff)
downloadscummvm-rg350-e4dc5336db4f2e864aa5b7d1496c00169ef69b50.tar.gz
scummvm-rg350-e4dc5336db4f2e864aa5b7d1496c00169ef69b50.tar.bz2
scummvm-rg350-e4dc5336db4f2e864aa5b7d1496c00169ef69b50.zip
LASTEXPRESS: Fix crash in subtitle handling
svn-id: r53777
-rw-r--r--engines/lastexpress/data/subtitle.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/engines/lastexpress/data/subtitle.cpp b/engines/lastexpress/data/subtitle.cpp
index 08652a293d..67d6445ab9 100644
--- a/engines/lastexpress/data/subtitle.cpp
+++ b/engines/lastexpress/data/subtitle.cpp
@@ -96,14 +96,18 @@ bool Subtitle::load(Common::SeekableReadStream *in) {
// 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(Font *font) : _font(font), _maxTime(0), _curren
SubtitleManager::~SubtitleManager() {
reset();
+ // Zero passed pointers
_font = NULL;
}
@@ -152,9 +157,6 @@ void SubtitleManager::reset() {
_subtitles.clear();
_currentIndex = -1;
_lastIndex = -1;
-
- // Zero passed pointers
- _font = NULL;
}
bool SubtitleManager::load(Common::SeekableReadStream *stream) {