[FFmpeg-devel] [PATCH] opt: check image size when setting it

Carl Eugen Hoyos ceffmpeg at gmail.com
Sat Dec 10 18:00:11 EET 2016


2016-12-10 16:55 GMT+01:00 Andreas Cadhalpun <andreas.cadhalpun at googlemail.com>:
> On 10.12.2016 16:19, Carl Eugen Hoyos wrote:
>> 2016-12-10 16:11 GMT+01:00 Andreas Cadhalpun <andreas.cadhalpun at googlemail.com>:
>>> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
>>> ---
>>>  libavutil/opt.c | 10 +++++++++-
>>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/libavutil/opt.c b/libavutil/opt.c
>>> index f855ccb..f713d3f 100644
>>> --- a/libavutil/opt.c
>>> +++ b/libavutil/opt.c
>>> @@ -32,6 +32,7 @@
>>>  #include "common.h"
>>>  #include "dict.h"
>>>  #include "eval.h"
>>> +#include "imgutils.h"
>>>  #include "log.h"
>>>  #include "parseutils.h"
>>>  #include "pixdesc.h"
>>> @@ -325,8 +326,15 @@ static int set_string_image_size(void *obj, const AVOption *o, const char *val,
>>>          return 0;
>>>      }
>>>      ret = av_parse_video_size(dst, dst + 1, val);
>>> -    if (ret < 0)
>>> +    if (ret < 0) {
>>>          av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as image size\n", val);
>>> +        return ret;
>>> +    }
>>> +    ret = av_image_check_size(*dst, *(dst + 1), 0, obj);
>>> +    if (ret < 0) {
>>> +        *dst = 0;
>>> +        *(dst + 1) = 0;
>>> +    }
>>
>> Doesn't this break valid usecases?
>
> None that I'm aware of. Which usecases were you thinking about?

I thought that if this check is more strict than it was, there must
be a usecase that breaks but I wasn't immediately successful
in finding one.

Carl Eugen


More information about the ffmpeg-devel mailing list