34 lines
1.4 KiB
Diff
34 lines
1.4 KiB
Diff
From faedf9f8ef5b657064ecf6af8d1ba767ada60bf4 Mon Sep 17 00:00:00 2001
|
|
From: happyworker <208suo@208suo.com>
|
|
Date: Tue, 25 Jun 2024 10:58:39 +0800
|
|
Subject: [PATCH] fix-CVE-2023-51798
|
|
|
|
---
|
|
libavfilter/vf_minterpolate.c | 10 +++++++---
|
|
1 file changed, 7 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/libavfilter/vf_minterpolate.c b/libavfilter/vf_minterpolate.c
|
|
index b0bb238..745987c 100644
|
|
--- a/libavfilter/vf_minterpolate.c
|
|
+++ b/libavfilter/vf_minterpolate.c
|
|
@@ -1086,9 +1086,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);
|
|
return;
|
|
--
|
|
2.43.0
|
|
|