[Scummvm-git-logs] scummvm master -> 554c64acf1017053f62ee9050e17be665be8c600
aquadran
noreply at scummvm.org
Sun Jan 30 23:41:16 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:
554c64acf1 STARK: Alloc PEResources on heap to avoid stack overflow
Commit: 554c64acf1017053f62ee9050e17be665be8c600
https://github.com/scummvm/scummvm/commit/554c64acf1017053f62ee9050e17be665be8c600
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2022-01-31T00:41:10+01:00
Commit Message:
STARK: Alloc PEResources on heap to avoid stack overflow
Changed paths:
engines/stark/ui/dialogbox.cpp
diff --git a/engines/stark/ui/dialogbox.cpp b/engines/stark/ui/dialogbox.cpp
index c8324df923d..2f8ded3385e 100644
--- a/engines/stark/ui/dialogbox.cpp
+++ b/engines/stark/ui/dialogbox.cpp
@@ -215,9 +215,10 @@ void DialogBox::onKeyPress(const Common::KeyState &keyState) {
}
Graphics::Surface *DialogBox::loadBackground() {
- Common::PEResources executable;
- if (!executable.loadFromEXE("game.exe") && !executable.loadFromEXE("game.dll")) {
+ Common::PEResources *executable = new Common::PEResources();
+ if (!executable->loadFromEXE("game.exe") && !executable->loadFromEXE("game.dll")) {
warning("Unable to load 'game.exe' to read the modal dialog background image");
+ delete executable;
return nullptr;
}
@@ -228,12 +229,14 @@ Graphics::Surface *DialogBox::loadBackground() {
// so we skip trying to retrieve it.
if (_vm->getGameFlags() & GF_MISSING_EXE_RESOURCES) {
warning("Steam version does not contain the modal dialog background bitmap in 'game.exe'. Using fallback color for dialog background...");
+ delete executable;
return nullptr;
}
- Common::SeekableReadStream *stream = executable.getResource(Common::kWinBitmap, 147);
+ Common::SeekableReadStream *stream = executable->getResource(Common::kWinBitmap, 147);
if (!stream) {
warning("Unable to find the modal dialog background bitmap in 'game.exe'");
+ delete executable;
return nullptr;
}
@@ -248,6 +251,7 @@ Graphics::Surface *DialogBox::loadBackground() {
stream->read(bitmapWithHeader + 14, stream->size());
delete stream;
+ delete executable;
Common::MemoryReadStream bitmapWithHeaderReadStream(bitmapWithHeader, bitmapWithHeaderLen);
More information about the Scummvm-git-logs
mailing list