1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avutil/opt: check flags validity in write_number()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-10-28 17:39:07 +01:00
parent c00686518c
commit 162126bb17

View File

@ -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: