From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <ffmpeg-devel-bounces@ffmpeg.org> Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 9FAFB4CE87 for <ffmpegdev@gitmailbox.com>; Mon, 14 Apr 2025 23:59:16 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 34E2C687CB1; Tue, 15 Apr 2025 02:59:12 +0300 (EEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12olkn2055.outbound.protection.outlook.com [40.92.22.55]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C6CED687AC8 for <ffmpeg-devel@ffmpeg.org>; Tue, 15 Apr 2025 02:59:05 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ap8N1kWxSslyUQx1+KApmPj5JMcQb+/PJ2qCfIC/PYAfPyZ0x5RTCKWbXfZcZt+tP9a0cdWEJEssW8Kg+WpQlzZKhzgsg/ADkdYmZQWun3r/QsaXbS7s3+hIOVZJCnbwgiGBw3Sr3TMSpIXj444M0HPVc7PhUjc7pmnlrxSasOKiCxM27QighZOFyVwNDeXLhix1l9AZNGGFpDpm2dQ8/okL6ObyQyr2pJP53tBt29NoJ2dwv8rMeMrWGnJHiLOo7ioMvSd2oWQX1Zb6HZGoOdAwGn11sgDg1BtxEC6eZV+mxY/eKP2PoO/g3IHQ0YOewGQnsaYvH4Myf9aX5xBL7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=6tKqiaqqJF48aZTyKRuLE+QLyv0co2aerOAYP9CyY1A=; b=cS23ABJUMrBdCGfuHoGOPaf/CfRJng6b7rXGr+i238iGVuEFZl836mc8RetjDaGDUYjKfe/ckUwpnoz1MmfMMx4iGRqeCbjbTIVR76CMYNpiXuQQA1RrgNFCPE/GbZkVUR608U4pWTeJ7dhmd5uH0jq3WNczELvwkL50vIW9/QT5HgUJK797TKYVETUb6KMyNuzsKpoa0xGyY7ZzVKoPvDcPxhn6+4l9V+f5rLQf0SPFmBypA5dvdDUvyQymZnPffWbMYqXQ+3EBYXGNUyEKsiHdWb/dtHW/r0HNYhhdUeRN8IPBs7OTTHyKaIkNX5e46R5BD8isoyNo+cgaY+Tw1Q== 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=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6tKqiaqqJF48aZTyKRuLE+QLyv0co2aerOAYP9CyY1A=; b=Oaur7A1UK5lJlH6E9hQjuAgR7wJYs15DA54kKIyssO63Ua1qgheCKMFgIBkDYmcydFImnQSUiQfNav9OTOLyb8bLu/N4uVYAqkEhn7Cp4ziFjpLRGR29WERIZWGVrDKsClSMV6cZQD1rqFs48gyI2562A34i3K5nquTbsVGg6d5k+DMNao0pcXX2snZ4Y7z+yBUt2ukKiPqgRm+FetfInYgEd8F7IhicQ2WSUj9CIehkH2yJONhArHsLDbfkbSbh7atCz/sO4mjOCmgOaigtuzgz1jsb0bz/zR01hlAEwhSWWnc+MZja1VBX34ThIQxscSBWf2+s3r/Y5TDDlZ+rLQ== Received: from DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM (2603:10b6:8:b::20) by IA3P223MB1574.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:57c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8606.44; Mon, 14 Apr 2025 23:59:02 +0000 Received: from DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM ([fe80::bf09:8e9:b07f:98a7]) by DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM ([fe80::bf09:8e9:b07f:98a7%4]) with mapi id 15.20.8632.030; Mon, 14 Apr 2025 23:59:02 +0000 From: "softworkz ." <softworkz-at-hotmail.com@ffmpeg.org> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Thread-Topic: [FFmpeg-devel] [PATCH 2/2] avformat/id3v2: Check that decode_str() did advance Thread-Index: AQHbqzD6b8QhS9IB3U2xSLilkCUpvrOfQsxwgASOQgCAAAZwAA== Date: Mon, 14 Apr 2025 23:59:02 +0000 Message-ID: <DM8P223MB0365928500AB53069869DC99BAB32@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM> References: <20250411222719.2779176-1-michael@niedermayer.cc> <20250411222719.2779176-2-michael@niedermayer.cc> <DM8P223MB0365A90C10FBC9EF6512F9E1BAB12@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM> <20250414231950.GN4991@pb2> In-Reply-To: <20250414231950.GN4991@pb2> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM8P223MB0365:EE_|IA3P223MB1574:EE_ x-ms-office365-filtering-correlation-id: 03bee900-dbb7-40a7-cff3-08dd7bb054a4 x-microsoft-antispam: BCL:0; ARA:14566002|15080799006|7092599003|19110799003|12121999004|8062599003|461199028|8060799006|56899033|1602099012|102099032|3412199025|4302099013|440099028|10035399004|41001999003; x-microsoft-antispam-message-info: =?us-ascii?Q?kaQt+QS9c1qVMgdxTik/cwly2acJrlj1Oz/tR3Bn7gygzCXlx8YvL3UZ1XiW?= =?us-ascii?Q?J8iaeIFQLKz5pgc7iWLoQZhBGmh0Yha8I1Mbs+0fvVUUTrNLlp/WoQUIlrw1?= =?us-ascii?Q?KVjpnVakRyp87BYwfu5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qAsOloMaRfY?= =?us-ascii?Q?LwjCR3qg/QRboE3jMiHxBedPZwWBf3mszH/mRZwUrnAbCt96Ge87DNWfPR6K?= =?us-ascii?Q?KeBrexpaNe9UHzYu+XqI2jJUg6zkzyQXoRN8RAwmw67OnoYzpDyk9qw/gck3?= =?us-ascii?Q?HBv0TdkqpyOcuofpvveUWcZgv+96FSO7Nc6k7pyj3Mc5HOkXFJ6P/8TzFJgI?= =?us-ascii?Q?ESoG+yqzAClse3bDQbOPIRhf6RLuik+I+vJL1WyC9oqn8mWEE+Vr1k3w34P6?= =?us-ascii?Q?n/sxzw4XjyaUmZt3MceazN1+dCuofapbnOdJ0C+YUMQT33Gm8NM/wTI3peCO?= =?us-ascii?Q?k9c=3D?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?QLcZkRqYrt4Fk1FCfRmuybxLCmTYKTpE3uBkCp15sUID5tQtiv7z+v3MMTFN?= =?us-ascii?Q?GLMIH98GylsMuno+fK/7dsly2qp49iuA17PykTmDwBbp3U0XCto+ZKBNJ+ZY?= =?us-ascii?Q?pRBPZOSTvrbRddiYkEkLaD1sg0O7+VXbwh6TR0AnTH4lacQj3I0lElo1ddJV?= =?us-ascii?Q?yfpY2O9oeQiDdf2bmmOBL37gUXYxjmAILEQ/1TVp/1BwZoJzHwzAdqu+Uaa7?= =?us-ascii?Q?WLY4b5GVlywWIYXBCQfWGiqTQTl6GYJXBWMwF8oEcIIzyPpOcNgwCz11JPvM?= =?us-ascii?Q?HRydD70i5ql9Hjx2b6/dPeqg2UEr1rP/MLxuoaar+XyQHdPr5NEEtkDefJXB?= =?us-ascii?Q?8+VOiU/cQn2VXr7V8vA0p85gxON2Mx05sd8fzUIas09dzxods3gAtl5Datdg?= =?us-ascii?Q?0s6OYwB5BNE1ldqws2yrDOWO82aCLhgVou1Sidav4fYcIHTyFhDMOFMsiV35?= =?us-ascii?Q?Zn153atJrbfR4uIh0apwPXqY8HAGEGPaJ+MsXWq+axCvYLzaGLbyhnGGuP2R?= =?us-ascii?Q?bN7qYcOYLhg3N8yumPvy10l/iltvu13w9o9YtnGd2DEB899DL6C9SGWjijGG?= =?us-ascii?Q?kgu+xfpqqnF/75If5HkUXhqiIR63Li+cfrLt843FKV4qSQtzd/xQG3ehF/T7?= =?us-ascii?Q?35JIn9pFq6H13lb+oLkzsylaLHM+E842+O+SL/2INNkYy/8BiJQKlG+d8rbO?= =?us-ascii?Q?vi4Q0P2MzFjmP2vC4XP+0R0MWI/rw75hmNms0+tFjMsL1o5BUNdEV+Q9RKox?= =?us-ascii?Q?fu44BSGFW4EfYFJy8nh+7s2Avoov4vkGnEtMPliTQ6LyH4KLH9v/Eifgve2w?= =?us-ascii?Q?OekC+mcrzYC97O4Po/70gYJ2XddTKb19WbRtybFTSRbxhE+PrXy9TAbKmoIB?= =?us-ascii?Q?3RATuxXD1nEoaNiiWNRJMtimPs92n3lypObYLudHgJZcoPBW11VAg/Ng9yoB?= =?us-ascii?Q?CFgYKpJfaxYHhHaPkslUnVe4T6kedpFiZHgdwuWfkpEHe1L0uIoKs0tLmnqV?= =?us-ascii?Q?xTnSiWIDgMROglCOrO/kSvv2H2aRq037kglAdORgQS72sfpJ6S+Ztey6o9UZ?= =?us-ascii?Q?SSAPxSwpH45Z9fwXYkITn/uwizy1yyh/n8cdS2Ppc73jzx8Y2qaaUGqBrv+1?= =?us-ascii?Q?2UsX80jB+RUxva+7k7Ig5I1Ay708/XcBlZXloj2Tn82anoEbp6NDc+/z4XtM?= =?us-ascii?Q?5xhbrfEPVbRjZU/OzlIICa2mIskO8H59xOO+39NybqXdS1+h5+JYTSVUkl4?= =?us-ascii?Q?=3D?= MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-7719-20-msonline-outlook-92255.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 03bee900-dbb7-40a7-cff3-08dd7bb054a4 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Apr 2025 23:59:02.0527 (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: IA3P223MB1574 Subject: Re: [FFmpeg-devel] [PATCH 2/2] avformat/id3v2: Check that decode_str() did advance 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> 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> Archived-At: <https://master.gitmailbox.com/ffmpegdev/DM8P223MB0365928500AB53069869DC99BAB32@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM/> List-Archive: <https://master.gitmailbox.com/ffmpegdev/> List-Post: <mailto:ffmpegdev@gitmailbox.com> > -----Original Message----- > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of > Michael Niedermayer > Sent: Dienstag, 15. April 2025 01:20 > To: FFmpeg development discussions and patches <ffmpeg- > devel@ffmpeg.org> > Subject: Re: [FFmpeg-devel] [PATCH 2/2] avformat/id3v2: Check that > decode_str() did advance > > On Sat, Apr 12, 2025 at 01:49:53AM +0000, softworkz . wrote: > > > > > > > -----Original Message----- > > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of > > > Michael Niedermayer > > > Sent: Samstag, 12. April 2025 00:27 > > > To: FFmpeg development discussions and patches <ffmpeg- > devel@ffmpeg.org> > > > Subject: [FFmpeg-devel] [PATCH 2/2] avformat/id3v2: Check that > > > decode_str() did advance > > > > > > Fixes infinite loop with unknown encodings > > > > > > We could alternatively error out from decode_str() or consume all > of > > > taglen > > > this would affect other callers though. > > > > > > Fixes: 409819224/clusterfuzz-testcase-minimized- > ffmpeg_dem_H261_fuzzer- > > > 6003527535362048 > > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > > > --- > > > libavformat/id3v2.c | 3 +++ > > > 1 file changed, 3 insertions(+) > > > > > > diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c > > > index 90314583a74..e3f7f9e2a90 100644 > > > --- a/libavformat/id3v2.c > > > +++ b/libavformat/id3v2.c > > > @@ -341,10 +341,13 @@ static void read_ttag(AVFormatContext *s, > > > AVIOContext *pb, int taglen, > > > taglen--; /* account for encoding type byte */ > > > > > > while (taglen > 1) { > > > + int current_taglen = taglen; > > > if (decode_str(s, pb, encoding, &dst, &taglen) < 0) { > > > av_log(s, AV_LOG_ERROR, "Error reading frame %s, > > > skipped\n", key); > > > return; > > > } > > > + if (current_taglen == taglen) > > > + return; > > > > > > count++; > > > > > > -- > > > 2.49.0 > > > > > > _______________________________________________ > > > > Hi Michael, > > > > this kind of conflicts with this patch that I had submitted > recently: > > > > > https://patchwork.ffmpeg.org/project/ffmpeg/patch/pull.54.ffstaging.FF > mpeg.1740873449247.ffmpegagent@gmail.com/ > > > > > > I wonder whether my patch would still be prone to the issue your > patch is addressing - > > This already conflicts with rcombs patch in git master, i think > Applying: Fixes Trac ticket https://trac.ffmpeg.org/ticket/6949 > Using index info to reconstruct a base tree... > M libavformat/id3v2.c > Falling back to patching base and 3-way merge... > Auto-merging libavformat/id3v2.c > CONFLICT (content): Merge conflict in libavformat/id3v2.c > error: Failed to merge in the changes. > Patch failed at 0001 Fixes Trac ticket > https://trac.ffmpeg.org/ticket/6949 > > > > do you have a test file perhaps? > > Will email you one, but the loop with a function that doesnt advance > is an issue even if the specific file doesnt trigger it in a different > implementation > > also probaly a good idea if you contact rcombs as you seemed to work > on > the same code > > I was looking at teh ticket and saw a link to rcombs patch, looked at > the patch and applied it. I did not realize there where 2 patches Hi Michael, I know the rcombs patch, but it has a - let's say - different behavior. Let's look at an example where artist and genre have multiple values: This was ffmpeg output unpatched: Metadata: title : Infinite (Original Mix) artist : B-Front track : 1 album : Infinite date : 2017 genre : Hardstyle TBPM : 150 compilation : 0 album_artist : B-Front publisher : Roughstate This is what the rcombs patch does: Metadata: title : Infinite (Original Mix) artist : B-Front artist : Second Artist Example track : 1 album : Infinite date : 2017 genre : Hardstyle genre : Test genre : Example genre : Hard Dance TBPM : 150 compilation : 0 album_artist : B-Front publisher : Roughstate My path does that: Metadata: title : Infinite (Original Mix) artist : B-Front;Second Artist Example track : 1 album : Infinite date : 2017 genre : Hardstyle;Test;Example;Hard Dance TBPM : 150 compilation : 0 album_artist : B-Front publisher : Roughstate I'm not sure whether it is even allowed or intended that there are multiple metadata entries with the same key? But in any case, what's happening with the rcombs patch is that when transcoding a file, the result looks like this: Metadata: title : Infinite (Original Mix) artist : B-Front track : 1 album : Infinite date : 2017 genre : Hardstyle TBPM : 150 compilation : 0 album_artist : B-Front publisher : Roughstate Which means that the extra values all get lost. This doesn't happen with the patch that I have submitted. Even though we should ideally also modify the encoder to write the semicolon-delimited values with null-separation, a semicolon is treated by most apps as a value delimiter as well - so it's a largely solid way and it avoids loss of information when transcoding. (which is why I had submitted the patch even though I knew about the one from rcombs) Thanks sw _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".