From 2dc70a9e8bd549a44a7263a5cbbf3adf753b9746 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 24 May 2014 12:55:25 +0200 Subject: TUCKER: Add a couple of safeguards to avoid out of bound access during the display of credits --- engines/tucker/sequences.cpp | 7 +++++-- engines/tucker/tucker.cpp | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp index 2fb881f77e..4a68c14eea 100644 --- a/engines/tucker/sequences.cpp +++ b/engines/tucker/sequences.cpp @@ -115,7 +115,8 @@ void TuckerEngine::handleCreditsSequence() { if (counter4 == _creditsSequenceTimecounts[num]) { _fadePaletteCounter = 0; clearSprites(); - ++num; + if (num < 6) + ++num; Common::String filename; if (num == 6) { for (int i = 0; i < 16; ++i) { @@ -123,6 +124,7 @@ void TuckerEngine::handleCreditsSequence() { loadImage(filename.c_str(), imgBuf + i * 64000, 2); } } else { + filename = ""; switch (num) { case 1: filename = "loc75.pcx"; @@ -140,7 +142,8 @@ void TuckerEngine::handleCreditsSequence() { filename = "loc78.pcx"; break; } - loadImage(filename.c_str(), _quadBackgroundGfxBuf, 2); + if (filename != "") + loadImage(filename.c_str(), _quadBackgroundGfxBuf, 2); } _spritesCount = _creditsSequenceSpriteCounts[num]; ++_flagsTable[236]; diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp index 03019bfec5..3b35fc65be 100644 --- a/engines/tucker/tucker.cpp +++ b/engines/tucker/tucker.cpp @@ -604,6 +604,7 @@ void TuckerEngine::mainLoop() { _flagsTable[236] = 74; } } + if (_flagsTable[236] > 70) { handleCreditsSequence(); _quitGame = true; -- cgit v1.2.3