Message ID | HE1PR0301MB21545E3BB5127BAA8D7587E58F309@HE1PR0301MB2154.eurprd03.prod.outlook.com |
---|---|
State | Accepted |
Commit | 0d81c0a10ee822e6198ab0c0868ac7e22ca9ac4e |
Headers | show
Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp4309921iol; Tue, 15 Jun 2021 16:33:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMYYqdYsOEa8v2t5CFr5DsgDZGOruT3bXKCawLEReQ6gFdt70fMYoIhF7nwjlsSIv1J9BA X-Received: by 2002:a17:906:9512:: with SMTP id u18mr2083721ejx.61.1623799986481; Tue, 15 Jun 2021 16:33:06 -0700 (PDT) Return-Path: <ffmpeg-devel-bounces@ffmpeg.org> Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m17si434663ejn.202.2021.06.15.16.33.06; Tue, 15 Jun 2021 16:33:06 -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=ltcUgSAL; 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 10B29680454; Wed, 16 Jun 2021 02:33:03 +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-db8eur05olkn2072.outbound.protection.outlook.com [40.92.89.72]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6E804680454 for <ffmpeg-devel@ffmpeg.org>; Wed, 16 Jun 2021 02:32:56 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yo/NZfmowjgy0sDSGkxuZRtKDmNtrofOgaJHxnvTkAEKya0mGYdTnyg+FKJV0FVt1iaGEdMcScoIpXWncnzzbj80swOnJfwh3LtULfLIGlz7m5j+pbyBfp5BWk3oWMnnwEU4Hz5fft1I+Kw62e+0SIq726faTbEDMLnC62tGQmH7U4v9qv9UknG8beNOfuv815ZanfZS3xQfaOhdCg2mdnOgpPLI22yHZ+FzpS0d/Q8qN9qcFi4Qy5+8YgMYc89bH0B/q3fASxcaLQuKx6nPtE8tYF+xgEmwcfRHNchQ6g/oI7exvuKKGgclt5qKKP0l44OIW83BFhx7RVtsfW33LQ== 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=QiXWRT7s+7L3c3yrbH+4+tRm81rCvtXfS5k+9ziTEyU=; b=QBNH3KuFxRKD6VbN1JEkTTBS/1QwIJ9//TC6Y71f8Qc/BlunRNrEr/ZbMwIhBGWMgg0lL/CSw3ALCEsdXb/7O8KwVpGdEiioQhpJLM2SIc2zXxUI/ld2tgDQ8aBjIJBWuqL4RbZhTRyT+SoEFcrrluwF8a+1h9GoOAXAmJbX0ys9BIkZHZyt/ECqgUSZHp5sZ97N8UiiYnLVidMEUeIQCPcV0vJ8xIQ0t4UbH1scZSFOB+ZKvbG9XKDYMpeB0gCjWHMqUhEaU2gaw7baaxeO4CMTcfXZIQmqavzWkFmsRjAMEx+omAXFX3AAweM54mywRPYYE15h5db5jZ38Wxrw+w== 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=QiXWRT7s+7L3c3yrbH+4+tRm81rCvtXfS5k+9ziTEyU=; b=ltcUgSAL+P/pt2Yz8PZ1gxcSCB1wlyjle2Ax1qT6k5M5/vQIe9oGIbHRiFeBWKTCqjdeY1dWRLwMD4ZgbIFs0Zp+bCr8s1X2IWhk+HACUmYMedVfu7ep4hm1H95CBf5WU6bm/K/QPOfObfmRaikmCi8M8qO/lOC8taFaksXIJxw1vPTBt5euS1TzVmhOpVh4LTOvmWogBx2sbiOwW65M7cKYSnn6cy4BXpPE/dyLuAO30i3zdeOBi4hUQfKFg+tWUYyhXZ/lRYZ0kgA4fTOAAayYOnDoKpa5JuIytTBPeMhC9ugF64zB0/th0OD0UdIXFbUsWs5c4gyqbVxaLoQRzw== Received: from DB8EUR05FT045.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::50) by DB8EUR05HT098.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::349) 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:32:54 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:fc0f::46) by DB8EUR05FT045.mail.protection.outlook.com (2a01:111:e400:fc0f::383) 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:32:54 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:F96D86A134255E324EE0298A6021E3C462B989CD25AE8D1DEC3BF864D08DF51C; UpperCasedChecksum:CE4DA5FB81747A1CAD77989075182D091039422B325F10D71CFEA3276B8C8906; SizeAsReceived:7594; Count:48 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:32:54 +0000 From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Date: Wed, 16 Jun 2021 01:31:51 +0200 Message-ID: <HE1PR0301MB21545E3BB5127BAA8D7587E58F309@HE1PR0301MB2154.eurprd03.prod.outlook.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <HE1PR0301MB21549E6468C815E64544E2958F309@HE1PR0301MB2154.eurprd03.prod.outlook.com> References: <HE1PR0301MB21549E6468C815E64544E2958F309@HE1PR0301MB2154.eurprd03.prod.outlook.com> X-TMN: [F2HJ3uM8AM9zjopWkkh1hE5Dq+v6+Svu] 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-1-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:32:53 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: f6a2a052-7a79-4ea6-85f3-08d93055e62a X-MS-Exchange-SLBlob-MailProps: pt8ZUcDWjMXjm5E3BZqscgkJYEZiB9+AcR3tJ/v1IvzgaCNDvibnPnxrFFF5cRPL0hBOM1lLkA3dST+zkvvSiQDU290LxM77zgPm9vNDinaW/sxRst0D8Y8w/Cy+ZKpf5kt956lPmpiremOz1wQtIyBhMm4JQbrqkGln4bvWmV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nXARgzK77BDkfxRAp7rDuK1bWhaqYGC7foIy1L/eWoAN/rgCROw2XyjLh0O/7IELUy3cbmd9tOd9S2xDdOuq2+brixOiShv4YZZ5XAe/yCqn1uqOyTfHklCCmxZpe2kLvloVrgXJ/EcDgIxZeaBRmfdPDy8/eLPOXpNI9laK6wE9Fznek3CX+xlKn/AGcjvyldFeDbS/nQ0pG6E/y7KEdD0DeE6eR5r/r/Rswa9u+ZPg7SVfrMQT0z7/Q+A81Gu1HmTyfDtdrQ7ZfwZGRGzIKqZnYruDU0= X-MS-Exchange-AntiSpam-MessageData: 6PlUh4PD/reHldmz8anvaFDjE/BTt083PjacMeaTTZ674hVsfQoon1ihxi/IhWWzJZDzgNoGV1Vc/CA9O9UbuYaXRCvX+yA+VZAVYYpP7utko6Dn8vFbi0boZcjExoEeLhkBEZtaeT5X+BWnaJsHWg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f6a2a052-7a79-4ea6-85f3-08d93055e62a X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 23:32:54.4654 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: DB8EUR05FT045.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: DB8EUR05HT098 Subject: [FFmpeg-devel] [PATCH 02/54] avformat: Redo cleanup of demuxers upon read_header() failure X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org> List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe> List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel> List-Post: <mailto:ffmpeg-devel@ffmpeg.org> List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help> List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe> Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org> X-TUID: hSii8gc8FDR+ |
Series |
[FFmpeg-devel,01/54] avformat: Add internal flags for AV(In|Out)putFormat
|
expand
|
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
diff --git a/libavformat/internal.h b/libavformat/internal.h index c6adf7b872..240de9e289 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -42,6 +42,12 @@ # define hex_dump_debug(class, buf, size) do { if (0) av_hex_dump_log(class, AV_LOG_DEBUG, buf, size); } while(0) #endif +/** + * For an AVInputFormat with this flag set read_close() needs to be called + * by the caller upon read_header() failure. + */ +#define FF_FMT_INIT_CLEANUP (1 << 0) + typedef struct AVCodecTag { enum AVCodecID id; unsigned int tag; diff --git a/libavformat/utils.c b/libavformat/utils.c index 0df14682a4..998fddf270 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -566,8 +566,11 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, ff_id3v2_read_dict(s->pb, &s->internal->id3v2_meta, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta); if (s->iformat->read_header) - if ((ret = s->iformat->read_header(s)) < 0) + if ((ret = s->iformat->read_header(s)) < 0) { + if (s->iformat->flags_internal & FF_FMT_INIT_CLEANUP) + goto close; goto fail; + } if (!s->metadata) { s->metadata = s->internal->id3v2_meta;
If reading the header fails, the demuxer's read_close() function (if existing) is not called automatically; instead several demuxers call it via "goto fail" in read_header(). This commit intends to change this by adding an internal flag for demuxers that can be used to set on a per-AVInputFormat basis whether read_close() should be called generically after an error during read_header(). The flag controlling this behaviour needs to be added because it might be unsafe to call read_close() generally (e.g. this might lead to read_close() being called twice and this might e.g. lead to double-frees if av_free() is used instead of av_freep(); or a size field has not been reset after freeing the elements (see the mov demuxer for an example of this)). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- This is the new version of an earlier patchset [1], [2]; this version takes advantage of the open ABI. [1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-March/258830.html [2]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-July/266575.html libavformat/internal.h | 6 ++++++ libavformat/utils.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-)