[FFmpeg-devel] [PATCH] lavu/opt: fix range check logic in set_format()

Michael Niedermayer michaelni at gmx.at
Mon Dec 16 17:03:26 CET 2013


On Mon, Dec 16, 2013 at 04:04:11PM +0100, Stefano Sabatini wrote:
> In particular, allow to reject undefined values. Previously the code
> was only accepting values in the range -1 .. NB_FORMATS-1.
> ---
>  libavutil/opt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavutil/opt.c b/libavutil/opt.c
> index f6aa496..9f531e4 100644
> --- a/libavutil/opt.c
> +++ b/libavutil/opt.c
> @@ -559,8 +559,8 @@ static int set_format(void *obj, const char *name, int fmt, int search_flags,
>      } else
>  #endif
>      {
> -        min = FFMIN(o->min, -1);
> -        max = FFMAX(o->max, nb_fmts-1);
> +        min = FFMAX(o->min, -1);
> +        max = FFMIN(o->max, nb_fmts-1);
>      }

LGTM

maybe wait with this though after nicolas or others add av_asserts
to check that all the min/max values make sense

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131216/a0133b8e/attachment.asc>


More information about the ffmpeg-devel mailing list