From patchwork Sat Jul 13 15:51:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 50526 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:2298:b0:482:c625:d099 with SMTP id fp24csp1432451vqb; Sat, 13 Jul 2024 09:01:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXx7/41heD+AE+JWwFOytmXDCGMEh/imBmoZxcYqXNaEM7HVXVmyfFkmmsgtjU8Z3x9QhIfLzfGnw75Pj+ZkW3BZrloDYPQH4UwIQ== X-Google-Smtp-Source: AGHT+IErRuARtz4GG0xNFxYp201LZK3KltcGmm2GliQQTE5DqH0GoqxwvyS4AwdV1yWKOGzajcr3 X-Received: by 2002:a50:d70b:0:b0:582:7394:a83d with SMTP id 4fb4d7f45d1cf-59af7f2dc2fmr1396526a12.12.1720886508784; Sat, 13 Jul 2024 09:01:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720886508; cv=none; d=google.com; s=arc-20160816; b=D0N6zQjy9sJjtkbduQPQt15vK3jlcRMzbXJV7p7zPbyNSrUfo9BUObOt3F/kZsuuN1 T3/2z4njfiXO2IL+FDr02mrkuUm1WESlZUWfwSBBZECV91XQN3iOq29DN5HChJvLp+Da aLs/h4QLVusYLbetFl2g2c0Jh5mj66TJc6q/K6sS6KEeg2UmK+9lawoVzcVmZs9nkPpu e54+3VOTcNLPRHtBWaxax3nWGC7MmWcX78fxu7tfGyGx7HcpVeUqgV7NWkUYt5nMStgh CmXIopA+gxCgYYnhWkMqi6UmxM4qhe/ukKK1eEghfiJ6zE0Cr54veguqg1U/laJmympw 7gIw== 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:message-id:date:to:from :dkim-signature:delivered-to; bh=e/8kVyGbWQmh1eYbkPYSdQnuhKLcmP3Ecj1xEdPO8wA=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=BRgfBGrcHxQET/ts7E4lSF9v8XeYy7Kdq2ZlWjFuL4Rl1NfBlRFmn1Ydw58y5+mD2I vDQ/swybWU2zkO5t4p9AQownKWX+UJ5NuqqpaVqN1049jU1QGKFYkEUtXKeGknwQZUVD oTEVvlqjgjMcOIc21lS9QSaHYCesq6QUizLINJf1tzzBYtwDQZhVDDetrivUTkIjmI59 ishY5AZFzXsrsYsold/zyVZWhU3YgX3mxaMhD3wU6FCAP/aECmlOmC1NIfvsruWncI+a An9wPMQW/rALz0HjxwFPns/vPiIdaZg4c8p8LDj0Av2nF39b8xlOsvXgz34ONv6O2yBX LB6g==; 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=HHrBpH27; 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-59b26a8dabesi715146a12.249.2024.07.13.09.01.48; Sat, 13 Jul 2024 09:01:48 -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=HHrBpH27; 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 41A9268DB36; Sat, 13 Jul 2024 18:51:14 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 16E7568D9E2 for ; Sat, 13 Jul 2024 18:51:07 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 6BEB21C0005 for ; Sat, 13 Jul 2024 15:51:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1720885866; 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; bh=BeKaJwR+U2c73fJdnRqaYp8ez9HXTb6ktgeYgyakjrE=; b=HHrBpH2751nBeooIXVHjsV6RW0rsPHtfUecHTXAB8YaRt9V+KS53nAIvx7T5ZvaPcN/zoF 66uj9WMKBcoKpg0ivAQisDvs3AInGNJlqtZ0hA4Lc4fh96OKlwiNTmn9SdM8xLRwDgyq7f z7hybpY+z5uQ0ZD4SPeBjCtuzbwzrHpmdLTPXKHOoBc4Q/RliMaMKaEJoc6fUZ/IWZVFk4 F3ZH9HE8ODBFIdxaj5A67d+lqyMRi2upX/vgY8I0SPPxWe5qJDAVSA6FLjTCcw05/sf5Yd 03EAOiht1l8lk165aCCfUe8saQZxwogdvX8rmZz5A8YW7AdqHawxaLrYKM97nQ== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 13 Jul 2024 17:51:03 +0200 Message-ID: <20240713155105.2161442-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 1/3] avformat/lmlm4: Move subtraction after check 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: u3Sxm4yhIWZf This is not a bugfix in code but coverity only, it does look a little nicer though Fixes: CID732224 Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavformat/lmlm4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/lmlm4.c b/libavformat/lmlm4.c index 209b544ccd8..c8355e7a8d6 100644 --- a/libavformat/lmlm4.c +++ b/libavformat/lmlm4.c @@ -91,7 +91,6 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) frame_type = avio_rb16(pb); packet_size = avio_rb32(pb); padding = -packet_size & 511; - frame_size = packet_size - 8; if (frame_type > LMLM4_MPEG1L2 || frame_type == LMLM4_INVALID) { av_log(s, AV_LOG_ERROR, "invalid or unsupported frame_type\n"); @@ -102,6 +101,7 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) return AVERROR(EIO); } + frame_size = packet_size - 8; if ((ret = av_get_packet(pb, pkt, frame_size)) <= 0) return AVERROR(EIO); From patchwork Sat Jul 13 15:51:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 50530 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:2298:b0:482:c625:d099 with SMTP id fp24csp1493327vqb; Sat, 13 Jul 2024 11:56:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUNwmfme74oTUkWMC74o7j/ZDzfX43gRdCvPkzrTOFv051JrDGQCcfGOhhwHCdd3TkEtVuT3nxGcSS617MFxLm8/Z46G5H8m3bSkA== X-Google-Smtp-Source: AGHT+IHK/KT93GsV1kbckpCnmi+erSJGY176Gd2aVZcfsoBmTYjgZn874o0ehu9QRgYafrpjwp1f X-Received: by 2002:a05:651c:200f:b0:2ee:8555:4742 with SMTP id 38308e7fff4ca-2eeb30fe842mr85604251fa.27.1720897005184; Sat, 13 Jul 2024 11:56:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720897005; cv=none; d=google.com; s=arc-20160816; b=DEkiB+GvDTqoMUKdU8Jr510xoi4v5yfnhbfQl8oxTqQjOKQK8gcvNLivhlD+gBC6V8 R9J+2J8Ayhl/vSZqnzZ0tILqr5n9h1Q4sA1f4Avr3Pf8WY3Zde/OBuruN8isnN0bXhIl J2CrGeCz0UN4SuHnFMQaEZ7o37gmnt5/wcHmGUa/Ppy4L4x3NDLZw3Iaj5gRqOGPaBPX g45o8sKPKgNMyP5sJOuj7Kk9B1g/qt6gOEBAVLJa5D4ndTKB+iTNEI86OmRCKTP3WrA3 eTEFW3sIg1mrrV5/yJ4d6wRFPX1oyHNZJjDaqS7JJ4r0K3y2ay6V8BZqX5Z8UnFNPv/O UkZw== 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=AvPzX8Pz785xM03p8thc0Ke4gp9bW4WInLxTQvEoEz8=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=alr39ZMKQJKrSmkZSvF/pXYu3q+SYDZS+C5BndBzyCFQvEj+dhOD6P5h9kLxJ5ig5z op54jZ90alY1f/WG+IBeEzIoQDN6PE6KUKoBZqFgJn5J6HgAPC19TKI0w6P3Lb/xV/a3 I3hdv3TpSV/VLgZ1SaAz772jPboosB9Xsv7Zcwj9DT09wJ1of8CKYfHLbI3h3cOSNh6y ayRPqLdt2kp9JHRSDLPAss0vS0aMEgW6fdjEB2iZNXl2+hu2Of8Tck6B43Ah/O/p3LR5 /nGOlTKyFA2Z4UGMU2gUKtu/5TsM4VM6ENE+ohS8C4TCPldnZaq5UFEYszW+RoQdlRpc 9Q7g==; 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=UcZSEzwj; 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 38308e7fff4ca-2eee179d45bsi5027651fa.22.2024.07.13.11.56.44; Sat, 13 Jul 2024 11:56:45 -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=UcZSEzwj; 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 5B9FE68DBE6; Sat, 13 Jul 2024 18:51:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4E81868D9FF for ; Sat, 13 Jul 2024 18:51:08 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id A2B63E0004 for ; Sat, 13 Jul 2024 15:51:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1720885867; 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=vhZQn6BhPbrYMLCGKPcBKj72dtm/9TQjSpYtxS7N9fY=; b=UcZSEzwjiwYdvxQIeVJ3Qw70yePpDu6i0wwb/mnyRpsmdNJJeMJtIedmFfYnq6vGV/nTOu cg73tO9cyGplvDa2ghRSi6NkdFX4YX3qrOxSS+kxlZaU3+Pl7StRajpw49GQ/zoxewprvW CtNQVx7O6wSBYkQlCYRcqQaQ4XScJ0k8VLPF1PiscFoI9nPOhd1jUDtuGnAd+D1zkcjIY3 /bOfO3+60HABVeKYV7+Eeo86m4uCwBJTohtLlVRiM28Buc462RwristPjSxEMdz9dlBKxt +QvC8OKdyuTYeyJRryQVDsZXpeF2NkpoFyeOuyGUHtYED4qxvXhNsa+Ux8Vyog== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 13 Jul 2024 17:51:04 +0200 Message-ID: <20240713155105.2161442-2-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 2/3] avformat/lmlm4: Eliminate some AVERROR(EIO) 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: OXs3hDJOXEZM Found by code review related to CID732224 Overflowed constant Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavformat/lmlm4.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/lmlm4.c b/libavformat/lmlm4.c index c8355e7a8d6..cec2f7ca051 100644 --- a/libavformat/lmlm4.c +++ b/libavformat/lmlm4.c @@ -94,16 +94,16 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) if (frame_type > LMLM4_MPEG1L2 || frame_type == LMLM4_INVALID) { av_log(s, AV_LOG_ERROR, "invalid or unsupported frame_type\n"); - return AVERROR(EIO); + return AVERROR_INVALIDDATA; } if (packet_size > LMLM4_MAX_PACKET_SIZE || packet_size<=8) { av_log(s, AV_LOG_ERROR, "packet size %d is invalid\n", packet_size); - return AVERROR(EIO); + return AVERROR_INVALIDDATA; } frame_size = packet_size - 8; if ((ret = av_get_packet(pb, pkt, frame_size)) <= 0) - return AVERROR(EIO); + return ret < 0 ? ret : AVERROR(EIO); avio_skip(pb, padding); 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;