From 277113f600fd0decf2908f36ba99e3254b2befc8 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 18 Oct 2010 19:03:24 +0000 Subject: SCUMM: Fix out of bound access (discovered by Code Analysis in MS VS2010; thanks to aquadran for helping verify the fix) svn-id: r53575 --- engines/scumm/smush/codec47.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/scumm/smush/codec47.cpp b/engines/scumm/smush/codec47.cpp index 62bc0bb098..333fdabccf 100644 --- a/engines/scumm/smush/codec47.cpp +++ b/engines/scumm/smush/codec47.cpp @@ -301,9 +301,11 @@ void Codec47Decoder::makeTables47(int width) { int32 a, c, d; int16 tmp; - for (int l = 0; l < 512; l += 2) { + for (int l = 0; l < ARRAYSIZE(codec47_table); l += 2) { _table[l / 2] = (int16)(codec47_table[l + 1] * width + codec47_table[l]); } + // Note: _table[255] is never inited; but since only the first 0xF8 + // entries of it are used anyway, this doesn't matter. a = 0; c = 0; -- cgit v1.2.3