aboutsummaryrefslogtreecommitdiff
path: root/engines/drascula/graphics.cpp
diff options
context:
space:
mode:
authorD G Turner2011-11-25 06:30:10 +0000
committerD G Turner2011-11-25 06:30:10 +0000
commita0dbe45a454f8b64efb784131b13b942ee060675 (patch)
tree085ace333d8c8bdacaf83ad2d3f6014d5db370a1 /engines/drascula/graphics.cpp
parentc451bd4340cc8d76e1ba6bb55d3d75b67c38e4cf (diff)
downloadscummvm-rg350-a0dbe45a454f8b64efb784131b13b942ee060675.tar.gz
scummvm-rg350-a0dbe45a454f8b64efb784131b13b942ee060675.tar.bz2
scummvm-rg350-a0dbe45a454f8b64efb784131b13b942ee060675.zip
DRASCULA: Add fix for crash/OOB memory accesses in bug #3440895
This bug is "DRASCULA-IT: Crash/graphic glitch at castle towers". The crash was due to width and height values being passed to copyBackground() being invalid due to out of bounds read from the factor_red array. This adds debugging statements and fixes the crash by clipping accesses to the maximum index of factor_red. This doesn't however fix the observed GFX glitch, but stops it being a segfault.
Diffstat (limited to 'engines/drascula/graphics.cpp')
-rw-r--r--engines/drascula/graphics.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp
index f9f6c1f58c..590561f0bd 100644
--- a/engines/drascula/graphics.cpp
+++ b/engines/drascula/graphics.cpp
@@ -154,6 +154,7 @@ void DrasculaEngine::showFrame(Common::SeekableReadStream *stream, bool firstFra
}
void DrasculaEngine::copyBackground(int xorg, int yorg, int xdes, int ydes, int width, int height, byte *src, byte *dest) {
+ debug(1, "DrasculaEngine::copyBackground(xorg:%d, yorg:%d, xdes:%d, ydes:%d width:%d height:%d, src, dest)", xorg, yorg, xdes, ydes, width,height);
dest += xdes + ydes * 320;
src += xorg + yorg * 320;
/* Unoptimized code