[Scummvm-git-logs] scummvm master -> 982ecb4f9355b9d7be26e53f5a899e1986d48da0

criezy criezy at scummvm.org
Wed Sep 9 23:35:00 UTC 2020


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

Summary:
cb65fc2671 GRIFFON: Fix out of bound write when loading map
adbd5cfd54 GRIFFON: Fix use of uninitialized variables reported by valgrind
982ecb4f93 GUI: Fix use of uninitialized variable in ListWidget constructor


Commit: cb65fc267131dfc4a0af0aee2f8e8b9651337cae
    https://github.com/scummvm/scummvm/commit/cb65fc267131dfc4a0af0aee2f8e8b9651337cae
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-09-10T00:34:45+01:00

Commit Message:
GRIFFON: Fix out of bound write when loading map

This was a bug present in both the original FreeBASIC code and the
C port by Dmitry Smagin. So having no referemce, I am not completely
sure this is the correct way to fix it, but I have not detected any
issue playing the game after this change.

Changed paths:
    engines/griffon/resources.cpp


diff --git a/engines/griffon/resources.cpp b/engines/griffon/resources.cpp
index 9211aec572..f1cfaae3c6 100644
--- a/engines/griffon/resources.cpp
+++ b/engines/griffon/resources.cpp
@@ -396,8 +396,8 @@ void GriffonEngine::loadMap(int mapnum) {
 	for (int i = 0; i < kMaxNPC; i++)
 		_npcInfo[i].onMap = false;
 
-	for (int x = 0; x <= 19; x++) {
-		for (int y = 0; y <= 19; y++) {
+	for (int x = 0; x <= 20; x++) {
+		for (int y = 0; y <= 14; y++) {
 			int d = tempmap[3 * 40 + x][y];
 
 			int npc = 0;


Commit: adbd5cfd54600290cba59fcf9093ece0e7c236fc
    https://github.com/scummvm/scummvm/commit/adbd5cfd54600290cba59fcf9093ece0e7c236fc
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-09-10T00:34:45+01:00

Commit Message:
GRIFFON: Fix use of uninitialized variables reported by valgrind

Changed paths:
    engines/griffon/resources.cpp


diff --git a/engines/griffon/resources.cpp b/engines/griffon/resources.cpp
index f1cfaae3c6..e48c56cb84 100644
--- a/engines/griffon/resources.cpp
+++ b/engines/griffon/resources.cpp
@@ -54,8 +54,18 @@ namespace Griffon {
 
 void GriffonEngine::initialize() {
 	// init char *_floatstri[kMaxFloat]
-	for (int i = 0; i < kMaxFloat; i++)
+	for (int i = 0; i < kMaxFloat; i++) {
 		_floatText[i].text = (char *)malloc(64); // 64 bytes each string (should be enough)
+		_floatText[i].framesLeft = 0;
+		_floatText[i].x = 0;
+		_floatText[i].y = 0;
+		_floatText[i].col = 0;
+
+		_floatIcon[i].framesLeft = 0;
+		_floatIcon[i].x = 0;
+		_floatIcon[i].y = 0;
+		_floatIcon[i].ico = 0;
+	}
 
 	_video = new Graphics::TransparentSurface;
 	_video->create(320, 240, g_system->getScreenFormat());
@@ -491,8 +501,11 @@ void GriffonEngine::loadMap(int mapnum) {
 		INPUT("%i", &_npcInfo[i].item3);
 		INPUT("%i", &_npcInfo[i].script);
 
+		_npcInfo[i].cframe = 0;
+		_npcInfo[i].frame = 0;
 		_npcInfo[i].frame2 = 0;
 		_npcInfo[i].attackattempt = 0;
+		_npcInfo[i].ticks = 0;
 
 		// baby dragon
 		if (_npcInfo[i].spriteset == kMonsterBabyDragon) {


Commit: 982ecb4f9355b9d7be26e53f5a899e1986d48da0
    https://github.com/scummvm/scummvm/commit/982ecb4f9355b9d7be26e53f5a899e1986d48da0
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2020-09-10T00:34:45+01:00

Commit Message:
GUI: Fix use of uninitialized variable in ListWidget constructor

The _scrollBarWidth variable was used (to create the ScrollBarWidget)
before it was initialized.

Changed paths:
    gui/widgets/list.cpp


diff --git a/gui/widgets/list.cpp b/gui/widgets/list.cpp
index 46074fe998..ef8329bee5 100644
--- a/gui/widgets/list.cpp
+++ b/gui/widgets/list.cpp
@@ -37,6 +37,7 @@ ListWidget::ListWidget(Dialog *boss, const String &name, const U32String &toolti
 	: EditableWidget(boss, name, tooltip), _cmd(cmd) {
 
 	_entriesPerPage = 0;
+	_scrollBarWidth = 0;
 
 	_scrollBar = new ScrollBarWidget(this, _w - _scrollBarWidth, 0, _scrollBarWidth, _h);
 	_scrollBar->setTarget(this);
@@ -66,8 +67,6 @@ ListWidget::ListWidget(Dialog *boss, const String &name, const U32String &toolti
 	_hlLeftPadding = _hlRightPadding = 0;
 	_leftPadding = _rightPadding = 0;
 	_topPadding = _bottomPadding = 0;
-
-	_scrollBarWidth = 0;
 }
 
 ListWidget::ListWidget(Dialog *boss, int x, int y, int w, int h, const U32String &tooltip, uint32 cmd)




More information about the Scummvm-git-logs mailing list