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

sev- sev at scummvm.org
Tue May 31 17:12:47 CEST 2016


This automated email contains information about 15 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
2622026943 SCUMM HE: Improved debug messages
378f8573b0 PRINCE: Object initialization
df9eaac734 PRINCE: Proper processing of missing sprite mask
523c0ac0aa PRINCE: Detecting unknown cursors
8e0447e926 AUDIO: Fix memory corruption.
678c5eadfa SAGA: Safer string manipulation
459be5e7b2 SAGA: Fix potential buffer overrun
1a084f1541 SCUMM HE: Initialize memory before usage
3b5236c9de IMAGE: Init memory before usage
12f10a2264 IMAGE: Fix out of bounds access
cf42883f5e TOON: Init memory before usage
29d6e9a754 JANITORIAL: Whitespace fixes
b53d8104b7 TOON: Plug memory leak
89890523c2 TINSEL: Guard against illegal memory writes
f225442ad0 TINSEL: Fix illegal memory reads.


Commit: 26220269437abc8def270bc2730f56191705fbb1
    https://github.com/scummvm/scummvm/commit/26220269437abc8def270bc2730f56191705fbb1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-05-31T17:12:18+02:00

Commit Message:
SCUMM HE: Improved debug messages

Changed paths:
    engines/scumm/he/script_v100he.cpp



diff --git a/engines/scumm/he/script_v100he.cpp b/engines/scumm/he/script_v100he.cpp
index 2e7b4c4..b2dad7c 100644
--- a/engines/scumm/he/script_v100he.cpp
+++ b/engines/scumm/he/script_v100he.cpp
@@ -643,6 +643,11 @@ void ScummEngine_v100he::o100_arrayOps() {
 			dim2end = pop();
 			dim2start = pop();
 
+			debug(0, "Complex: %d = %d[%d to %d][%d to %d] %c %d[%d to %d][%d to %d]", array,
+				array1, a1_dim1start, a1_dim2end, a1_dim1start, a1_dim2end,
+				" +-&|^"[type],
+				array2, a2_dim1start, a2_dim2end, a2_dim1start, a2_dim2end);
+
 			int a12_num = a1_dim2end - a1_dim2start + 1;
 			int a11_num = a1_dim1end - a1_dim1start + 1;
 			int a22_num = a2_dim2end - a2_dim2start + 1;
@@ -689,8 +694,6 @@ void ScummEngine_v100he::o100_arrayOps() {
 					writeArray(array, dim2start, dim1, res);
 				}
 			}
-
-			warning("STUB: o100_arrayOps: case 132 type %d", type);
 			break;
 		}
 	case 133:			// SO_RANGE_ARRAY_ASSIGNMENT


Commit: 378f8573b04e55cd348d5b6bcfdd485d5a4c0336
    https://github.com/scummvm/scummvm/commit/378f8573b04e55cd348d5b6bcfdd485d5a4c0336
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-05-31T17:12:18+02:00

Commit Message:
PRINCE: Object initialization

Changed paths:
    engines/prince/debugger.cpp
    engines/prince/graphics.cpp
    engines/prince/mob.h
    engines/prince/sound.cpp



diff --git a/engines/prince/debugger.cpp b/engines/prince/debugger.cpp
index fc216e0..661b563 100644
--- a/engines/prince/debugger.cpp
+++ b/engines/prince/debugger.cpp
@@ -37,6 +37,8 @@ Debugger::Debugger(PrinceEngine *vm, InterpreterFlags *flags) : GUI::Debugger(),
 	registerCmd("initroom",		WRAP_METHOD(Debugger, Cmd_InitRoom));
 	registerCmd("changecursor",	WRAP_METHOD(Debugger, Cmd_ChangeCursor));
 	registerCmd("additem",		WRAP_METHOD(Debugger, Cmd_AddItem));
+
+	_cursorNr = 0;
 }
 
 static int strToInt(const char *s) {
diff --git a/engines/prince/graphics.cpp b/engines/prince/graphics.cpp
index d5178ef..ea8c52a 100644
--- a/engines/prince/graphics.cpp
+++ b/engines/prince/graphics.cpp
@@ -44,6 +44,8 @@ GraphicsMan::GraphicsMan(PrinceEngine *vm) : _vm(vm), _changed(false) {
 
 	_shadowTable70 = (byte *)malloc(256);
 	_shadowTable50 = (byte *)malloc(256);
+
+	_roomBackground = 0;
 }
 
 GraphicsMan::~GraphicsMan() {
diff --git a/engines/prince/mob.h b/engines/prince/mob.h
index 0ea610d..863fd3a 100644
--- a/engines/prince/mob.h
+++ b/engines/prince/mob.h
@@ -35,7 +35,7 @@ namespace Prince {
 class Mob {
 public:
 
-	Mob() : _name(""), _examText("") {}
+	Mob() : _name(""), _examText(""), _visible(false), _type(0), _mask(0), _examDirection(kDirL), _useDirection(kDirL) {}
 
 	bool loadFromStream(Common::SeekableReadStream &stream);
 
diff --git a/engines/prince/sound.cpp b/engines/prince/sound.cpp
index c974684..22db9c4 100644
--- a/engines/prince/sound.cpp
+++ b/engines/prince/sound.cpp
@@ -118,6 +118,7 @@ const uint8 MusicPlayer::_musRoomTable[] = {
 
 MusicPlayer::MusicPlayer(PrinceEngine *vm) : _vm(vm) {
 	_data = nullptr;
+	_dataSize = 0;
 	_isGM = false;
 
 	MidiPlayer::createDriver();


Commit: df9eaac73422be3170fe8c5ad033beb0755bc180
    https://github.com/scummvm/scummvm/commit/df9eaac73422be3170fe8c5ad033beb0755bc180
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-05-31T17:12:18+02:00

Commit Message:
PRINCE: Proper processing of missing sprite mask

Changed paths:
    engines/prince/script.cpp



diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp
index 4ed3cee..89e22b5 100644
--- a/engines/prince/script.cpp
+++ b/engines/prince/script.cpp
@@ -400,9 +400,12 @@ bool Script::loadAllMasks(Common::Array<Mask> &maskList, int offset) {
 					return false;
 				}
 				delete msStream;
+
+				tempMask._width = tempMask.getWidth();
+				tempMask._height = tempMask.getHeight();
+			} else {
+				return false;
 			}
-			tempMask._width = tempMask.getWidth();
-			tempMask._height = tempMask.getHeight();
 		}
 
 		maskList.push_back(tempMask);


Commit: 523c0ac0aaa8605ea23c44da4e1d796e0a7f8240
    https://github.com/scummvm/scummvm/commit/523c0ac0aaa8605ea23c44da4e1d796e0a7f8240
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-05-31T17:12:18+02:00

Commit Message:
PRINCE: Detecting unknown cursors

Changed paths:
    engines/prince/prince.cpp



diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp
index f1fd5a2..a1386c6 100644
--- a/engines/prince/prince.cpp
+++ b/engines/prince/prince.cpp
@@ -623,6 +623,8 @@ void PrinceEngine::changeCursor(uint16 curId) {
 	const Graphics::Surface *curSurface = nullptr;
 
 	switch (curId) {
+	default:
+		error("Unknown cursor Id: %d", curId);
 	case 0:
 		CursorMan.showMouse(false);
 		_optionsFlag = 0;


Commit: 8e0447e9262aada3bc0753b3ce1707dccf3949ab
    https://github.com/scummvm/scummvm/commit/8e0447e9262aada3bc0753b3ce1707dccf3949ab
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-05-31T17:12:18+02:00

Commit Message:
AUDIO: Fix memory corruption.

Since it was --voice, we were reading element index -1.

Changed paths:
    audio/mods/maxtrax.cpp



diff --git a/audio/mods/maxtrax.cpp b/audio/mods/maxtrax.cpp
index f5754a5..b0cdaef 100644
--- a/audio/mods/maxtrax.cpp
+++ b/audio/mods/maxtrax.cpp
@@ -708,7 +708,7 @@ int8 MaxTrax::noteOn(ChannelContext &channel, const byte note, uint16 volume, ui
 		voiceNum = pickvoice((channel.flags & ChannelContext::kFlagRightChannel) != 0 ? 1 : 0, pri);
 	} else {
 		VoiceContext *voice = ARRAYEND(_voiceCtx);
-		for (voiceNum = ARRAYSIZE(_voiceCtx); voiceNum-- != 0 && --voice->channel != &channel;)
+		for (voiceNum = ARRAYSIZE(_voiceCtx); voiceNum >= 0 && voice->channel != &channel; voiceNum--, voice--)
 			;
 		if (voiceNum < 0)
 			voiceNum = pickvoice((channel.flags & ChannelContext::kFlagRightChannel) != 0 ? 1 : 0, pri);


Commit: 678c5eadfa48ebd5079db93d9980cbb67cc39b89
    https://github.com/scummvm/scummvm/commit/678c5eadfa48ebd5079db93d9980cbb67cc39b89
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-05-31T17:12:18+02:00

Commit Message:
SAGA: Safer string manipulation

Changed paths:
    engines/saga/saveload.cpp



diff --git a/engines/saga/saveload.cpp b/engines/saga/saveload.cpp
index 2d798bb..1a131bf 100644
--- a/engines/saga/saveload.cpp
+++ b/engines/saga/saveload.cpp
@@ -185,7 +185,7 @@ void SagaEngine::save(const char *fileName, const char *saveName) {
 
 	// Original game title
 	memset(title, 0, TITLESIZE);
-	strncpy(title, _gameTitle.c_str(), TITLESIZE);
+	Common::strlcpy(title, _gameTitle.c_str(), TITLESIZE);
 	out->write(title, TITLESIZE);
 
 	// Thumbnail


Commit: 459be5e7b248d7cd9f70ffb814d63238c3318796
    https://github.com/scummvm/scummvm/commit/459be5e7b248d7cd9f70ffb814d63238c3318796
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-05-31T17:12:18+02:00

Commit Message:
SAGA: Fix potential buffer overrun

Changed paths:
    engines/saga/interface.cpp



diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp
index b08534c..9a5e637 100644
--- a/engines/saga/interface.cpp
+++ b/engines/saga/interface.cpp
@@ -1170,7 +1170,7 @@ void Interface::processStatusTextInput(Common::KeyState keystate) {
 		_statusTextInputPos--;
 		_statusTextInputString[_statusTextInputPos] = 0;
 	default:
-		if (_statusTextInputPos > STATUS_TEXT_INPUT_MAX) {
+		if (_statusTextInputPos > STATUS_TEXT_INPUT_MAX - 1) { // -1 because of the null termination
 			break;
 		}
 		if (Common::isAlnum(keystate.ascii) || (keystate.ascii == ' ')) {


Commit: 1a084f1541b0c733a1a36d8a77772abaec4f3d40
    https://github.com/scummvm/scummvm/commit/1a084f1541b0c733a1a36d8a77772abaec4f3d40
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-05-31T17:12:18+02:00

Commit Message:
SCUMM HE: Initialize memory before usage

Changed paths:
    engines/scumm/he/cup_player_he.cpp



diff --git a/engines/scumm/he/cup_player_he.cpp b/engines/scumm/he/cup_player_he.cpp
index c409863..3a7ad49 100644
--- a/engines/scumm/he/cup_player_he.cpp
+++ b/engines/scumm/he/cup_player_he.cpp
@@ -408,6 +408,9 @@ void CUP_Player::handleSRLE(Common::SeekableReadStream &dataStream, uint32 dataS
 static void decodeLZSS(uint8 *dst, const uint8 *src1, const uint8 *src2, const uint8 *src3) {
 	uint8 wnd[4096];
 	int index = 1;
+
+	memset(wnd, 0, sizeof(wnd));
+
 	while (1) {
 		int code = *src1++;
 		for (int b = 0; b < 8; ++b) {


Commit: 3b5236c9dee1a14c231b5622582eb9bc87b897a3
    https://github.com/scummvm/scummvm/commit/3b5236c9dee1a14c231b5622582eb9bc87b897a3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-05-31T17:12:18+02:00

Commit Message:
IMAGE: Init memory before usage

Changed paths:
    image/pict.cpp



diff --git a/image/pict.cpp b/image/pict.cpp
index 89f115d..4f4f039 100644
--- a/image/pict.cpp
+++ b/image/pict.cpp
@@ -340,6 +340,8 @@ void PICTDecoder::unpackBitsRect(Common::SeekableReadStream &stream, bool withPa
 	uint32 lineSize = MAX<int>(width * bytesPerPixel + (8 * 2 / packBitsData.pixMap.pixelSize), packBitsData.pixMap.rowBytes);
 	byte *buffer = new byte[lineSize * height];
 
+	memset(buffer, 0, lineSize * height);
+
 	// Read in amount of data per row
 	for (uint16 i = 0; i < packBitsData.pixMap.bounds.height(); i++) {
 		// NOTE: Compression 0 is "default". The format in SCI games is packed when 0.


Commit: 12f10a22643a0973422b3cb0ecfc2f5bd1428346
    https://github.com/scummvm/scummvm/commit/12f10a22643a0973422b3cb0ecfc2f5bd1428346
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-05-31T17:12:18+02:00

Commit Message:
IMAGE: Fix out of bounds access

Changed paths:
    image/codecs/cinepak.cpp



diff --git a/image/codecs/cinepak.cpp b/image/codecs/cinepak.cpp
index 4e85892..2b02fc8 100644
--- a/image/codecs/cinepak.cpp
+++ b/image/codecs/cinepak.cpp
@@ -260,7 +260,7 @@ private:
 	}
 
 	static inline byte getRGBLookupEntry(const byte *colorMap, uint16 index) {
-		return colorMap[s_defaultPaletteLookup[CLIP<int>(index, 0, 1024)]];
+		return colorMap[s_defaultPaletteLookup[CLIP<int>(index, 0, 1023)]];
 	}
 };
 


Commit: cf42883f5e4820da34ece065e3dcec30ccd4e0c8
    https://github.com/scummvm/scummvm/commit/cf42883f5e4820da34ece065e3dcec30ccd4e0c8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-05-31T17:12:18+02:00

Commit Message:
TOON: Init memory before usage

Changed paths:
    engines/tinsel/palette.cpp



diff --git a/engines/tinsel/palette.cpp b/engines/tinsel/palette.cpp
index 918894c..495049d 100644
--- a/engines/tinsel/palette.cpp
+++ b/engines/tinsel/palette.cpp
@@ -132,6 +132,8 @@ void PalettesToVideoDAC() {
 	VIDEO_DAC_Q *pDACtail = g_vidDACdata;	// set tail pointer
 	byte pal[768];
 
+	memset(pal, 0, sizeof(pal));
+
 	// while Q is not empty
 	while (g_pDAChead != pDACtail) {
 		const PALETTE *pPalette;	// pointer to hardware palette


Commit: 29d6e9a754d74e7bb92a3e1424436ecac6794a47
    https://github.com/scummvm/scummvm/commit/29d6e9a754d74e7bb92a3e1424436ecac6794a47
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-05-31T17:12:18+02:00

Commit Message:
JANITORIAL: Whitespace fixes

Changed paths:
    engines/toon/toon.cpp



diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp
index 169e2ef..6f1bb74 100644
--- a/engines/toon/toon.cpp
+++ b/engines/toon/toon.cpp
@@ -708,7 +708,7 @@ bool ToonEngine::showOptions() {
 	entries[2].activeFrame = entries[2].animation->_numFrames - 1;
 
 	if (!_showConversationText) {
-		entries[4].activeFrame = 4;		
+		entries[4].activeFrame = 4;
 	} else if (_useAlternativeFont) {
 		entries[4].activeFrame = 8;
 	} else {
@@ -797,19 +797,19 @@ bool ToonEngine::showOptions() {
 			// handle sliders
 			if (clickingOn == OPTIONMENUHOTSPOT_VOLUMEMUSICSLIDER) {
 				entries[clickingOnSprite].activeFrame = ratioX * (entries[clickingOnSprite].animation->_numFrames) / 256;
-				int vol = entries[clickingOnSprite].activeFrame * 256 / entries[clickingOnSprite].animation->_numFrames; 
+				int vol = entries[clickingOnSprite].activeFrame * 256 / entries[clickingOnSprite].animation->_numFrames;
 				_audioManager->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, vol);
 			}
 
 			if (clickingOn == OPTIONMENUHOTSPOT_VOLUMEVOICESLIDER) {
 				entries[clickingOnSprite].activeFrame = ratioX * (entries[clickingOnSprite].animation->_numFrames) / 256;
-				int vol = entries[clickingOnSprite].activeFrame * 256 / entries[clickingOnSprite].animation->_numFrames; 
+				int vol = entries[clickingOnSprite].activeFrame * 256 / entries[clickingOnSprite].animation->_numFrames;
 				_audioManager->_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, vol);
 			}
 
 			if (clickingOn == OPTIONMENUHOTSPOT_VOLUMESFXSLIDER) {
 				entries[clickingOnSprite].activeFrame = ratioX * (entries[clickingOnSprite].animation->_numFrames) / 256;
-				int vol = entries[clickingOnSprite].activeFrame * 256 / entries[clickingOnSprite].animation->_numFrames; 
+				int vol = entries[clickingOnSprite].activeFrame * 256 / entries[clickingOnSprite].animation->_numFrames;
 				_audioManager->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, vol);
 			}
 


Commit: b53d8104b7b8db79fa91285838590bc0f41b5447
    https://github.com/scummvm/scummvm/commit/b53d8104b7b8db79fa91285838590bc0f41b5447
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-05-31T17:12:18+02:00

Commit Message:
TOON: Plug memory leak

Changed paths:
    engines/toon/toon.cpp



diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp
index 6f1bb74..137562a 100644
--- a/engines/toon/toon.cpp
+++ b/engines/toon/toon.cpp
@@ -935,10 +935,12 @@ bool ToonEngine::showOptions() {
 	_gameState->_inMenu = false;
 	_firstFrame = true;
 	_gameState->_currentScrollValue = oldScrollValue;
-	
+
 	restorePalette();
 	dirtyAllScreen();
 
+	delete optionPicture;
+
 	return exitGame;
 }
 


Commit: 89890523c236681ebf32922d956587c9b44e270d
    https://github.com/scummvm/scummvm/commit/89890523c236681ebf32922d956587c9b44e270d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-05-31T17:12:18+02:00

Commit Message:
TINSEL: Guard against illegal memory writes

Changed paths:
    engines/tinsel/play.cpp



diff --git a/engines/tinsel/play.cpp b/engines/tinsel/play.cpp
index ef31272..a4f5bc8 100644
--- a/engines/tinsel/play.cpp
+++ b/engines/tinsel/play.cpp
@@ -159,6 +159,9 @@ static int RegisterSoundReel(SCNHANDLE hFilm, int column, int actorCol) {
 		}
 	}
 
+	if (i == MAX_SOUNDREELS)
+		error("Out of sound reels in RegisterSoundReel()");
+
 	g_soundReelNumbers[i]++;
 	return i;
 }


Commit: f225442ad00b4f6a9210731e33bbb5b8a9705ffa
    https://github.com/scummvm/scummvm/commit/f225442ad00b4f6a9210731e33bbb5b8a9705ffa
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-05-31T17:12:18+02:00

Commit Message:
TINSEL: Fix illegal memory reads.

In case of "unnamed" case (see line 582) we were memcpy'ing 31 byte from
the heap.

Changed paths:
    engines/tinsel/saveload.cpp



diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp
index 226cbb5..c8fe5f8 100644
--- a/engines/tinsel/saveload.cpp
+++ b/engines/tinsel/saveload.cpp
@@ -594,8 +594,8 @@ static void DoSave() {
 	hdr.id = SAVEGAME_ID;
 	hdr.size = SAVEGAME_HEADER_SIZE;
 	hdr.ver = CURRENT_VER;
-	memcpy(hdr.desc, g_SaveSceneDesc, SG_DESC_LEN);
-	hdr.desc[SG_DESC_LEN - 1] = 0;
+	memset(hdr.desc, 0, SG_DESC_LEN);
+	Common::strlcpy(hdr.desc, g_SaveSceneDesc, SG_DESC_LEN);
 	g_system->getTimeAndDate(hdr.dateTime);
 	hdr.scnFlag = _vm->getFeatures() & GF_SCNFILES;
 	hdr.language = _vm->_config->_language;






More information about the Scummvm-git-logs mailing list