mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-09 19:32:11 +00:00
DIRECTOR: Fix use-after-free
This commit is contained in:
parent
8976c4f56b
commit
036297b605
@ -570,6 +570,7 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
|
||||
_isBigEndian = false;
|
||||
} else {
|
||||
warning("RIFXArchive::openStream(): RIFX or XFIR expected but %s found", tag2str(headerTag));
|
||||
_stream = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -641,8 +642,10 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
|
||||
delete dumpStream;
|
||||
|
||||
// If we couldn't read the map, we can't do anything past this point.
|
||||
if (!readMapSuccess)
|
||||
if (!readMapSuccess) {
|
||||
_stream = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_rifxType == MKTAG('A', 'P', 'P', 'L')) {
|
||||
if (hasResource(MKTAG('F', 'i', 'l', 'e'), -1)) {
|
||||
@ -654,6 +657,7 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
|
||||
return openStream(_stream, fileOffset);
|
||||
} else {
|
||||
warning("No 'File' resource present in APPL archive");
|
||||
_stream = nullptr;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user