diff options
author | Max Horn | 2011-04-04 09:56:50 +0200 |
---|---|---|
committer | Max Horn | 2011-04-04 09:56:50 +0200 |
commit | 6eeebfb19125b79e4a77e8c35a0d04cf1a5d97bd (patch) | |
tree | 6f4c1488b5e41a1f3b6f81090e25b322745f622d /engines | |
parent | b188e60f4415e7a2d7dc08ce5471edc818e94076 (diff) | |
download | scummvm-rg350-6eeebfb19125b79e4a77e8c35a0d04cf1a5d97bd.tar.gz scummvm-rg350-6eeebfb19125b79e4a77e8c35a0d04cf1a5d97bd.tar.bz2 scummvm-rg350-6eeebfb19125b79e4a77e8c35a0d04cf1a5d97bd.zip |
SCUMM: Check for cutSceneStackPointer underflows
Diffstat (limited to 'engines')
-rw-r--r-- | engines/scumm/script.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp index eac2061560..a76461f579 100644 --- a/engines/scumm/script.cpp +++ b/engines/scumm/script.cpp @@ -1283,7 +1283,8 @@ void ScummEngine::beginCutscene(int *args) { int scr = _currentScript; vm.slot[scr].cutsceneOverride++; - if (++vm.cutSceneStackPointer > ARRAYSIZE(vm.cutSceneData)) + ++vm.cutSceneStackPointer; + if (vm.cutSceneStackPointer > ARRAYSIZE(vm.cutSceneData)) error("Cutscene stack overflow"); vm.cutSceneData[vm.cutSceneStackPointer] = args[0]; @@ -1313,6 +1314,9 @@ void ScummEngine::endCutscene() { vm.cutSceneScript[vm.cutSceneStackPointer] = 0; vm.cutScenePtr[vm.cutSceneStackPointer] = 0; + + if (0 == vm.cutSceneStackPointer) + error("Cutscene stack underflow"); vm.cutSceneStackPointer--; if (VAR(VAR_CUTSCENE_END_SCRIPT)) |