[Scummvm-git-logs] scummvm master -> 706373079d49e01068904d735df0a1be72e9882e
mistydemeo
noreply at scummvm.org
Wed Aug 10 04:26:59 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:
706373079d DIRECTOR: fetch VWCR more safely
Commit: 706373079d49e01068904d735df0a1be72e9882e
https://github.com/scummvm/scummvm/commit/706373079d49e01068904d735df0a1be72e9882e
Author: Misty De Meo (mistydemeo at gmail.com)
Date: 2022-08-09T21:26:28-07:00
Commit Message:
DIRECTOR: fetch VWCR more safely
The previous version could end up with `r` assigned to `nullptr`,
leading to a crash when trying to free it.
Changed paths:
engines/director/cast.cpp
diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index 353c653c31c..95e299b5bb7 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -484,9 +484,10 @@ void Cast::loadCast() {
}
// CastMember Information Array
- if (_castArchive->hasResource(MKTAG('V', 'W', 'C', 'R'), -1)) {
- _castIDoffset = _castArchive->getResourceIDList(MKTAG('V', 'W', 'C', 'R'))[0];
- loadCastDataVWCR(*(r = _castArchive->getResource(MKTAG('V', 'W', 'C', 'R'), _castIDoffset)));
+ Common::Array<uint16> idList = _castArchive->getResourceIDList(MKTAG('V', 'W', 'C', 'R'));
+ _castIDoffset = idList.size() == 0 ? -1 : idList[0];
+ if ((r = _castArchive->getResource(MKTAG('V', 'W', 'C', 'R'), _castIDoffset)) != nullptr) {
+ loadCastDataVWCR(*r);
delete r;
}
More information about the Scummvm-git-logs
mailing list