From patchwork Sat Jul 13 15:51:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 50525 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:2298:b0:482:c625:d099 with SMTP id fp24csp1428683vqb; Sat, 13 Jul 2024 08:51:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVEwbPNpNbLSZB/5x8KEVf2jFwZUQha5oltrhZdduRh9OMBtxX/r1FfDT6H7a2SecYfs+eKE0X0E7gxi+ro4DChJO2s4cCfZbrdNg== X-Google-Smtp-Source: AGHT+IHcHVnCdF6sBS3yLm/lpmygRY2TWXSTwJ6HBib2Gq+UhMlFBvYc9JAXCc6iHbShZP2mzdxr X-Received: by 2002:a50:9ee9:0:b0:57d:5442:a709 with SMTP id 4fb4d7f45d1cf-5995b5b2bafmr4808050a12.0.1720885895891; Sat, 13 Jul 2024 08:51:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720885895; cv=none; d=google.com; s=arc-20160816; b=CUFPXdb/yFt7WffIdmZwxNg9vVGS7m9UVUEbQIJrpN8RuZrqtR9fzOp4Ls4BxWg9mv JnZSSQR16FMXs5AnhGNjenp5ZeZwJocGiYsOysWAjkH5DLRfed6kYZj0k/9GS0EPWBZx A37gSY0Go5/gzrtkHdTxsveOnLKC2XwPmJk866vQf6fZuxBv67I+YFmZozYJ1yRcJEaH YyON0CE60rzYOSMJs9iIL0gmKYYmYcmXPFfzidZtPmYjvgz7FFkXf8ydouNzWgh9qy4U p3teSqvJjtWli6+SS4zI12se17QiF+qSJZc7oW+ddUYDKiCAOIs/ajtKaZ0c4oGs/NGl G4YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=Uo6ASWQsEZRfBVpL+DLw2nhxPuQyf4E/dEnKHDJdYU8=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=ecfdudrasIiPDvvAGMDUOTy5woKjiymU4El2PRfYrxIi92q278KZasHjKJnnPLSi99 muh22BLW344n3+OLDwKDoc2czFixGhi/6iZpnmpIbPXKvgVZSHZaxYiGbsgOs/KSv1KM Gyf5lw28sN+O5xSzmIqv62IOJ6Z0KHuAu8ZGkooMjNb1c/k4ja719xjXHmWZXcNdKJKT i69Tk0DZHrEm2Qsm1aoioxxOsmHO0yNu7daNgH2noAqVn0ncNJoipfU9F2cISoUvDz8P DYurj97bxLKC4zdSJZg3YxeL0vBsCW6Hl92Vb60epmi+wpoop3HBH0V+wj+khB+pQjNC nyug==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=T3UHVBXe; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-59b2705a9c0si681459a12.424.2024.07.13.08.51.35; Sat, 13 Jul 2024 08:51:35 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=T3UHVBXe; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id ACF9968DC14; Sat, 13 Jul 2024 18:51:16 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9456168DBF2 for ; Sat, 13 Jul 2024 18:51:09 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id C5CC240003 for ; Sat, 13 Jul 2024 15:51:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1720885868; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fWw91g0nHAlo/2Vv905qXIl46TnVIm7yR7TK+4A8fec=; b=T3UHVBXefjYWrHDgYb5Ak3Rgg9p60c4HRvf9DuUyvj88EIigARE+3YrV4pZcIQUmBYuv78 I0njUI6fUgHLZfTtOktunw+9l4VbwCatgr+PEVFsBgeTzFdFp6srL5+plYPpUqAmMWBjnx qMV1pwijqxfd5fWZ7aUWGFBYZF+pCi/wxY9mQNCXAYb1dhOFFWRs1f2DqSBgei+5nn41yk e+yQEDCZGQp50XTNV8o8ta01bTew/XW0t2p+eCzRxoEgMApr41+Mds4Q0fPOsVRbEDgfC6 zfh8I0ZvczNy3+coASk9AobqwH5OgAtfIpqpEr4ylKPDCPSUTRLjAhm/oaWx0Q== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 13 Jul 2024 17:51:05 +0200 Message-ID: <20240713155105.2161442-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240713155105.2161442-1-michael@niedermayer.cc> References: <20240713155105.2161442-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 3/3] avfilter/vf_xfade_opencl: Check ff_inlink_consume_frame() for failure X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 3QH4KL1EA9Xt Fixes: CID1458127 Unchecked return value Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavfilter/vf_xfade_opencl.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_xfade_opencl.c b/libavfilter/vf_xfade_opencl.c index 2368c046b4d..8582230924a 100644 --- a/libavfilter/vf_xfade_opencl.c +++ b/libavfilter/vf_xfade_opencl.c @@ -293,7 +293,9 @@ static int xfade_opencl_activate(AVFilterContext *avctx) if (ctx->first_pts + ctx->offset_pts > ctx->xf[0]->pts) { ctx->xf[0] = NULL; ctx->need_second = 0; - ff_inlink_consume_frame(avctx->inputs[0], &in); + ret = ff_inlink_consume_frame(avctx->inputs[0], &in); + if (ret < 0) + return ret; return ff_filter_frame(outlink, in); } @@ -302,8 +304,14 @@ static int xfade_opencl_activate(AVFilterContext *avctx) } if (ctx->xf[0] && ff_inlink_queued_frames(avctx->inputs[1]) > 0) { - ff_inlink_consume_frame(avctx->inputs[0], &ctx->xf[0]); - ff_inlink_consume_frame(avctx->inputs[1], &ctx->xf[1]); + ret = ff_inlink_consume_frame(avctx->inputs[0], &ctx->xf[0]); + if (ret < 0) + return ret; + ret = ff_inlink_consume_frame(avctx->inputs[1], &ctx->xf[1]); + if (ret < 0) { + av_frame_free(&ctx->xf[0]); + return ret; + } ctx->last_pts = ctx->xf[1]->pts; ctx->pts = ctx->xf[0]->pts;