From 6d4189e2edd8c62e00e03799aa9c788b4d669d3b Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 2 Nov 2011 23:18:10 +0000 Subject: DRASCULA: Fix warnings --- engines/drascula/graphics.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/drascula/graphics.cpp') diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp index 9ea20e3e12..f9f6c1f58c 100644 --- a/engines/drascula/graphics.cpp +++ b/engines/drascula/graphics.cpp @@ -361,7 +361,7 @@ void DrasculaEngine::centerText(const char *message, int textX, int textY) { curWord = strtok(msg, " "); while (curWord != NULL) { // Check if the word and the current line fit on screen - if (strlen(tmpMessageLine) > 0) + if (tmpMessageLine[0] != '\0') strcat(tmpMessageLine, " "); strcat(tmpMessageLine, curWord); if (textFitsCentered(tmpMessageLine, textX)) { @@ -643,7 +643,7 @@ void DrasculaEngine::waitFrameSSN() { } bool DrasculaEngine::animate(const char *animationFile, int FPS) { - int NFrames = 1; + int NFrames; int cnt = 2; Common::SeekableReadStream *stream = _archives.open(animationFile); -- cgit v1.2.3 From a0dbe45a454f8b64efb784131b13b942ee060675 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Fri, 25 Nov 2011 06:30:10 +0000 Subject: 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. --- engines/drascula/graphics.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/drascula/graphics.cpp') 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 -- cgit v1.2.3