[Scummvm-git-logs] scummvm master -> 4d0be9549edb92fb59f193f28f77c939f22170c5

neuromancer noreply at scummvm.org
Mon Nov 7 08:25:39 UTC 2022


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

Summary:
e4cad7af42 FREESCAPE: avoid potential null derreference in driller
b4f495d515 FREESCAPE: avoid memory leak in loadMessagesFixedSize
3da8190ce1 FREESCAPE: removing unreachable code during the 8-bit object parsing
0aa8aef361 FREESCAPE: avoid potential null derreference in dark
fd9909e7d3 FREESCAPE: avoid memory leak in readArray
fec2f86eb8 FREESCAPE: initialize all the members of Texture
f51bf7bc96 FREESCAPE: avoid memory leak in load8bitBinary
f11eabc495 FREESCAPE: avoid potential null derreference when constructing bounding boxes for geometric objects
c34f4af991 FREESCAPE: initialize all the members of Renderer
4d0be9549e FREESCAPE: initialize all the members of TinyGLTexture


Commit: e4cad7af42c54babe5d1fb12f43fdde31c2a70b2
    https://github.com/scummvm/scummvm/commit/e4cad7af42c54babe5d1fb12f43fdde31c2a70b2
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-07T08:42:51+01:00

Commit Message:
FREESCAPE: avoid potential null derreference in driller

Changed paths:
    engines/freescape/games/driller.cpp


diff --git a/engines/freescape/games/driller.cpp b/engines/freescape/games/driller.cpp
index cc0f6a4120f..a4c711e57c0 100644
--- a/engines/freescape/games/driller.cpp
+++ b/engines/freescape/games/driller.cpp
@@ -340,11 +340,12 @@ void DrillerEngine::drawUI() {
 	uint32 gray = _gfx->_texturePixelFormat.ARGBToColor(0x00, 0xA0, 0xA0, 0xA0);
 
 	Graphics::Surface *surface = nullptr;
-	if (_border) {
+	if (_border) { // This can be removed when all the borders are loaded
 		surface = new Graphics::Surface();
 		surface->create(_screenW, _screenH, _gfx->_texturePixelFormat);
 		surface->fillRect(_fullscreenViewArea, gray);
-	}
+	} else
+		return;
 
 	if (_currentAreaMessages.size() == 2) {
 		int score = _gameStateVars[k8bitVariableScore];
@@ -359,7 +360,7 @@ void DrillerEngine::drawUI() {
 
 	int energy = _gameStateVars[k8bitVariableEnergy];
 	int shield = _gameStateVars[k8bitVariableShield];
-	if (_renderMode == Common::kRenderEGA && _border) {
+	if (_renderMode == Common::kRenderEGA) {
 		if (energy >= 0) {
 			Common::Rect back(20, 185, 88 - energy, 191);
 			surface->fillRect(back, black);
@@ -375,20 +376,18 @@ void DrillerEngine::drawUI() {
 			surface->fillRect(shieldBar, yellow);
 		}
 	}
-	if (surface) {
-		if (!_uiTexture)
-			_uiTexture = _gfx->createTexture(surface);
-		else
-			_uiTexture->update(surface);
 
-		_gfx->setViewport(_fullscreenViewArea);
-		_gfx->drawTexturedRect2D(_fullscreenViewArea, _fullscreenViewArea, _uiTexture);
-		_gfx->setViewport(_viewArea);
+	if (!_uiTexture)
+		_uiTexture = _gfx->createTexture(surface);
+	else
+		_uiTexture->update(surface);
 
-		surface->free();
-		delete surface;
-	}
+	_gfx->setViewport(_fullscreenViewArea);
+	_gfx->drawTexturedRect2D(_fullscreenViewArea, _fullscreenViewArea, _uiTexture);
+	_gfx->setViewport(_viewArea);
 
+	surface->free();
+	delete surface;
 }
 
 void DrillerEngine::pressedKey(const int keycode) {


Commit: b4f495d515ed023f945d123c982b89755951eec3
    https://github.com/scummvm/scummvm/commit/b4f495d515ed023f945d123c982b89755951eec3
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-07T08:45:34+01:00

Commit Message:
FREESCAPE: avoid memory leak in loadMessagesFixedSize

Changed paths:
    engines/freescape/loaders/8bitBinaryLoader.cpp


diff --git a/engines/freescape/loaders/8bitBinaryLoader.cpp b/engines/freescape/loaders/8bitBinaryLoader.cpp
index 4b80737165c..422cff81f7b 100644
--- a/engines/freescape/loaders/8bitBinaryLoader.cpp
+++ b/engines/freescape/loaders/8bitBinaryLoader.cpp
@@ -550,6 +550,7 @@ void FreescapeEngine::loadMessagesFixedSize(Common::SeekableReadStream *file, in
 		_messagesList.push_back(message);
 		debugC(1, kFreescapeDebugParser, "%s", _messagesList[i].c_str());
 	}
+	free(buffer);
 }
 
 void FreescapeEngine::loadDemoData(Common::SeekableReadStream *file, int offset, int size) {


Commit: 3da8190ce176102f561babd3b55045a730cb83ab
    https://github.com/scummvm/scummvm/commit/3da8190ce176102f561babd3b55045a730cb83ab
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-07T08:52:07+01:00

Commit Message:
FREESCAPE: removing unreachable code during the 8-bit object parsing

Changed paths:
    engines/freescape/loaders/8bitBinaryLoader.cpp


diff --git a/engines/freescape/loaders/8bitBinaryLoader.cpp b/engines/freescape/loaders/8bitBinaryLoader.cpp
index 422cff81f7b..9451c7e5ba6 100644
--- a/engines/freescape/loaders/8bitBinaryLoader.cpp
+++ b/engines/freescape/loaders/8bitBinaryLoader.cpp
@@ -236,9 +236,7 @@ Object *FreescapeEngine::load8bitObject(Common::SeekableReadStream *file) {
 			v);
 		break;
 	}
-
-	file->seek(byteSizeOfObject, SEEK_CUR);
-	return nullptr;
+	// Unreachable
 }
 
 static const char *eclipseRoomName[] = {


Commit: 0aa8aef361dbedd775e479034697b16dae26e4b7
    https://github.com/scummvm/scummvm/commit/0aa8aef361dbedd775e479034697b16dae26e4b7
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-07T08:54:14+01:00

Commit Message:
FREESCAPE: avoid potential null derreference in dark

Changed paths:
    engines/freescape/games/dark.cpp


diff --git a/engines/freescape/games/dark.cpp b/engines/freescape/games/dark.cpp
index be8a2a37ce3..ba96ff1a691 100644
--- a/engines/freescape/games/dark.cpp
+++ b/engines/freescape/games/dark.cpp
@@ -120,7 +120,8 @@ void DarkEngine::drawUI() {
 		surface = new Graphics::Surface();
 		surface->create(_screenW, _screenH, _gfx->_texturePixelFormat);
 		surface->fillRect(_fullscreenViewArea, gray);
-	}
+	} else
+		return;
 
 	if (_currentAreaMessages.size() == 1) {
 		int score = _gameStateVars[k8bitVariableScore];
@@ -131,19 +132,17 @@ void DarkEngine::drawUI() {
 		drawStringInSurface(Common::String::format("%07d", score), 95, 8, yellow, black, surface);
 	}
 
-	if (surface) {
-		if (!_uiTexture)
-			_uiTexture = _gfx->createTexture(surface);
-		else
-			_uiTexture->update(surface);
+	if (!_uiTexture)
+		_uiTexture = _gfx->createTexture(surface);
+	else
+		_uiTexture->update(surface);
 
-		_gfx->setViewport(_fullscreenViewArea);
-		_gfx->drawTexturedRect2D(_fullscreenViewArea, _fullscreenViewArea, _uiTexture);
-		_gfx->setViewport(_viewArea);
+	_gfx->setViewport(_fullscreenViewArea);
+	_gfx->drawTexturedRect2D(_fullscreenViewArea, _fullscreenViewArea, _uiTexture);
+	_gfx->setViewport(_viewArea);
 
-		surface->free();
-		delete surface;
-	}
+	surface->free();
+	delete surface;
 }
 
 } // End of namespace Freescape


Commit: fd9909e7d31bc51550ca24e56ee99715ed55f6ce
    https://github.com/scummvm/scummvm/commit/fd9909e7d31bc51550ca24e56ee99715ed55f6ce
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-07T08:58:26+01:00

Commit Message:
FREESCAPE: avoid memory leak in readArray

Changed paths:
    engines/freescape/loaders/8bitBinaryLoader.cpp


diff --git a/engines/freescape/loaders/8bitBinaryLoader.cpp b/engines/freescape/loaders/8bitBinaryLoader.cpp
index 9451c7e5ba6..e1baf34c1dc 100644
--- a/engines/freescape/loaders/8bitBinaryLoader.cpp
+++ b/engines/freescape/loaders/8bitBinaryLoader.cpp
@@ -66,6 +66,7 @@ Common::Array<uint8> FreescapeEngine::readArray(Common::SeekableReadStream *file
 		data[i] = readField(file, 8);
 	}
 	Common::Array<uint8> array(data, size);
+	free(data);
 	return array;
 }
 


Commit: fec2f86eb8645265f5fcb5bca9e61d7547449e85
    https://github.com/scummvm/scummvm/commit/fec2f86eb8645265f5fcb5bca9e61d7547449e85
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-07T09:00:44+01:00

Commit Message:
FREESCAPE: initialize all the members of Texture

Changed paths:
    engines/freescape/gfx.h


diff --git a/engines/freescape/gfx.h b/engines/freescape/gfx.h
index cbd41842a0b..a31dfb4d324 100644
--- a/engines/freescape/gfx.h
+++ b/engines/freescape/gfx.h
@@ -40,7 +40,7 @@ class Renderer;
 
 class Texture {
 public:
-	Texture(){};
+	Texture(){ _width = 0; _height = 0; };
 	virtual ~Texture(){};
 
 	uint _width;


Commit: f51bf7bc967588e68e6221c35254fdd18d974917
    https://github.com/scummvm/scummvm/commit/f51bf7bc967588e68e6221c35254fdd18d974917
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-07T09:05:49+01:00

Commit Message:
FREESCAPE: avoid memory leak in load8bitBinary

Changed paths:
    engines/freescape/loaders/8bitBinaryLoader.cpp


diff --git a/engines/freescape/loaders/8bitBinaryLoader.cpp b/engines/freescape/loaders/8bitBinaryLoader.cpp
index e1baf34c1dc..7f4b99bdc76 100644
--- a/engines/freescape/loaders/8bitBinaryLoader.cpp
+++ b/engines/freescape/loaders/8bitBinaryLoader.cpp
@@ -503,6 +503,8 @@ void FreescapeEngine::load8bitBinary(Common::SeekableReadStream *file, int offse
 		}
 	}
 
+	delete [] fileOffsetForArea;
+
 	if (!_areaMap.contains(startArea))
 		_startArea = newArea->getAreaID();
 	else


Commit: f11eabc49536cec6868bffa336c251c16d046674
    https://github.com/scummvm/scummvm/commit/f11eabc49536cec6868bffa336c251c16d046674
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-07T09:21:03+01:00

Commit Message:
FREESCAPE: avoid potential null derreference when constructing bounding boxes for geometric objects

Changed paths:
    engines/freescape/objects/geometricobject.cpp


diff --git a/engines/freescape/objects/geometricobject.cpp b/engines/freescape/objects/geometricobject.cpp
index 6d1954b1565..addd80e1fad 100644
--- a/engines/freescape/objects/geometricobject.cpp
+++ b/engines/freescape/objects/geometricobject.cpp
@@ -208,6 +208,8 @@ void GeometricObject::computeBoundingBox() {
 		_boundingBox.expand(_origin + _size);
 		break;
 	case kLineType:
+		if (!_ordinates)
+			error("Ordinates needed to compute bounding box!");
 		for (uint i = 0; i < _ordinates->size(); i = i + 3) {
 			_boundingBox.expand(Math::Vector3d((*_ordinates)[i], (*_ordinates)[i + 1], (*_ordinates)[i + 2]));
 		}
@@ -233,12 +235,16 @@ void GeometricObject::computeBoundingBox() {
 	case kQuadrilateralType:
 	case kPentagonType:
 	case kHexagonType:
+		if (!_ordinates)
+			error("Ordinates needed to compute bounding box!");
 		for (uint i = 0; i < _ordinates->size(); i = i + 3) {
 			_boundingBox.expand(Math::Vector3d((*_ordinates)[i], (*_ordinates)[i + 1], (*_ordinates)[i + 2]));
 		}
 		break;
 
 	case kEastPyramidType:
+		if (!_ordinates)
+			error("Ordinates needed to compute bounding box!");
 		_boundingBox.expand(_origin + Math::Vector3d(0, 0, _size.z()));
 		_boundingBox.expand(_origin + Math::Vector3d(0, _size.y(), _size.z()));
 		_boundingBox.expand(_origin + Math::Vector3d(0, _size.y(), 0));
@@ -249,6 +255,8 @@ void GeometricObject::computeBoundingBox() {
 		_boundingBox.expand(_origin + Math::Vector3d(_size.x(), (*_ordinates)[0], (*_ordinates)[1]));
 		break;
 	case kWestPyramidType:
+		if (!_ordinates)
+			error("Ordinates needed to compute bounding box!");
 		_boundingBox.expand(_origin + Math::Vector3d(_size.x(), 0, 0));
 		_boundingBox.expand(_origin + Math::Vector3d(_size.x(), _size.y(), 0));
 		_boundingBox.expand(_origin + Math::Vector3d(_size.x(), _size.y(), _size.z()));
@@ -260,6 +268,8 @@ void GeometricObject::computeBoundingBox() {
 		_boundingBox.expand(_origin + Math::Vector3d(0, (*_ordinates)[0], (*_ordinates)[3]));
 		break;
 	case kUpPyramidType:
+		if (!_ordinates)
+			error("Ordinates needed to compute bounding box!");
 		_boundingBox.expand(_origin + Math::Vector3d(_size.x(), 0, 0));
 		_boundingBox.expand(_origin + Math::Vector3d(_size.x(), 0, _size.z()));
 		_boundingBox.expand(_origin + Math::Vector3d(0, 0, _size.z()));
@@ -270,6 +280,8 @@ void GeometricObject::computeBoundingBox() {
 		_boundingBox.expand(_origin + Math::Vector3d((*_ordinates)[0], _size.y(), (*_ordinates)[3]));
 		break;
 	case kDownPyramidType:
+		if (!_ordinates)
+			error("Ordinates needed to compute bounding box!");
 		_boundingBox.expand(_origin + Math::Vector3d(_size.x(), _size.y(), 0));
 		_boundingBox.expand(_origin + Math::Vector3d(0, _size.y(), 0));
 		_boundingBox.expand(_origin + Math::Vector3d(0, _size.y(), _size.z()));
@@ -281,6 +293,8 @@ void GeometricObject::computeBoundingBox() {
 		_boundingBox.expand(_origin + Math::Vector3d((*_ordinates)[2], 0, (*_ordinates)[3]));
 		break;
 	case kNorthPyramidType:
+		if (!_ordinates)
+			error("Ordinates needed to compute bounding box!");
 		_boundingBox.expand(_origin + Math::Vector3d(0, _size.y(), 0));
 		_boundingBox.expand(_origin + Math::Vector3d(_size.x(), _size.y(), 0));
 		_boundingBox.expand(_origin + Math::Vector3d(_size.x(), 0, 0));
@@ -291,6 +305,8 @@ void GeometricObject::computeBoundingBox() {
 		_boundingBox.expand(_origin + Math::Vector3d((*_ordinates)[0], (*_ordinates)[1], _size.z()));
 		break;
 	case kSouthPyramidType:
+		if (!_ordinates)
+			error("Ordinates needed to compute bounding box!");
 		_boundingBox.expand(_origin + Math::Vector3d(0, 0, _size.z()));
 		_boundingBox.expand(_origin + Math::Vector3d(_size.x(), 0, _size.z()));
 		_boundingBox.expand(_origin + Math::Vector3d(_size.x(), _size.y(), _size.z()));


Commit: c34f4af9919361fffb5f4918e4d39876abac5a34
    https://github.com/scummvm/scummvm/commit/c34f4af9919361fffb5f4918e4d39876abac5a34
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-07T09:22:36+01:00

Commit Message:
FREESCAPE: initialize all the members of Renderer

Changed paths:
    engines/freescape/gfx.cpp


diff --git a/engines/freescape/gfx.cpp b/engines/freescape/gfx.cpp
index 7dbe599f418..d292356068f 100644
--- a/engines/freescape/gfx.cpp
+++ b/engines/freescape/gfx.cpp
@@ -43,6 +43,7 @@ Renderer::Renderer(int screenW, int screenH, Common::RenderMode renderMode) {
 	_palette = nullptr;
 	_colorMap = nullptr;
 	_renderMode = renderMode;
+	_isAccelerated = false;
 }
 
 Renderer::~Renderer() {}


Commit: 4d0be9549edb92fb59f193f28f77c939f22170c5
    https://github.com/scummvm/scummvm/commit/4d0be9549edb92fb59f193f28f77c939f22170c5
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-07T09:24:55+01:00

Commit Message:
FREESCAPE: initialize all the members of TinyGLTexture

Changed paths:
    engines/freescape/gfx_tinygl_texture.cpp


diff --git a/engines/freescape/gfx_tinygl_texture.cpp b/engines/freescape/gfx_tinygl_texture.cpp
index a13eb9ebc0c..f843d34d5a6 100644
--- a/engines/freescape/gfx_tinygl_texture.cpp
+++ b/engines/freescape/gfx_tinygl_texture.cpp
@@ -33,6 +33,9 @@ TinyGLTexture::TinyGLTexture(const Graphics::Surface *surface) {
 	_width = surface->w;
 	_height = surface->h;
 	_format = surface->format;
+	_id = 0;
+	_internalFormat = 0;
+	_sourceFormat = 0;
 
 	_blitImage = tglGenBlitImage();
 




More information about the Scummvm-git-logs mailing list