[FFmpeg-cvslog] mpeg12: check for available bits to avoid an infinite loop

Jindřich Makovička git at videolan.org
Fri Jan 20 02:25:43 CET 2012


ffmpeg | branch: master | Jindřich Makovička <makovick at gmail.com> | Wed Jan 18 22:07:22 2012 +0100| [a85ce653fb14ae968419453fabf1ffe10d1f15df] | committer: Diego Biurrun

mpeg12: check for available bits to avoid an infinite loop

Signed-off-by: Jindrich Makovicka <makovick at gmail.com>
Signed-off-by: Diego Biurrun <diego at biurrun.de>

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

 libavcodec/mpeg12.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 34857d6..d79cf70 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1658,7 +1658,7 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
     if (mb_y == 0 && s->codec_tag == AV_RL32("SLIF")) {
         skip_bits1(&s->gb);
     } else {
-        for (;;) {
+        while (get_bits_left(&s->gb) > 0) {
             int code = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2);
             if (code < 0) {
                 av_log(s->avctx, AV_LOG_ERROR, "first mb_incr damaged\n");



More information about the ffmpeg-cvslog mailing list