summaryrefslogtreecommitdiff
path: root/libavcodec/h261dec.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2013-08-14 16:57:21 +0200
committerLuca Barbato <lu_zero@gentoo.org>2013-08-16 14:56:49 +0200
commitc59967fa7cc5bc2fa06b36c17d2c207240c06b3e (patch)
treea5387060b97bf82c33111f14b9d1d47292ea55d0 /libavcodec/h261dec.c
parentf399e406af0c8507bb3ab7b94995ad7b8f409093 (diff)
h261: check the mtype index
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org
Diffstat (limited to 'libavcodec/h261dec.c')
-rw-r--r--libavcodec/h261dec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index 8872c6c2f6..2832c622e8 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -376,6 +376,11 @@ static int h261_decode_mb(H261Context *h)
// Read mtype
h->mtype = get_vlc2(&s->gb, h261_mtype_vlc.table, H261_MTYPE_VLC_BITS, 2);
+ if (h->mtype < 0 || h->mtype >= FF_ARRAY_ELEMS(ff_h261_mtype_map)) {
+ av_log(s->avctx, AV_LOG_ERROR, "Invalid mtype index %d\n",
+ h->mtype);
+ return SLICE_ERROR;
+ }
h->mtype = ff_h261_mtype_map[h->mtype];
// Read mquant