From patchwork Fri Jan 28 02:08:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Liu X-Patchwork-Id: 33889 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2c4e:0:0:0:0 with SMTP id x14csp32864iov; Thu, 27 Jan 2022 18:09:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJyWowJOkV+Q6az4r/xEbEiw4RIf92UXMmw0UmBlr976CobGgj/UCLWkwTcueNAt5kHP/2TP X-Received: by 2002:a17:907:3f8b:: with SMTP id hr11mr5193778ejc.602.1643335788505; Thu, 27 Jan 2022 18:09:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643335788; cv=none; d=google.com; s=arc-20160816; b=esuXMkYP+coA4m58k90T4zQbY7XXdWDwZvk/WeZa/yFOdxn9ZRaey3RDULNutLMeom 0tAqBP6ls15RiPTk205T4VS7PwqwQKlwzwp0bRhPx1U6OaInLyJZBnQlG6fWCoIuBkqS p9Vesk4zGY7/M7MkqIRJ7KvqxC4XD0TKTp87aEqjiKcrpkGFS4oBvkCyvKaJjs+48D/D PZl2cIhiyptyGUMJvPsj703EqgNErOtVNaahI8tbsPCTRm7WuBLWg3Re+fpAV3u9AQDN aa9yrJ88sIulis7im+iw2ECmV4yxJl9pbw/ozBenWXGytR4pwB+OgHYrwYMP6efcqjNK 7Blg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:feedback-id:mime-version:message-id:date :to:from:delivered-to; bh=0WKcbbvPoFePe4JsdjCR1JVsdZI6tbDoHiMz/BXX6Rk=; b=IB1IhdcnKBPmYI85290U4KDIN33/9kk/fOwyxX57qb//dz3dhMVXMWcpZi3ZkttcYn 2sbz/8zFF+xwJgyp8XNSH1uroB5+1BSbzeSLjRd9hMp3tnwIZ+tvkQRHEVkjdOw09fL+ LHyNDCy86HGD7zmr6G3LbiZgAm7f8JP5+qEdHsat3uRf9sFLVGu15Fc2JWhEAnz9quJc HrNf7K4nKLdWf50hHVTp19X6+hQ+b/MwNQxa0wRvW9+3+BSds+5vrsyS6Q7B3sGXohoD PqwPY851qcscJELI3T6+YkKoylm+qOMWP58zTNC+2wKJdNRBrFgf4LHD65uv5rvE4YWY kEgg== ARC-Authentication-Results: i=1; mx.google.com; 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 z3si2458563edc.168.2022.01.27.18.09.48; Thu, 27 Jan 2022 18:09:48 -0800 (PST) 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; 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 2F36B68B207; Fri, 28 Jan 2022 04:09:46 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbg.qq.com (smtpbg127.qq.com [109.244.180.96]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4DE8E68B094 for ; Fri, 28 Jan 2022 04:09:38 +0200 (EET) X-QQ-mid: bizesmtp16t1643335702tjyd9rz8 Received: from localhost (unknown [103.107.216.237]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 28 Jan 2022 10:08:21 +0800 (CST) X-QQ-SSF: 01100000002000Z0Z000B00A0000000 X-QQ-FEAT: 7IYoDWSuGNeerthi7oHxL0aqw3ZJnrO0/9ghbWq0EOqYgYaCAk8qn/+KthkRu +t8bsQieHfSZpDLWw9xbZ+NJmeGow3y6GrtSC/JUnJIYjuYyrVnzrcNLVWBn7NVPZl9yXWc z8RBsaKHgcfJHnPVnRVPSlzXICqx5OmaWJJcP7BFr5GjwUzBSSgwybe/N23RU7Rq+yDwspI EfdBqWWKlAbFXv/zrK0bpqxFRLYcVyKMJFmn0vUidKPqR+OnYaNeg9T3tQPwFKAsSmOKRpU YgYk8FFmtLlBx06UyIomkE8jYDWVVsZN75iuAaHmVh8Ur7 X-QQ-GoodBg: 0 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Fri, 28 Jan 2022 10:08:17 +0800 Message-Id: <20220128020818.39850-1-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybgspam:qybgspam1 Subject: [FFmpeg-devel] [PATCH 1/2] avutil/tx: remove deadcode of the control flow 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 Cc: Steven Liu Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: mZNRauDf7esJ From: Steven Liu Fix CID: 1497864 The control flow should return ENOSYS if nb_cd_matches is 0 at before and the ret equal AVERROR(ENOMEM) or goto end label, so remove the last control flow if (ret >= 0) before end label. Signed-off-by: Steven Liu --- libavutil/tx.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavutil/tx.c b/libavutil/tx.c index 2897f3bd35..50616adba7 100644 --- a/libavutil/tx.c +++ b/libavutil/tx.c @@ -601,9 +601,6 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type, av_free(sub); - if (ret >= 0) - ret = AVERROR(ENOSYS); - end: av_free(cd_matches); return ret; From patchwork Fri Jan 28 02:08:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Liu X-Patchwork-Id: 33888 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2c4e:0:0:0:0 with SMTP id x14csp32297iov; Thu, 27 Jan 2022 18:08:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJyNqywrfAqS1D08P71nm10YqvFKfla7AXx6csWb2pd5uZud4rm9AtZOg+oW6z7XWZ9Xwyde X-Received: by 2002:a17:907:3ea4:: with SMTP id hs36mr4964825ejc.737.1643335726644; Thu, 27 Jan 2022 18:08:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643335726; cv=none; d=google.com; s=arc-20160816; b=j2NQxN2E52cJU4kuX054oBvRKVeN9u6z0jzUWMlrTSF7ng4ZhXQXYHSNj9rYy5avSJ K5stom6GVHgWPL2scWwdBmVKrXieNWdo2t6DGmnaEIaQHwcTCqPjf/nFZDyhzd+ZRyVK elyqmZ8mTJb0aZsiuhD5iPqfjVOmK7M5d+GUModZWlHUnelH5/yukxmblVOF60FPgySr 5Esgx2bcvfdW9qyh01IO5gvGVWYQTq5FtXX9tjE+x+DlDUEF/vj3mjrGAg16yTXY7MJa 2+XvCHIrGlgeAqLhembZoR/Mgmb1qKx0utOm8QMgkqbKsKDDrErxRLBGlUnt9fDYO89/ 4DsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:feedback-id:mime-version:references :in-reply-to:message-id:date:to:from:delivered-to; bh=/1z+xqEf3ifKa+2kqPKzyIYRXbXi2NKTPV+biJVDrCw=; b=T5Rks1/D3zDBOodudELPp6R1wjh8HLdbazn3LFWaO+5gIJD6R7TlploRR4gyvxKn3a SkDhzLSi1GrU2pp3Dts08QMvmEybtyWvlcepspz7aQsdUx3IOVKE3W2g12cW9c/cMnb7 WER0vN3OlZ2IkNZPeMQmmFWhX2zAboClnNxw1lfcScuba6f0DWW652dpVSQ/di0QM03Y rmYIbZ2ew+oKoihwosKkVA2X+Lg0FnyOKx6gLDAgXkS84TEGXzu5QD6axZD3WGMUTyya SeAavZ4RK0j9c5o3bEUXA9C0qViFcp1b2krZfgKpFNpib5a2qVWDYU0ihrkHfiWlyv1c IaBQ== ARC-Authentication-Results: i=1; mx.google.com; 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 sh31si2305895ejc.857.2022.01.27.18.08.44; Thu, 27 Jan 2022 18:08:46 -0800 (PST) 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; 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 0621A68B1F9; Fri, 28 Jan 2022 04:08:40 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbg587.qq.com (smtpbg587.qq.com [113.96.223.105]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0FB2368B10B for ; Fri, 28 Jan 2022 04:08:32 +0200 (EET) X-QQ-mid: bizesmtp47t1643335708tq4dlhxu Received: from localhost (unknown [103.107.216.237]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 28 Jan 2022 10:08:27 +0800 (CST) X-QQ-SSF: 01100000002000Z0Z000B00A0000000 X-QQ-FEAT: FXvDfBZI5O6ov/U5V5bFXsYj4q1u45LqD5qS/FADPdGt8Yt4bkFWfgVAFoDrH UxmqeDppdzgdR6lvt4Rz07K3ki6NhaMBSemRF7p5JYuTAfsZ8W7ad3OmeJkzCXy16Ox/2eU ckty0pWUXTvDeI7Wyb/FPrSHfhatFSgYn2Ur/7NudZx7beshvWDjRbM1GAXo57lt4GTpUv3 WgdlpxXDLxlx/iRajDHkJFuvP6Zk0zfcX72KpOicCEr3wNprHN4I8GYrVOQmVyOkrtaI0Vx G1eRg3MO/0BJBvIKjYOiAiu7swwdbX6aq30kg1isU2M20ZGeRpMomsvpqvjO1/jgRhCxt13 d6h/InF X-QQ-GoodBg: 0 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Fri, 28 Jan 2022 10:08:18 +0800 Message-Id: <20220128020818.39850-2-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20220128020818.39850-1-lq@chinaffmpeg.org> References: <20220128020818.39850-1-lq@chinaffmpeg.org> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybgspam:qybgspam3 Subject: [FFmpeg-devel] [PATCH 2/2] avutil/tx: add null pointer check after av_mallocz 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 Cc: Steven Liu Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 1vfX4Ffhy5mI From: Steven Liu Fix CID: 1497863 there will get null pointer in attempt to initialize each if alloc memory failed. Signed-off-by: Steven Liu --- libavutil/tx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavutil/tx.c b/libavutil/tx.c index 50616adba7..79c9477d7f 100644 --- a/libavutil/tx.c +++ b/libavutil/tx.c @@ -567,6 +567,10 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type, if (!s->sub) s->sub = sub = av_mallocz(TX_MAX_SUB*sizeof(*sub)); + if (!s->sub) { + ret = AVERROR(ENOMEM); + goto end; + } /* Attempt to initialize each */ for (int i = 0; i < nb_cd_matches; i++) {