From patchwork Tue Jun 15 23:32:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28332 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4313140iol; Tue, 15 Jun 2021 16:37:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0K02yuSpfzH/TGrctFCcyKwaoqD4vUaECKEJ9hiUsrd7gJnhGHLhkQursL5yauLLZf6z0 X-Received: by 2002:a17:907:1c13:: with SMTP id nc19mr2046493ejc.168.1623800270558; Tue, 15 Jun 2021 16:37:50 -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 g21si292286edb.13.2021.06.15.16.37.50; Tue, 15 Jun 2021 16:37:50 -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=kpkxd9k3; 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 47576689A2F; Wed, 16 Jun 2021 02:33:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2022.outbound.protection.outlook.com [40.92.89.22]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 74B94689A2F for ; Wed, 16 Jun 2021 02:33:55 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nN0Z7cvd4AL3F9NZSn7NZwoLaUXe1TxCM6BWSdPPhFEcUUezCfM3sQgEmEcqASura4W7d7qXngwdUFpHfmdyGGX1RSBWTGhkhIlBGFysCsZ9zQ6KOcvAQipMe0xzbD7vlxY7/0IeOFQd8ruw6x+1OYofybDHjL5CLaEkJn7g6lnSMi1Ke6/ktTNJSNPzyC6B8L8WuwsAmNPVSu48jg4Zw/GgSWgtKh8GAJUsDaA5dK7IWar48a3FmaRcR03LZnqZ6hqrq87lKfZz7x4C/ni/5BYAsp72NAu9OgycpAO5I8TgQHujt2wJJhVnFxCtjuk1siEvfJq62fnQpceKhF12mg== 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-SenderADCheck; bh=BbtVG1G2U5Y3qjC9Ja+EGYdUH4jJoS0AWJYMPWrbn0E=; b=oRmm0TfN9nX1H/dHSeNzeUDAIQyoPJc/w440DOhMATbIQeObTbPtztn4kzxCoNa+a8zGm443wzY6eFMeIG5ATJAUS+wWoarvrRUQhjW9GDBTmyxCyQKRMFUXNXb9g7VBlOX9cG5M2pmc/wgGoCUWhVuzdreMggdgZNUaIKaAYfHvp3vo0AbbHArt4DC7/j4M3/FY1WZc4FRuHAqeHp4lV8K0uZQXhOT/g/AZ5838PHWjJHGHA/v28IpZCyE3w/K+CuIpfwFxlNs2GcEWGvUhEJhZQVz6cnsrdcqd0Fp9pln7WQz4h7RsyaB+V/AuUxQzooUthOLy6oW12OXh1ulhgg== 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=BbtVG1G2U5Y3qjC9Ja+EGYdUH4jJoS0AWJYMPWrbn0E=; b=kpkxd9k3tNEWlblWSor4au3diXpjGYRlX/5Fgt+rsobX0AuHRA678TSopcYjKgXKkBMKIdNDzyff92z1aBU/VepE8XlvkJtN84VhpF050TRwRSnV5zzI3amubIqxboIlKnovgY7a/AswyQOV70G/meD6OoAgB13C67LJ9gDrOZRBgEO0KpzxWWHbmw294lpr1RYw9mZrK7mHf3Lxf7EAWnGqD9HO5+6D9YwJYSAHhdaQ3GR31MP8lM0WJQx1QKGakQxmZWCw3b7pRqqZc8oJ311Dywoa/udiP07gLNkxwWowxJ3PdqVNJwBvo9BIch3KSNO62CJrg7TtE4ynmhVdcw== Received: from DB8EUR05FT030.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::49) by DB8EUR05HT222.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::416) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21; Tue, 15 Jun 2021 23:33:53 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:fc0f::40) by DB8EUR05FT030.mail.protection.outlook.com (2a01:111:e400:fc0f::228) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.16 via Frontend Transport; Tue, 15 Jun 2021 23:33:53 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:CBA4BF461D0C13E71A8D83529263063F070C97DED1F76F8CCFEE3DCCCDB2DC09; UpperCasedChecksum:A7608566F0DAE8B66516E200C76E2D9F54A59151E1AF620E8CE3A38EE69C0550; SizeAsReceived:7757; Count:50 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::f4cc:63fc:9cef:37fb]) by HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::f4cc:63fc:9cef:37fb%6]) with mapi id 15.20.4219.025; Tue, 15 Jun 2021 23:33:53 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:32:21 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [zvceflYYse2Hbsbbx2xiQKkkteoQUrqv] X-ClientProxiedBy: PR3P189CA0063.EURP189.PROD.OUTLOOK.COM (2603:10a6:102:b4::8) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210615233243.1173928-31-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.97.82) by PR3P189CA0063.EURP189.PROD.OUTLOOK.COM (2603:10a6:102:b4::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.20 via Frontend Transport; Tue, 15 Jun 2021 23:33:53 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: f9678f18-466b-4c93-815c-08d930560980 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR9SlwCHtPrt+MV8TUUwp4pQ3gFot+Jrk9mLI+N6jfyjMDyua2eyp8bVC8Z6JK7zCONVCxtLC5GYjNj+EQ2cZOsaynONbXc46J2mjnPDLqmkULS7CkUbetqNIEqZPNQPrr9jNKxHt96suqquMscmCsn8s5uyBIXuBU3Ab/3V8bOIkMEJ6Rjizv4SSCkhQqj2IdHsk5Eth/eJPUc+hYJzNsiHYeuYRzw29ZIhyzWomgDsfQGddaMw8BNsHJMvmjmSaDx5sy2StcOrnF/dLyhvka++DL24jZKU8OvrDrhcfN1RgXCgjQlWpY7cSF2RrI4BSgQL8aPGYa4Euy9FDZQAcoXSYezPIa/8G5SpBRt+DhrqwenuRODEQhbFSlXGZi0ZHcVGpx5qC0auAkmx2rsb9gih/UCRdF6qszOzlpMNYRVeO07UG08FaJB9QjMwb1UQk9ilts356F1S1WT1mbi4VfEl2+ez/18Z8UYjKw80epQ66pPwJT0vrnZt7CCpuWXvjGzG4CUMPvp58i3IxtJUcWkdOe45ubJDtF/0832jkslZOk3H1lKNbDg0BcKN0NI4U1g4cAiZQgjXupym8K586VlOtaLsDo9YfBflE5TpMRGA1SgJZn3GJI+kIywMf83X6BI/uegDTylAuBeG4PhRwl2qA3wReldhXyiIkfYUf/6bwToRYQtp37DXF1vq+iVO+y4fxV/rnUoPO6VyW5DizpqhCdm/r+prJYoMRZjg32qThlwQXxxI+rgW+MYznFHblg= X-MS-TrafficTypeDiagnostic: DB8EUR05HT222: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AuWb4abHtmrxnsotZbdHD8LILO9WGZhCUqqVkb/Qn4OVO6ccJyABNxFSaVFnJUDmsnbqeFk7HgIULzIqvtMicUhvXK9nogRFJydeMjMONRr00pXGoR0Q1gdpMdh4IQnDqqcuKHtabw0HHN3bVddEeHDaQy+SeHLiKbIa3iACQ69nNl6l76Mh9nYX1A7rpHDK5IrWOUJFp0uxRTAVhV19D+I085R3UG6SHI1Q0UNkdpHxLik3ENXrX1rYpXcq3OKLbF10CM9kgbNvHooDzwvVbUb9QRqsbGRoFbqPsnuQAIzG8jNQ+KNdJKfMUdgg8GaI4KzQJePZTa5z1KaT/J6sWw4wPPgFTSbLl3odZrKdPYCRqs69tNujIZpRySE+wYAPhk/kzpRsLvsziPBXcUm0FQ== X-MS-Exchange-AntiSpam-MessageData: +xVkrgpZ0mcfEMJWmj+3jniqzgYxgVc/KAPC++DcwKgmCI10NhBGCvj5k4u0oo3ZWHAm+RGPPkFF+ZEWtGc2WSw81zTPrFqnDQjj2TvhP7adQbZsWtf7rgJPJiwknRyOUYWK+FHaUKY/adFTh1fgYQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f9678f18-466b-4c93-815c-08d930560980 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:33:53.6962 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: DB8EUR05FT030.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8EUR05HT222 Subject: [FFmpeg-devel] [PATCH 32/54] avformat/oggdec: Simplify cleanup after read_header 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: cHS401mI+qU1 by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt --- libavformat/oggdec.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index e5ca3272cd..bb289e0756 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -732,10 +732,8 @@ static int ogg_read_header(AVFormatContext *s) //linear headers seek from start do { ret = ogg_packet(s, NULL, NULL, NULL, NULL); - if (ret < 0) { - ogg_read_close(s); + if (ret < 0) return ret; - } } while (!ogg->headers); av_log(s, AV_LOG_TRACE, "found headers\n"); @@ -751,10 +749,8 @@ static int ogg_read_header(AVFormatContext *s) "Headers mismatch for stream %d: " "expected %d received %d.\n", i, os->codec->nb_header, os->nb_header); - if (s->error_recognition & AV_EF_EXPLODE) { - ogg_read_close(s); + if (s->error_recognition & AV_EF_EXPLODE) return AVERROR_INVALIDDATA; - } } if (os->start_granule != OGG_NOGRANULE_VALUE) os->lastpts = s->streams[i]->start_time = @@ -763,10 +759,8 @@ static int ogg_read_header(AVFormatContext *s) //linear granulepos seek from end ret = ogg_get_length(s); - if (ret < 0) { - ogg_read_close(s); + if (ret < 0) return ret; - } return 0; } @@ -970,6 +964,7 @@ const AVInputFormat ff_ogg_demuxer = { .name = "ogg", .long_name = NULL_IF_CONFIG_SMALL("Ogg"), .priv_data_size = sizeof(struct ogg), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = ogg_probe, .read_header = ogg_read_header, .read_packet = ogg_read_packet,