[Scummvm-git-logs] scummvm master -> 3520f7a26ff164f9609f2c7d5024665af5c6c407

rvanlaar noreply at scummvm.org
Mon Sep 26 09:58:52 UTC 2022


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

Summary:
f7c88d7ef2 DIRECTOR: Fix dereference after null check
3520f7a26f DIRECTOR: Init refCount in Datum rect constructor


Commit: f7c88d7ef24af44a21b42610b1b52527eaf10402
    https://github.com/scummvm/scummvm/commit/f7c88d7ef24af44a21b42610b1b52527eaf10402
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2022-09-26T11:58:40+02:00

Commit Message:
DIRECTOR: Fix dereference after null check

Add check on currentSprite because if statement before does a
check if currentSprite exists, meaning currentSprite can be a nullptr.

Fixes COVERITY: 1487084

Changed paths:
    engines/director/score.cpp


diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index eae1927a766..e79ebdeefd8 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -566,7 +566,7 @@ void Score::renderSprites(uint16 frameId, RenderMode mode) {
 			if (currentSprite && !currentSprite->_trails)
 				_window->addDirtyRect(channel->getBbox());
 
-			if (currentSprite->_cast && currentSprite->_cast->_erase) {
+			if (currentSprite && currentSprite->_cast && currentSprite->_cast->_erase) {
 				_movie->eraseCastMember(currentSprite->_castId);
 				currentSprite->_cast->_erase = false;
 


Commit: 3520f7a26ff164f9609f2c7d5024665af5c6c407
    https://github.com/scummvm/scummvm/commit/3520f7a26ff164f9609f2c7d5024665af5c6c407
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2022-09-26T11:58:40+02:00

Commit Message:
DIRECTOR: Init refCount in Datum rect constructor

Fixes memory leak on ~Datum. The Datum destructor only
destroys the objects when refcount exists.

Fixes COVERITY: 1470520

Changed paths:
    engines/director/lingo/lingo.cpp


diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index bb6843218f5..2c615d041f9 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -815,6 +815,8 @@ Datum::Datum(const Common::Rect &rect) {
 	u.farr->arr.push_back(Datum(rect.top));
 	u.farr->arr.push_back(Datum(rect.right));
 	u.farr->arr.push_back(Datum(rect.bottom));
+	refCount = new int;
+	*refCount = 1;
 	ignoreGlobal = false;
 }
 




More information about the Scummvm-git-logs mailing list