From 5f26ad53e45d49f3bad18875ce7844981d80b9e8 Mon Sep 17 00:00:00 2001 From: rtognimp Date: Mon, 21 Jul 2003 19:04:12 +0000 Subject: [PATCH] Fix M$RLE 4bit. Patch by Michael Guennewig git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10452 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vd_msrle.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libmpcodecs/vd_msrle.c b/libmpcodecs/vd_msrle.c index 9d97f5c354..d808679bc9 100644 --- a/libmpcodecs/vd_msrle.c +++ b/libmpcodecs/vd_msrle.c @@ -137,10 +137,9 @@ void decode_msrle4( else { // copy pixels from encoded stream - rle_code = stream_byte; - rle_code /= 2; + rle_code = ((stream_byte + 1) & (~1)) / 2; extra_byte = rle_code & 0x01; - if ((row_ptr + pixel_ptr + rle_code * bytes_per_pixel > frame_size) || + if ((row_ptr + pixel_ptr + stream_byte * bytes_per_pixel > frame_size) || (row_ptr < 0)) { mp_msg(MSGT_DECVIDEO, MSGL_WARN, @@ -170,6 +169,8 @@ void decode_msrle4( } pixel_ptr += bytes_per_pixel; + if (i + 1 == rle_code && (stream_byte & 1) != 0) + break; if (pixel_ptr >= row_dec) break; if (bytes_per_pixel == 2)