Skip to content

Commit

Permalink
avfilter/vf_xfade: Check ff_inlink_consume_frame() for failure
Browse files Browse the repository at this point in the history
Fixes: CID1458043 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 73ca4e7)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
  • Loading branch information
michaelni committed Jul 25, 2024
1 parent dc2b488 commit 224dd41
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions libavfilter/vf_xfade.c
Original file line number Diff line number Diff line change
Expand Up @@ -2288,17 +2288,26 @@ static int xfade_activate(AVFilterContext *avctx)
// Check if we are not yet transitioning, in which case
// just request and forward the input frame.
if (s->start_pts > s->pts) {
int ret;
s->passthrough = 1;
ff_inlink_consume_frame(in_a, &s->xf[0]);
ret = ff_inlink_consume_frame(in_a, &s->xf[0]);
if (ret < 0)
return ret;
return ff_filter_frame(outlink, s->xf[0]);
}
s->passthrough = 0;

// We are transitioning, so we need a frame from second input
if (ff_inlink_check_available_frame(in_b)) {
int ret;
ff_inlink_consume_frame(avctx->inputs[0], &s->xf[0]);
ff_inlink_consume_frame(avctx->inputs[1], &s->xf[1]);
ret = ff_inlink_consume_frame(avctx->inputs[0], &s->xf[0]);
if (ret < 0)
return ret;
ret = ff_inlink_consume_frame(avctx->inputs[1], &s->xf[1]);
if (ret < 0) {
av_frame_free(&s->xf[0]);
return ret;
}

// Calculate PTS offset to first input
if (s->inputs_offset_pts == AV_NOPTS_VALUE)
Expand Down

0 comments on commit 224dd41

Please sign in to comment.