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

Stefano Sabatini git at videolan.org
Thu Dec 26 11:47:04 CET 2013


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Mon Dec 16 14:17:50 2013 +0100| [e2b54464c6a9de5d6b9ad4307696b0215d5e05a4] | committer: Stefano Sabatini

lavu/opt: fix range check logic in set_format()

In particular, allow to reject undefined values. Previously the code
was only accepting values in the range -1 .. NB_FORMATS-1.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e2b54464c6a9de5d6b9ad4307696b0215d5e05a4
---

 libavutil/opt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 0c7f442..723b443 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);
     }
     if (fmt < min || fmt > max) {
         av_log(obj, AV_LOG_ERROR,



More information about the ffmpeg-cvslog mailing list