Skip to content
Permalink
Browse files

DRASCULA: Add bound check asserts to copyRect

Bug #7110 showed a crash here. Even though that was likely a compiler
error, these extra checks shouldn't hurt.
  • Loading branch information...
wjp committed Feb 11, 2017
1 parent efb8774 commit 2af9ab6f612214cd00aa16e83db3ca5e8b0c7f19
Showing with 5 additions and 0 deletions.
  1. +5 −0 engines/drascula/graphics.cpp
@@ -196,6 +196,11 @@ void DrasculaEngine::copyRect(int xorg, int yorg, int xdes, int ydes, int width,
dest += xdes + ydes * 320;
src += xorg + yorg * 320;

assert(xorg >= 0);
assert(yorg >= 0);
assert(xorg + width <= 320);
assert(yorg + height <= 200);

int ptr = 0;
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {

0 comments on commit 2af9ab6

Please sign in to comment.
You can’t perform that action at this time.