From patchwork Thu Oct 7 09:09:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30958 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6506:0:0:0:0:0 with SMTP id z6csp1268511iob; Thu, 7 Oct 2021 02:10:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtcpCQotde0wn+c6NT5nIMaVT/zuMymI43/W4NHpY8vzqIdyG0SNzN28kd2kUY4Yg2CByP X-Received: by 2002:a17:907:1b1b:: with SMTP id mp27mr4104941ejc.538.1633597819741; Thu, 07 Oct 2021 02:10:19 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id j12si29035edt.33.2021.10.07.02.10.18; Thu, 07 Oct 2021 02:10:19 -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=@outlook.com header.s=selector1 header.b=YUz7OmdB; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E8A6668A1C3; Thu, 7 Oct 2021 12:10:14 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2059.outbound.protection.outlook.com [40.92.90.59]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C1920689F4F for ; Thu, 7 Oct 2021 12:10:08 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cQ4a6bLoOzhQlb8XDJKC3qaJStBH+JJJs7p5Nlj/q5aRfp1sNnBsZh7S135RtxhmVPGz0d+OIeUutUo+tIZqZaR71HK5q46eGmk7E7Dqmx8NodUa+YRg28EKfgzBSWT7QxBdAX2xqSerMhpginv2LnroqUeUCWZIYcbwGD5i4yCuigrCb2T6HCy9GoMCXi5gyguUgOttLqAbL/n6ULPYDToyaoFbMrvFlwf+8h0SP9OcsFqNuXQ4IRk23JauNiYfuSqQJOL8JyMu6guPrNB0sHxy/JRJThcgt7UxWSIwEuuHyGDzEt2C9sqikNLV4K/htRq+jF2RCBfhiHKHe89HLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=knXa2YdTm+tw2O2Z3g5sVOYsIdbRf0nIaq5DyOgCFFc=; b=nlOL3mwPOera1uObVe0WmH0x7k+uyBpH/Wb4gfHgLzNlLWRXVK50REdt68VB5u+2anJHOG2kHJ026WmT28n9X/9rfi1P4bSmT/a+81j7/j3NGHcbCHPphxYECOJUXfr4c/1eKkF6bGtZbbeVBl/Yv29UCanbvfa/c8pzrB+G/kV0+E7sW0gQY3d5AuCZxXG553Q3OiDJp4Wg3Y7I5G4bjyIxjbjBwQ9zweKf9uneUDHVWiyqMN49aciCuMh7Tu+v5vc8+azRtnbzwnZsgaPplFDqTTNXSmID6C0fC655xdJ4VFmcVQY+fGa878dGDVkQ1ukFIlojI/2xWAW1zSnyZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=knXa2YdTm+tw2O2Z3g5sVOYsIdbRf0nIaq5DyOgCFFc=; b=YUz7OmdBbwoyjTIDoc0SiH4wskUnesSx27FnFYm3nv+Wd8AAq9RjjRmjZLmhgvTna9abXVIVznszrU25iF9+JQ9DXWvf4NcLkARiy4w8J2iq104LucTw869jtGeGgIxMx3VZ6wjNa6abf0uKJQL1cVi++loQhl9EDTXtZqM5DroDahEXtcDqWflThnJPVSnOkkQCPsyaUn2XWF/Dx6+N9n9gNwkAjrklWRK3BF03D+aVLXDGFNgWv55klI9mB9XITqMrxegeD+CF5hJ3ue1kB7MOrCZ+jow3UbN0qpDCxdhhUrY6DOZf2F1vXxKX38+rMUdjo/n3zm++J+SG7gxNaw== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AS8PR03MB7045.eurprd03.prod.outlook.com (2603:10a6:20b:292::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.22; Thu, 7 Oct 2021 09:10:07 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::700f:d70b:3bb8:4d51]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::700f:d70b:3bb8:4d51%7]) with mapi id 15.20.4566.022; Thu, 7 Oct 2021 09:10:07 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 7 Oct 2021 11:09:50 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 X-TMN: [MZUwxoyKxl12ob9zlR2lxZ9qm/xTXcfB] X-ClientProxiedBy: ZRAP278CA0017.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:10::27) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211007090957.684660-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.193.170.49) by ZRAP278CA0017.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:10::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.16 via Frontend Transport; Thu, 7 Oct 2021 09:10:06 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 303a73aa-ddd4-4e67-df08-08d989724130 X-MS-Exchange-SLBlob-MailProps: EpEO96k6WokDOmO7FPg+hdJcmMDlskBuV0I6tsyjjLRHDOa2YihyIFyDSFVN/cKW6lSk7kZfcNlsVjj4EGKqc4WvSqXYiepfx99hTSPK17lIephJrG5fSt8oo92M38XY01slywptdqhkUimPdqE5zdd2fUiq/gMhW+9c1PVNlJ9Ae61m97V3FaYtjymHybIf+PIKzqu0qS/nHHiFz6zOMPOFudVOv44FE7lhx9dv6pHHb1TsTVOF6DVBLClP8FL8cTb+G/TQ4e55IBkkZAMsXy+H0FLrS1jfjUw/SJ9yVxoWo8ys3ORU/hHCr522c3ZD2R2BfrnRJC5xI+yiFOjAvgApQVToxHQizTXmmAMf3C4O5dmP6p6C+S743T0iRlymWphqZBjP+RbS83Zlo32h3bKIO1Jz1Lg62wNUoSRq0qOV+5/YHRaxtjF66VQ6aATBdCVBEw7u2U7kYc+lXNjn7Y1l777jjBjVxjs7Eqp22F3gfx1kibeH+5XFL1CEE9Qw+RdBhaL39GjaLit+Y0M04qcz1/leGaHVsu+bG+gOBLhGsDUJ+shyWS52vutSQjNcIz9VUohWFm6r7GnC0sljunn4I/nBt4b/IJyeson9/ZUPWxitYPQbjaXxPB4PrWjvGoMZV/Mk6CtmWfzMOrVOuVU9V92mlX1fUk431SW6eDI+0dGa/htOEG//MFI2mfX2Wy5Xjdvu2gIn4CaJh3g9B4godAVWgtCpp1i1IrZI/i4FUuWF7j1OXZDj/V3R2TaASysq1PcragM= X-MS-TrafficTypeDiagnostic: AS8PR03MB7045: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: juK+hT7YjjMwBkIyyVwqhh/FqR2JTBIYUfhQkcJX6KqYq4YmIMRbmJwdeQZ8gMmGHCKd3n8eP4ZBx6Xc/csTdagtDQ6J7j+tjgWfIA1v0ZusuHKwENzOSYiIU9Q/2aHZJrNR2MM9MDNruwiTXBdI9WQ0gQ2D99viFXPP1pKmF2lwklzn2Af1L1IPSIHkTewqsYvALGFtm1QChpBgTkOtvIMxH+R7pFZZ+8pR/dYp/7UbSwpaiUGwqAstRZwdQyfx2ar2BuXtI1G0KkWeLJtAvXTeIWCQ1rmw074eUfUrWLmGNYUPqiIC7KSEzYITR4E8S+u31jardi083C162Zxf1423s5+REp5b1xlMnakggD5xV5VZ8EtnvIqHm+LXK1k75Sw1hgbhuasMjetnOMKJTOtvu3LWTLldXo4PbzEMCqUZndMOu54Iskntqe+g4Sdk X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eojZFyZsL2jrniT+qztNj+6gFJ5GtcAcA2mMCUksERbmWYwaLL4UM5VLv1zKGPtsVY0PHpWIeyHJfIjGCu32ipI9bZ/1lsgZ//huSWIXutQ5MQ6VDt6XJBWoIVq5AfFIYSLVIYS4WA8JQwkbiDhWEQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 303a73aa-ddd4-4e67-df08-08d989724130 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2021 09:10:06.9116 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7045 Subject: [FFmpeg-devel] [PATCH 1/8] avfilter/vf_w3fdif: Fix segfault on allocation error 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: gH7BmPvxRmu2 Signed-off-by: Andreas Rheinhardt --- One could btw allocate the work lines jointly. libavfilter/vf_w3fdif.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_w3fdif.c b/libavfilter/vf_w3fdif.c index ea304164b6..c2ea76dfa3 100644 --- a/libavfilter/vf_w3fdif.c +++ b/libavfilter/vf_w3fdif.c @@ -275,7 +275,7 @@ static int config_input(AVFilterLink *inlink) AVFilterContext *ctx = inlink->dst; W3FDIFContext *s = ctx->priv; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); - int ret, i, depth; + int ret, i, depth, nb_threads; if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, inlink->w)) < 0) return ret; @@ -289,10 +289,11 @@ static int config_input(AVFilterLink *inlink) } s->nb_planes = av_pix_fmt_count_planes(inlink->format); - s->nb_threads = ff_filter_get_nb_threads(ctx); - s->work_line = av_calloc(s->nb_threads, sizeof(*s->work_line)); + nb_threads = ff_filter_get_nb_threads(ctx); + s->work_line = av_calloc(nb_threads, sizeof(*s->work_line)); if (!s->work_line) return AVERROR(ENOMEM); + s->nb_threads = nb_threads; for (i = 0; i < s->nb_threads; i++) { s->work_line[i] = av_calloc(FFALIGN(s->linesize[0], 32), sizeof(*s->work_line[0]));