diff options
author | D G Turner | 2011-06-23 18:35:27 +0100 |
---|---|---|
committer | D G Turner | 2011-06-23 18:35:27 +0100 |
commit | 714976729d0badab3e7557f62036aac0b2e9cc4f (patch) | |
tree | a8731d07d7a981f1cf41c0c417656b516619208f /engines/saga | |
parent | b3d8e426c258cc20cacfa1ab5f4613e40bd10c76 (diff) | |
download | scummvm-rg350-714976729d0badab3e7557f62036aac0b2e9cc4f.tar.gz scummvm-rg350-714976729d0badab3e7557f62036aac0b2e9cc4f.tar.bz2 scummvm-rg350-714976729d0badab3e7557f62036aac0b2e9cc4f.zip |
SAGA: Fix for Bug #3324850 ("ITE (SAGA): crash in dog sewers")
This read of 1 byte past the end of the buffer has existed since
the dragonMove() function was implemented, but since the change
in bfb0986c to use ByteArray, this now causes an assertion due to
the stricter bounds checking.
This commit corrects the original issue.
Thanks to fuzzie for this fix.
Diffstat (limited to 'engines/saga')
-rw-r--r-- | engines/saga/actor_walk.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/engines/saga/actor_walk.cpp b/engines/saga/actor_walk.cpp index 5607fcdd66..ea33a0950d 100644 --- a/engines/saga/actor_walk.cpp +++ b/engines/saga/actor_walk.cpp @@ -1165,7 +1165,15 @@ void Actor::moveDragon(ActorData *actor) { dir0 = actor->_actionDirection; dir1 = actor->_tileDirections[actor->_walkStepIndex++]; dir2 = actor->_tileDirections[actor->_walkStepIndex]; - dir3 = actor->_tileDirections[actor->_walkStepIndex + 1]; + // Fix for Bug #3324850 ("ITE (SAGA): crash in dog sewers") + // If there were more than two steps left, get the third (next) step. + // Otherwise, store the second step again so the anim looks right. + // (If you stop the move instead, Rif isn't automatically knocked into + // the Sewer.) + if (actor->_walkStepIndex + 1 < actor->_walkStepsCount) + dir3 = actor->_tileDirections[actor->_walkStepIndex + 1]; + else + dir3 = dir2; if (dir0 != dir1){ actor->_actionDirection = dir0 = dir1; |