diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-06-07 19:17:30 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-06-16 01:05:30 +0200 |
commit | 22a6713ce9e185e134a3236b3bcde018b89f3237 (patch) | |
tree | cca298b603526cc4314fbf6bf1cbf59003bf746e /libavcodec | |
parent | 61bf10368c2b3307d25524fba2efcd0ba42a479a (diff) | |
download | ffmpeg-22a6713ce9e185e134a3236b3bcde018b89f3237.tar.gz |
avcodec/libvpxdec: Check that display dimensions fit in the storage dimensions
Fixes assertion failure
Fixes: 2112/clusterfuzz-testcase-minimized-4526878557732864
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit f8593c2f492a514b67533a877b716a25d3770418)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/libvpxdec.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c index 5204c993cd..ad0ea3b02a 100644 --- a/libavcodec/libvpxdec.c +++ b/libavcodec/libvpxdec.c @@ -244,6 +244,13 @@ static int vpx_decode(AVCodecContext *avctx, (img_alpha = vpx_codec_get_frame(&ctx->decoder_alpha, &iter_alpha)))) { uint8_t *planes[4]; int linesizes[4]; + + if (img->d_w > img->w || img->d_h > img->h) { + av_log(avctx, AV_LOG_ERROR, "Display dimensions %dx%d exceed storage %dx%d\n", + img->d_w, img->d_h, img->w, img->h); + return AVERROR_EXTERNAL; + } + if ((ret = set_pix_fmt(avctx, img, ctx->has_alpha_channel)) < 0) { #ifdef VPX_IMG_FMT_HIGHBITDEPTH av_log(avctx, AV_LOG_ERROR, "Unsupported output colorspace (%d) / bit_depth (%d)\n", |