diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-10-28 20:39:07 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-10-28 21:03:29 +0400 |
commit | 162126bb174c9ad690736d16c6f8b431b7127c5b (patch) | |
tree | 04d87c90a02c894048b24211e76328ed38036f81 /libavutil | |
parent | c00686518c0b80905f785b0e29a75b6fb806553e (diff) |
avutil/opt: check flags validity in write_number()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/opt.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c index 2bf5346ac2..e00bd746d1 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -99,6 +99,15 @@ static int write_number(void *obj, const AVOption *o, void *dst, double num, int num*intnum/den, o->name, o->min, o->max); return AVERROR(ERANGE); } + if (o->type == AV_OPT_TYPE_FLAGS) { + double d = num*intnum/den; + if (d < -1.5 || d > 0xFFFFFFFF+0.5 || (lrint(d*256) & 255)) { + av_log(obj, AV_LOG_ERROR, + "Value %f for parameter '%s' is not a valid set of 32bit integer flags\n", + num*intnum/den, o->name); + return AVERROR(ERANGE); + } + } switch (o->type) { case AV_OPT_TYPE_FLAGS: |