diff options
author | Max Horn | 2006-11-20 20:40:27 +0000 |
---|---|---|
committer | Max Horn | 2006-11-20 20:40:27 +0000 |
commit | e4c471b9d7f5f3aec4d1ee1d8bc9edf706b6adb9 (patch) | |
tree | 3d08f49072645b96a3220d0b39e5d025767807f7 /engines | |
parent | 3799a91315dcd19391ea4eded39ce669fb461d21 (diff) | |
download | scummvm-rg350-e4c471b9d7f5f3aec4d1ee1d8bc9edf706b6adb9.tar.gz scummvm-rg350-e4c471b9d7f5f3aec4d1ee1d8bc9edf706b6adb9.tar.bz2 scummvm-rg350-e4c471b9d7f5f3aec4d1ee1d8bc9edf706b6adb9.zip |
Fix for bug #1599113: SCUMM: Failed assertion in getBoxCoordinates()
svn-id: r24754
Diffstat (limited to 'engines')
-rw-r--r-- | engines/scumm/boxes.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/engines/scumm/boxes.cpp b/engines/scumm/boxes.cpp index faba99d509..22882a82e8 100644 --- a/engines/scumm/boxes.cpp +++ b/engines/scumm/boxes.cpp @@ -510,8 +510,15 @@ int ScummEngine_v6::getSpecialBox(int x, int y) { return (-1); } -bool ScummEngine::checkXYInBoxBounds(int b, int x, int y) { - BoxCoords box = getBoxCoordinates(b); +bool ScummEngine::checkXYInBoxBounds(int boxnum, int x, int y) { + // Since this method is called by many other methods that take params + // from e.g. script opcodes, but do not validate the boxnum, we + // make a check here to filter out invalid boxes. + // See also bug #1599113. + if (boxnum < 0 || boxnum == Actor::kInvalidBox) + return false; + + BoxCoords box = getBoxCoordinates(boxnum); const Common::Point p(x, y); // Quick check: If the x (resp. y) coordinate of the point is |