From d10929b3945da6a2909e34c0cc2b730346a0a6b2 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Sat, 1 Apr 2006 12:26:50 +0000 Subject: Always check array bounds are valid in HE games, matching original svn-id: r21524 --- engines/scumm/he/script_v100he.cpp | 3 +++ engines/scumm/he/script_v72he.cpp | 3 +++ engines/scumm/he/script_v90he.cpp | 1 + 3 files changed, 7 insertions(+) diff --git a/engines/scumm/he/script_v100he.cpp b/engines/scumm/he/script_v100he.cpp index 73cb2bb4c9..99fac87340 100644 --- a/engines/scumm/he/script_v100he.cpp +++ b/engines/scumm/he/script_v100he.cpp @@ -634,6 +634,8 @@ void ScummEngine_v100he::o100_arrayOps() { if (id == 0) { defineArray(array, kDwordArray, dim2start, dim2end, dim1start, dim1end); } + checkArrayLimits(array, dim2start, dim2end, dim1start, dim1end); + tmp2 = 0; while (dim2start <= dim2end) { tmp = dim1start; @@ -674,6 +676,7 @@ void ScummEngine_v100he::o100_arrayOps() { if (id == 0) { defineArray(array, kDwordArray, dim2start, dim2end, dim1start, dim1end); } + checkArrayLimits(array, dim2start, dim2end, dim1start, dim1end); offs = (b >= c) ? 1 : -1; tmp2 = c; diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp index 741167e228..69edc4b51c 100644 --- a/engines/scumm/he/script_v72he.cpp +++ b/engines/scumm/he/script_v72he.cpp @@ -1422,6 +1422,8 @@ void ScummEngine_v72he::o72_arrayOps() { if (id == 0) { defineArray(array, kDwordArray, dim2start, dim2end, dim1start, dim1end); } + checkArrayLimits(array, dim2start, dim2end, dim1start, dim1end); + tmp2 = 0; while (dim2start <= dim2end) { tmp = dim1start; @@ -1462,6 +1464,7 @@ void ScummEngine_v72he::o72_arrayOps() { if (id == 0) { defineArray(array, kDwordArray, dim2start, dim2end, dim1start, dim1end); } + checkArrayLimits(array, dim2start, dim2end, dim1start, dim1end); offs = (b >= c) ? 1 : -1; tmp2 = c; diff --git a/engines/scumm/he/script_v90he.cpp b/engines/scumm/he/script_v90he.cpp index cdfe909ee0..19b80b4195 100644 --- a/engines/scumm/he/script_v90he.cpp +++ b/engines/scumm/he/script_v90he.cpp @@ -2320,6 +2320,7 @@ void ScummEngine_v90he::o90_sortArray() { int dim2end = pop(); int dim2start = pop(); getArrayDim(array, &dim2start, &dim2end, &dim1start, &dim1end); + checkArrayLimits(array, dim2start, dim2end, dim1start, dim1end); sortArray(array, dim2start, dim2end, dim1start, dim1end, sortOrder); } break; -- cgit v1.2.3