From patchwork Sat Jan 28 20:33:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marijn Meijles X-Patchwork-Id: 2352 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp813680vsb; Sat, 28 Jan 2017 12:33:46 -0800 (PST) X-Received: by 10.28.238.140 with SMTP id j12mr7700562wmi.35.1485635624863; Sat, 28 Jan 2017 12:33:44 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a206si7544070wmh.55.2017.01.28.12.33.44; Sat, 28 Jan 2017 12:33:44 -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 0A5C168A6A0; Sat, 28 Jan 2017 22:33:40 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from lunar.bitpit.net (lunar.bitpit.net [193.46.80.27]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E491468A2FA for ; Sat, 28 Jan 2017 22:33:33 +0200 (EET) Received: by lunar.bitpit.net (Postfix, from userid 1000) id 3128027A1ED8; Sat, 28 Jan 2017 21:33:35 +0100 (CET) Date: Sat, 28 Jan 2017 21:33:35 +0100 From: Marijn Meijles To: FFmpeg development discussions and patches Message-ID: <20170128203334.GA2281@lunar.bitpit.net> References: <20170128125230.87305-1-marijn@bitpit.net> <20170128125230.87305-2-marijn@bitpit.net> <20170128185651.GI4698@nb4> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170128185651.GI4698@nb4> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [FFmpeg-devel] [PATCH] Fix to prevent runaway ac3 detection by looking at the actual frame rather than the first detected frame. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" On Sat, Jan 28, 2017 at 07:56:51PM +0100, Michael Niedermayer wrote: > On Sat, Jan 28, 2017 at 01:52:30PM +0100, Marijn Meijles wrote: > > Signed-off-by: Marijn Meijles > > --- > > libavformat/ac3dec.c | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > the previous mail contains a description but the patch itself lacks > a commit message beyond the first line, the patch should contain a > commit message > strange, git must have eaten it. Anyway, here is an untouched patch file from git. Marijn From 27e9209c1094b24bcc45ef3ff174b80cb17db775 Mon Sep 17 00:00:00 2001 From: Marijn Meijles Date: Fri, 27 Jan 2017 22:08:15 +0100 Subject: [PATCH] Fix to prevent runaway ac3 detection by looking at the actual frame rather than the first detected frame. When detecting a swapped AC3 marker the data of the frame is swapped. However, in subsequent frames the data swapped is taken from the first frame rather than the current frame. Signed-off-by: Marijn Meijles --- libavformat/ac3dec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/ac3dec.c b/libavformat/ac3dec.c index 363a32e..e85b0ac 100644 --- a/libavformat/ac3dec.c +++ b/libavformat/ac3dec.c @@ -49,8 +49,8 @@ static int ac3_eac3_probe(AVProbeData *p, enum AVCodecID expected_codec_id) buf2+=16; if (buf[0] == 0x77 && buf[1] == 0x0B) { for(i=0; i<8; i+=2) { - buf3[i ] = buf[i+1]; - buf3[i+1] = buf[i ]; + buf3[i ] = buf2[i+1]; + buf3[i+1] = buf2[i ]; } init_get_bits(&gbc, buf3, 54); }else @@ -62,8 +62,8 @@ static int ac3_eac3_probe(AVProbeData *p, enum AVCodecID expected_codec_id) if (buf[0] == 0x77 && buf[1] == 0x0B) { av_assert0(phdr->frame_size <= sizeof(buf3)); for(i=8; iframe_size; i+=2) { - buf3[i ] = buf[i+1]; - buf3[i+1] = buf[i ]; + buf3[i ] = buf2[i+1]; + buf3[i+1] = buf2[i ]; } } if(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, gbc.buffer + 2, phdr->frame_size - 2)) -- 2.10.1 (Apple Git-78)