[FFmpeg-devel] [PATCH 4/4] avutil/opt: add some checks for type vs. range

Stefano Sabatini stefasab at gmail.com
Mon Apr 15 21:58:37 CEST 2013


On date Saturday 2013-04-13 20:37:15 +0200, Michael Niedermayer encoded:
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
>  libavutil/opt.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavutil/opt.c b/libavutil/opt.c
> index 60d943c..1c4e40d 100644
> --- a/libavutil/opt.c
> +++ b/libavutil/opt.c
> @@ -72,8 +72,11 @@ const AVOption *av_opt_next(void *obj, const AVOption *last)
>              faulty |= (o->min > o->default_val.dbl || o->default_val.dbl > o->max);
>          } else if (o->type == AV_OPT_TYPE_INT || o->type == AV_OPT_TYPE_INT64) {
>              faulty |= (o->min > o->default_val.i64 || o->default_val.i64 > o->max);
> +            if (o->type == AV_OPT_TYPE_INT)
> +                faulty |= (o->min < INT_MIN || o->max > UINT_MAX);

can o->max be really > INT_MAX?

>          } else if (o->type == AV_OPT_TYPE_RATIONAL) {
>              faulty |= (o->min > av_q2d(o->default_val.q) || av_q2d(o->default_val.q) > o->max);

> +            faulty |= (o->min < INT_MIN || (o->max > INT_MAX && o->max != DBL_MAX));

can you explain this?

[...]
-- 
FFmpeg = Freak and Furious Mystic Practical Erotic Gymnast


More information about the ffmpeg-devel mailing list