History

avfilter/vf_xfade: Check ff_inlink_consume_frame() for failure

Fixes: CID1458043 Unchecked return value

Michael Niedermayer committed 2 years ago

Commit 73ca4e71 parent 23851c91 file · +12 −3Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_xfade.c+12−3
@@ -2288,8 +2288,11 @@ static int xfade_activate(AVFilterContext *avctx) · 2287 unmodified lines
22882288 // Check if we are not yet transitioning, in which case
22892289 // just request and forward the input frame.
22902290 if (s->start_pts > s->pts) {
2291+ int ret;
22912292 s->passthrough = 1;
2292− ff_inlink_consume_frame(in_a, &s->xf[0]);
2293+ ret = ff_inlink_consume_frame(in_a, &s->xf[0]);
2294+ if (ret < 0)
2295+ return ret;
22932296 return ff_filter_frame(outlink, s->xf[0]);
22942297 }
22952298 s->passthrough = 0;
@@ -2297,8 +2300,14 @@ static int xfade_activate(AVFilterContext *avctx) · 1 unmodified line
22972300 // We are transitioning, so we need a frame from second input
22982301 if (ff_inlink_check_available_frame(in_b)) {
22992302 int ret;
2300− ff_inlink_consume_frame(avctx->inputs[0], &s->xf[0]);
2301− ff_inlink_consume_frame(avctx->inputs[1], &s->xf[1]);
2303+ ret = ff_inlink_consume_frame(avctx->inputs[0], &s->xf[0]);
2304+ if (ret < 0)
2305+ return ret;
2306+ ret = ff_inlink_consume_frame(avctx->inputs[1], &s->xf[1]);
2307+ if (ret < 0) {
2308+ av_frame_free(&s->xf[0]);
2309+ return ret;
2310+ }
23022311
23032312 // Calculate PTS offset to first input
23042313 if (s->inputs_offset_pts == AV_NOPTS_VALUE)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t