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

Michael Niedermayer michaelni at gmx.at
Sat Apr 13 20:37:15 CEST 2013


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);
         } 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));
         }
         faulty |= o->min > o->max;
         if (faulty) {
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list