aboutsummaryrefslogtreecommitdiff
path: root/image
diff options
context:
space:
mode:
Diffstat (limited to 'image')
-rw-r--r--image/codecs/codec.cpp4
-rw-r--r--image/codecs/msrle.cpp5
2 files changed, 6 insertions, 3 deletions
diff --git a/image/codecs/codec.cpp b/image/codecs/codec.cpp
index 910fcc18cb..9e5c1bfe08 100644
--- a/image/codecs/codec.cpp
+++ b/image/codecs/codec.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
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;
}