From 283bec822d4c0a8e812e46aa824b8ea0b4d7227b Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Tue, 18 Jan 2011 04:19:33 +0000 Subject: GOB: Add a sanity check in oPlaytoons_readData svn-id: r55284 --- engines/gob/inter_playtoons.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/engines/gob/inter_playtoons.cpp b/engines/gob/inter_playtoons.cpp index 05032d712c..584a9c6030 100644 --- a/engines/gob/inter_playtoons.cpp +++ b/engines/gob/inter_playtoons.cpp @@ -333,6 +333,13 @@ bool Inter_Playtoons::oPlaytoons_readData(OpFuncParams ¶ms) { return false; _vm->_draw->animateCursor(4); + if (offset > stream->size()) { + warning("oPlaytoons_readData: File \"%s\", Offset (%d) > file size (%d)", + file, offset, stream->size()); + delete stream; + return false; + } + if (offset < 0) stream->seek(offset + 1, SEEK_END); else -- cgit v1.2.3