aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2023-12-23 18:04:32 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2023-12-29 19:29:07 +0100
commit61e73851a33f0b4cb7662f8578a4695e77bd3c19 (patch)
tree9584d2331cbd220175e579c47927b2b2a3f13b08
parent50f0f8c53c818f73fe2d752708e2fa9d2a2d8a07 (diff)
downloadffmpeg-61e73851a33f0b4cb7662f8578a4695e77bd3c19.tar.gz
avfilter/f_reverse: Apply PTS compensation only when pts is available
Fixes: out of array access Fixes: tickets/10753/poc16ffmpeg Regression since: 45dc668aea0edac34969b5a1ff76cf9ad3a09be1 Found-by: Zeng Yunxiang Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavfilter/f_reverse.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavfilter/f_reverse.c b/libavfilter/f_reverse.c
index 086819a207..744f4a3cc8 100644
--- a/libavfilter/f_reverse.c
+++ b/libavfilter/f_reverse.c
@@ -266,7 +266,8 @@ static int areverse_request_frame(AVFilterLink *outlink)
AVFrame *out = s->frames[s->nb_frames - 1];
out->duration = s->duration[s->flush_idx];
out->pts = s->pts[s->flush_idx++] - s->nb_samples;
- s->nb_samples += s->pts[s->flush_idx] - s->pts[s->flush_idx - 1] - out->nb_samples;
+ if (s->nb_frames > 1)
+ s->nb_samples += s->pts[s->flush_idx] - s->pts[s->flush_idx - 1] - out->nb_samples;
if (av_sample_fmt_is_planar(out->format))
reverse_samples_planar(out);