From a3baa1874a90093c3cbaa5abdbe3a82c131c6324 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Tue, 25 Jan 2011 15:14:07 +0000 Subject: GOB: Add a sanity check to o1_freeFont svn-id: r55537 --- engines/gob/inter_v1.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'engines') diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp index f45c7d19ba..368a903496 100644 --- a/engines/gob/inter_v1.cpp +++ b/engines/gob/inter_v1.cpp @@ -1762,6 +1762,12 @@ bool Inter_v1::o1_freeFont(OpFuncParams ¶ms) { int16 index; index = _vm->_game->_script->readInt16(); + + if (index >= Draw::kFontCount) { + warning("o1_freeFont(): Index %d > count %d", index, Draw::kFontCount); + return false; + } + delete _vm->_draw->_fonts[index]; _vm->_draw->_fonts[index] = 0; return false; -- cgit v1.2.3