aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--image/codecs/msrle.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/image/codecs/msrle.cpp b/image/codecs/msrle.cpp
index 89fe869a9e..bb1125e0af 100644
--- a/image/codecs/msrle.cpp
+++ b/image/codecs/msrle.cpp
@@ -101,7 +101,10 @@ void MSRLEDecoder::decode8(Common::SeekableReadStream &stream) {
// Copy data
if (output + value > output_end) {
- stream.skip(value);
+ if (stream.pos() + value >= stream.size())
+ break;
+ else
+ stream.skip(value);
continue;
}