summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg12.c
diff options
context:
space:
mode:
authorJindřich Makovička <makovick@gmail.com>2012-01-18 22:07:22 +0100
committerDiego Biurrun <diego@biurrun.de>2012-01-19 14:14:21 +0100
commita85ce653fb14ae968419453fabf1ffe10d1f15df (patch)
tree8d2023f7a0594717fbc262cc9bb06fc28afe7331 /libavcodec/mpeg12.c
parente5903e29725126e8f57cdff98950b95732c98c51 (diff)
mpeg12: check for available bits to avoid an infinite loop
Signed-off-by: Jindrich Makovicka <makovick@gmail.com> Signed-off-by: Diego Biurrun <diego@biurrun.de>
Diffstat (limited to 'libavcodec/mpeg12.c')
-rw-r--r--libavcodec/mpeg12.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 34857d61a6..d79cf705ac 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");