[Scummvm-git-logs] scummvm master -> c546990e21cdc90127dcb99db3dce162a401502e

rvanlaar noreply at scummvm.org
Tue Mar 29 21:21:21 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:
c546990e21 DIRECTOR: Fix use after free


Commit: c546990e21cdc90127dcb99db3dce162a401502e
    https://github.com/scummvm/scummvm/commit/c546990e21cdc90127dcb99db3dce162a401502e
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2022-03-29T23:21:09+02:00

Commit Message:
DIRECTOR: Fix use after free

probeMacBinary when macArchive has a rsrc fork, otherwise delete the
archive. The archive is deleted during ~Director cleanup.

Changed paths:
    engines/director/archive.cpp


diff --git a/engines/director/archive.cpp b/engines/director/archive.cpp
index 885b5e39127..906fe9c0a02 100644
--- a/engines/director/archive.cpp
+++ b/engines/director/archive.cpp
@@ -434,9 +434,11 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
 			// We need to look at the resource fork to detect XCOD resources
 			Common::SeekableSubReadStream *macStream = new Common::SeekableSubReadStream(stream, 0, stream->size());
 			MacArchive *macArchive = new MacArchive();
-			macArchive->openStream(macStream);
-			g_director->getCurrentWindow()->probeMacBinary(macArchive);
-			delete macArchive;
+			if (!macArchive->openStream(macStream)) {
+				delete macArchive;
+			} else {
+				g_director->getCurrentWindow()->probeMacBinary(macArchive);
+			}
 
 			// Then read the data fork
 			moreOffset = Common::MacResManager::getDataForkOffset();




More information about the Scummvm-git-logs mailing list