avutil/parseutils: do no rely on av_d2q returning higher num/den than allowed in av_parse_video_rate

This commit is contained in:
Marton Balint 2024-11-10 15:25:26 +01:00
parent e9af7b7b5d
commit 25efe34e6f
1 changed files with 3 additions and 0 deletions

View File

@ -193,6 +193,9 @@ int av_parse_video_rate(AVRational *rate, const char *arg)
/* Then, we try to parse it as fraction */ /* Then, we try to parse it as fraction */
if ((ret = av_parse_ratio_quiet(rate, arg, 1001000)) < 0) if ((ret = av_parse_ratio_quiet(rate, arg, 1001000)) < 0)
return ret; return ret;
if (!rate->num || !rate->den)
if ((ret = av_parse_ratio_quiet(rate, arg, INT_MAX)) < 0)
return ret;
if (rate->num <= 0 || rate->den <= 0) if (rate->num <= 0 || rate->den <= 0)
return AVERROR(EINVAL); return AVERROR(EINVAL);
return 0; return 0;