[FFmpeg-devel] [PATCH] huffyuvdec: validate image size

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Sat Jun 27 19:42:48 CEST 2015


Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
---
 libavcodec/huffyuvdec.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index 98c6128..71fb9e3 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -291,6 +291,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
     HYuvContext *s = avctx->priv_data;
     int ret;
 
+    if (avctx->width <= 0 || avctx->height <= 0) {
+        av_log(avctx, AV_LOG_ERROR, "invalid image size %dx%d\n",
+               avctx->width, avctx->height);
+        return AVERROR_INVALIDDATA;
+    }
+
     ff_huffyuvdsp_init(&s->hdsp);
     memset(s->vlc, 0, 4 * sizeof(VLC));
 
-- 
2.1.4


More information about the ffmpeg-devel mailing list