diff options
-rw-r--r-- | engines/saga/sprite.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/engines/saga/sprite.cpp b/engines/saga/sprite.cpp index ee2e2b922f..a1f78e1b9f 100644 --- a/engines/saga/sprite.cpp +++ b/engines/saga/sprite.cpp @@ -412,6 +412,8 @@ void Sprite::decodeRLEBuffer(const byte *inputBuffer, size_t inLength, size_t ou while (!readS.eos() && (outPointer < outPointerEnd)) { bg_runcount = readS.readByte(); + if (readS.eos()) + break; fg_runcount = readS.readByte(); for (c = 0; c < bg_runcount && !readS.eos(); c++) { @@ -423,8 +425,9 @@ void Sprite::decodeRLEBuffer(const byte *inputBuffer, size_t inLength, size_t ou } for (c = 0; c < fg_runcount && !readS.eos(); c++) { - // FIXME: eos changed; error handling? *outPointer = readS.readByte(); + if (readS.eos()) + break; if (outPointer < outPointerEnd) outPointer++; else |