aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vp6.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2012-02-23 11:19:33 -0800
committerRonald S. Bultje <rsbultje@gmail.com>2012-02-28 16:41:58 -0800
commit8bc396fc0e8769a056375c1c211f389ce0e3ecc5 (patch)
tree8597907e6e238118b77bb47320a1114be1cdf268 /libavcodec/vp6.c
parentbb6d5411e1e1a8e0608b1af1c4addee654dcbac5 (diff)
downloadffmpeg-8bc396fc0e8769a056375c1c211f389ce0e3ecc5.tar.gz
vp56: error out on invalid stream dimensions.
Prevents crashes when playing corrupt vp5/6 streams. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org
Diffstat (limited to 'libavcodec/vp6.c')
-rw-r--r--libavcodec/vp6.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c
index 75863a9b67..f6c7761f9d 100644
--- a/libavcodec/vp6.c
+++ b/libavcodec/vp6.c
@@ -77,6 +77,10 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
cols = buf[3]; /* number of stored macroblock cols */
/* buf[4] is number of displayed macroblock rows */
/* buf[5] is number of displayed macroblock cols */
+ if (!rows || !cols) {
+ av_log(s->avctx, AV_LOG_ERROR, "Invalid size %dx%d\n", cols << 4, rows << 4);
+ return 0;
+ }
if (!s->macroblocks || /* first frame */
16*cols != s->avctx->coded_width ||
@@ -97,7 +101,7 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
vrt_shift = 5;
s->sub_version = sub_version;
} else {
- if (!s->sub_version)
+ if (!s->sub_version || !s->avctx->coded_width || !s->avctx->coded_height)
return 0;
if (separated_coeff || !s->filter_header) {