[Scummvm-git-logs] scummvm master -> 73cb9378ade008d49ad12f1502f243301346e210

rvanlaar noreply at scummvm.org
Mon Oct 3 13:46:04 UTC 2022


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

Summary:
73cb9378ad DIRECTOR: Fix dereference after null check


Commit: 73cb9378ade008d49ad12f1502f243301346e210
    https://github.com/scummvm/scummvm/commit/73cb9378ade008d49ad12f1502f243301346e210
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2022-10-03T15:45:20+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: 1498653

Changed paths:
    engines/director/score.cpp


diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index e79ebdeefd8..0d486c1a0ec 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -580,7 +580,15 @@ void Score::renderSprites(uint16 frameId, RenderMode mode) {
 				_movie->_videoPlayback = true;
 
 			_window->addDirtyRect(channel->getBbox());
-			debugC(2, kDebugImages, "Score::renderSprites(): CH: %-3d castId: %s [ink: %d, puppet: %d, moveable: %d, visible: %d] [bbox: %d,%d,%d,%d] [type: %d fg: %d bg: %d] [script: %s]", i, currentSprite->_castId.asString().c_str(), currentSprite->_ink, currentSprite->_puppet, currentSprite->_moveable, channel->_visible, PRINT_RECT(channel->getBbox()), currentSprite->_spriteType, currentSprite->_foreColor, currentSprite->_backColor, currentSprite->_scriptId.asString().c_str());
+			if (currentSprite) {
+				debugC(2, kDebugImages,
+					"Score::renderSprites(): CH: %-3d castId: %s [ink: %d, puppet: %d, moveable: %d, visible: %d] [bbox: %d,%d,%d,%d] [type: %d fg: %d bg: %d] [script: %s]",
+					i, currentSprite->_castId.asString().c_str(), currentSprite->_ink, currentSprite->_puppet, currentSprite->_moveable, channel->_visible,
+					PRINT_RECT(channel->getBbox()), currentSprite->_spriteType, currentSprite->_foreColor, currentSprite->_backColor,
+					currentSprite->_scriptId.asString().c_str());
+			} else {
+				debugC(2, kDebugImages, "Score::renderSprites(): CH: %-3d: No sprite", i);
+			}
 		} else {
 			channel->setClean(nextSprite, i, true);
 		}




More information about the Scummvm-git-logs mailing list