On 27.06.2015 22:40, Michael Niedermayer wrote:
> On Sat, Jun 27, 2015 at 07:42:48PM +0200, Andreas Cadhalpun wrote:
>> Signed-off-by: Andreas Cadhalpun <andreas.cadhal...@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) {
> 
> LGTM
> alternatively av_image_check_size() could be used but this should
> be equally fine

On 27.06.2015 22:40, Luca Barbato wrote:
> There is a function to validate the dimensions. That isn't enough, I
> think I sent a patch recently that does that for another codec.

OK, new patch using av_image_check_size attached.

Best regards,
Andreas
>From b840a905bebfb6549c1de689911dd740746627fa Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
Date: Sun, 28 Jun 2015 11:21:54 +0200
Subject: [PATCH] huffyuvdec: validate image size

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

diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index 98c6128..a99ac71 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -37,6 +37,7 @@
 #include "huffyuv.h"
 #include "huffyuvdsp.h"
 #include "thread.h"
+#include "libavutil/imgutils.h"
 #include "libavutil/pixdesc.h"
 
 #define classic_shift_luma_table_size 42
@@ -291,6 +292,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
     HYuvContext *s = avctx->priv_data;
     int ret;
 
+    ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
+    if (ret < 0)
+        return ret;
+
     ff_huffyuvdsp_init(&s->hdsp);
     memset(s->vlc, 0, 4 * sizeof(VLC));
 
-- 
2.1.4

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to