aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2012-11-30 16:10:18 +0100
committerWillem Jan Palenstijn2012-11-30 20:06:41 +0100
commitf2fe1b775a4e344b51ada17415e125998a582efd (patch)
tree94067202cd0384fb1de01e3af5eedc22b75438ae /engines
parentf5dbd23baba645583ffcb9c452f4f88a5f83a412 (diff)
downloadscummvm-rg350-f2fe1b775a4e344b51ada17415e125998a582efd.tar.gz
scummvm-rg350-f2fe1b775a4e344b51ada17415e125998a582efd.tar.bz2
scummvm-rg350-f2fe1b775a4e344b51ada17415e125998a582efd.zip
DREAMWEB: Make frame fixups more specific and add sanity checks
This should detect (and trigger asserts on) the kind of ex frame data corruption in bug #3591088.
Diffstat (limited to 'engines')
-rw-r--r--engines/dreamweb/object.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp
index 458630753c..ecd38f2abe 100644
--- a/engines/dreamweb/object.cpp
+++ b/engines/dreamweb/object.cpp
@@ -435,10 +435,23 @@ void DreamWebEngine::deleteExFrame(uint8 frameNum) {
_vars._exFramePos -= frameSize;
// Adjust all frame pointers pointing into the shifted data
- for (unsigned int i = 0; i < 3*kNumexobjects; ++i) {
- frame = &_exFrames._frames[i];
- if (frame->ptr() >= startOff)
- frame->setPtr(frame->ptr() - frameSize);
+ for (unsigned int i = 0; i < kNumexobjects; ++i) {
+ if (_exData[i].mapad[0] != 0xff) {
+ frame = &_exFrames._frames[3*i+0];
+ if (frame->ptr() >= startOff) {
+ frame->setPtr(frame->ptr() - frameSize);
+ assert(frame->ptr() + frame->width*frame->height <= _vars._exFramePos);
+ } else {
+ assert(frame->ptr() + frame->width*frame->height <= startOff);
+ }
+ frame = &_exFrames._frames[3*i+1];
+ if (frame->ptr() >= startOff) {
+ frame->setPtr(frame->ptr() - frameSize);
+ assert(frame->ptr() + frame->width*frame->height <= _vars._exFramePos);
+ } else {
+ assert(frame->ptr() + frame->width*frame->height <= startOff);
+ }
+ }
}
}