[FFmpeg-cvslog] avcodec/mpeg12dec: check block index in mpeg2_fast_decode_block_non_intra( )

Michael Niedermayer git at videolan.org
Fri Jan 24 18:38:54 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Jan 24 17:36:47 2014 +0100| [d82eccea2bf905cd51889954658f4e7f64876df8] | committer: Michael Niedermayer

avcodec/mpeg12dec: check block index in mpeg2_fast_decode_block_non_intra()

Prevents some overreads at the cost of 1 cpu cycle

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d82eccea2bf905cd51889954658f4e7f64876df8
---

 libavcodec/mpeg12dec.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 86011d1..f574997 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -489,8 +489,9 @@ static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s,
         }
 
         block[j] = level;
-        if (((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
+        if (((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF || i >= 64)
             break;
+
         UPDATE_CACHE(re, &s->gb);
     }
 end:



More information about the ffmpeg-cvslog mailing list