mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avfilter/vf_minterpolate: Check pts before division
Fixes: FPE Fixes: tickets/10758/poc20ffmpeg Discovered by Zeng Yunxiang Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
08bd2cbfeb
commit
68146f06f8
@ -1075,8 +1075,13 @@ static void interpolate(AVFilterLink *inlink, AVFrame *avf_out)
|
||||
pts = av_rescale(avf_out->pts, (int64_t) ALPHA_MAX * outlink->time_base.num * inlink->time_base.den,
|
||||
(int64_t) outlink->time_base.den * inlink->time_base.num);
|
||||
|
||||
alpha = (pts - mi_ctx->frames[1].avf->pts * ALPHA_MAX) / (mi_ctx->frames[2].avf->pts - mi_ctx->frames[1].avf->pts);
|
||||
alpha = av_clip(alpha, 0, ALPHA_MAX);
|
||||
if (mi_ctx->frames[2].avf->pts > mi_ctx->frames[1].avf->pts) {
|
||||
alpha = (pts - mi_ctx->frames[1].avf->pts * ALPHA_MAX) / (mi_ctx->frames[2].avf->pts - mi_ctx->frames[1].avf->pts);
|
||||
alpha = av_clip(alpha, 0, ALPHA_MAX);
|
||||
} else {
|
||||
av_log(ctx, AV_LOG_DEBUG, "duplicate input PTS detected\n");
|
||||
alpha = 0;
|
||||
}
|
||||
|
||||
if (alpha == 0 || alpha == ALPHA_MAX) {
|
||||
av_frame_copy(avf_out, alpha ? mi_ctx->frames[2].avf : mi_ctx->frames[1].avf);
|
||||
|
Loading…
Reference in New Issue
Block a user