1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

avutil/opt: Fix setting int64 to its maximum

Found-by: Andreas
Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer
2016-11-20 12:57:42 +01:00
parent 322568c079
commit 748ce9d702

View File

@@ -126,9 +126,13 @@ static int write_number(void *obj, const AVOption *o, void *dst, double num, int
break; break;
case AV_OPT_TYPE_DURATION: case AV_OPT_TYPE_DURATION:
case AV_OPT_TYPE_CHANNEL_LAYOUT: case AV_OPT_TYPE_CHANNEL_LAYOUT:
case AV_OPT_TYPE_INT64: case AV_OPT_TYPE_INT64:{
*(int64_t *)dst = llrint(num / den) * intnum; double d = num / den;
break; if (intnum == 1 && d == (double)INT64_MAX) {
*(int64_t *)dst = INT64_MAX;
} else
*(int64_t *)dst = llrint(d) * intnum;
break;}
case AV_OPT_TYPE_FLOAT: case AV_OPT_TYPE_FLOAT:
*(float *)dst = num * intnum / den; *(float *)dst = num * intnum / den;
break; break;