aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-01-24 17:36:47 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-01-24 18:09:16 +0100
commitd82eccea2bf905cd51889954658f4e7f64876df8 (patch)
tree19c676daf2965b5b2efb99f8bfbbfd8538a70172
parent0c8e5fb21183cba79223d3ba06d48adb90004f4d (diff)
downloadffmpeg-d82eccea2bf905cd51889954658f4e7f64876df8.tar.gz
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@gmx.at>
-rw-r--r--libavcodec/mpeg12dec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 86011d11e3..f574997687 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: