From e151167dd89a3be0524103c83e49593242a6e66d Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Wed, 25 Jul 2007 21:02:30 +0000 Subject: Some more safety checks and the first room's background can be seen svn-id: r28204 --- engines/gob/goblin.cpp | 3 +++ engines/gob/goblin_v3.cpp | 3 +++ engines/gob/inter_v1.cpp | 4 ++++ engines/gob/scenery.cpp | 2 +- 4 files changed, 11 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/gob/goblin.cpp b/engines/gob/goblin.cpp index 418b31e2ee..1db741bd44 100644 --- a/engines/gob/goblin.cpp +++ b/engines/gob/goblin.cpp @@ -1698,6 +1698,9 @@ void Goblin::playSounds(Mult::Mult_Object *obj) { int16 sndSlot; int16 frame; + if (!obj->goblinStates) + return; + animData = obj->pAnimData; for (int i = 1; i <= obj->goblinStates[animData->state][0].dataCount; i++) { diff --git a/engines/gob/goblin_v3.cpp b/engines/gob/goblin_v3.cpp index 002ef7b749..f4aa872fa1 100644 --- a/engines/gob/goblin_v3.cpp +++ b/engines/gob/goblin_v3.cpp @@ -115,6 +115,9 @@ void Goblin_v3::placeObject(Gob_Object *objDesc, char animated, Mult::Mult_Object &obj = _vm->_mult->_objects[index]; Mult::Mult_AnimData &objAnim = *(obj.pAnimData); + if (!obj.goblinStates) + return; + if ((state != -1) && (obj.goblinStates[state] != 0)) { if (state == 8) objAnim.curLookDir = 0; diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp index bc7eb2ea11..572f133e33 100644 --- a/engines/gob/inter_v1.cpp +++ b/engines/gob/inter_v1.cpp @@ -1705,6 +1705,10 @@ bool Inter_v1::o1_capturePush(OpFuncParams ¶ms) { top = _vm->_parse->parseValExpr(); width = _vm->_parse->parseValExpr(); height = _vm->_parse->parseValExpr(); + + if ((width < 0) || (height < 0)) + return false; + _vm->_game->capturePush(left, top, width, height); (*_vm->_scenery->_pCaptureCounter)++; return false; diff --git a/engines/gob/scenery.cpp b/engines/gob/scenery.cpp index ae04c220d3..95cf90bddc 100644 --- a/engines/gob/scenery.cpp +++ b/engines/gob/scenery.cpp @@ -320,7 +320,7 @@ void Scenery::updateStatic(int16 orderFrom, byte index, byte layer) { int16 top; int16 bottom; - if (layer >= _statics[index].layersCount) + if ((index >= 10) || layer >= _statics[index].layersCount) return; layerPtr = &_statics[index].layers[layer]; -- cgit v1.2.3