aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/staticres.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index 59a64e3aba..8ace7288f2 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -728,6 +728,11 @@ bool StaticResource::loadHofSequenceData(const char *filename, void *&ptr, int &
if (ctrlOffs) {
int num_c = *(filePtr + ctrlOffs);
const uint16 *in_c = (uint16*) (filePtr + ctrlOffs + 1);
+ // safety check for library sequence which is supposed to have
+ // one frame more than control entries (seems to be a bug in
+ // the original code). This caused invalid memory access .
+ if (tmp_n[i].endFrame > num_c)
+ tmp_n[i].endFrame = num_c;
FrameControl *tmp_f = new FrameControl[num_c];
for (int ii = 0; ii < num_c; ii++) {