summaryrefslogtreecommitdiff
path: root/libavcodec/cavsdec.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2013-10-13 03:30:06 +0200
committerLuca Barbato <lu_zero@gentoo.org>2013-10-13 17:52:53 +0200
commit39185ec4faa9ef33954dbf2394444e045b632673 (patch)
tree28edcadd3197ec6f731a12a88126f53643fae1b7 /libavcodec/cavsdec.c
parent1b20d0f581f01f2df601c9e68d0d321672d97af7 (diff)
cavs: Check for negative cbp
Sample-Id: 00000647-google Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org
Diffstat (limited to 'libavcodec/cavsdec.c')
-rw-r--r--libavcodec/cavsdec.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c
index 37eb118666..142b844cad 100644
--- a/libavcodec/cavsdec.c
+++ b/libavcodec/cavsdec.c
@@ -602,8 +602,8 @@ static inline int decode_residual_inter(AVSContext *h)
/* get coded block pattern */
int cbp = get_ue_golomb(&h->gb);
- if (cbp > 63) {
- av_log(h->avctx, AV_LOG_ERROR, "illegal inter cbp\n");
+ if (cbp > 63 || cbp < 0) {
+ av_log(h->avctx, AV_LOG_ERROR, "illegal inter cbp %d\n", cbp);
return AVERROR_INVALIDDATA;
}
h->cbp = cbp_tab[cbp][1];
@@ -673,7 +673,7 @@ static int decode_mb_i(AVSContext *h, int cbp_code)
/* get coded block pattern */
if (h->cur.f->pict_type == AV_PICTURE_TYPE_I)
cbp_code = get_ue_golomb(gb);
- if (cbp_code > 63) {
+ if (cbp_code > 63 || cbp_code < 0) {
av_log(h->avctx, AV_LOG_ERROR, "illegal intra cbp\n");
return AVERROR_INVALIDDATA;
}