huffyuvdec: validate image size

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit 9a345802ed)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
This commit is contained in:
Andreas Cadhalpun 2015-06-28 11:21:54 +02:00
parent 4410505b42
commit 31ae0693d8
1 changed files with 5 additions and 0 deletions

View File

@ -37,6 +37,7 @@
#include "huffyuv.h" #include "huffyuv.h"
#include "huffyuvdsp.h" #include "huffyuvdsp.h"
#include "thread.h" #include "thread.h"
#include "libavutil/imgutils.h"
#include "libavutil/pixdesc.h" #include "libavutil/pixdesc.h"
#define classic_shift_luma_table_size 42 #define classic_shift_luma_table_size 42
@ -277,6 +278,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
HYuvContext *s = avctx->priv_data; HYuvContext *s = avctx->priv_data;
int ret; int ret;
ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
if (ret < 0)
return ret;
ff_huffyuvdsp_init(&s->hdsp); ff_huffyuvdsp_init(&s->hdsp);
memset(s->vlc, 0, 4 * sizeof(VLC)); memset(s->vlc, 0, 4 * sizeof(VLC));