From patchwork Wed Apr 11 11:40:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hendrik Leppkes X-Patchwork-Id: 8401 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.1.70 with SMTP id c67csp604809jad; Wed, 11 Apr 2018 04:49:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx48GhEW44iW5YaoI9VYcF58uw7D3RCGxyLaa0axYFiW89vm+1eT8iIIJ5/RSl5soPjwhSHw5 X-Received: by 10.223.151.130 with SMTP id s2mr319740wrb.245.1523447351426; Wed, 11 Apr 2018 04:49:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523447351; cv=none; d=google.com; s=arc-20160816; b=xExN/ohQ2BnIi4AFjWEKSTCctgMH/sHXZAuzM2wtRSzSqVny5b/ndrs2F0yws+lXLA Ka8YfcsWUXvk48ZRHlbhNg5pofES1/p4riqczL0+59arAvBAz5SuLwviDagode1Jxwlr euIggAMDGE5Wq8Jx5xmCWR9iWzpedSJddfd/o8zmOG34b3n/jVisdaXMBmS+Gexwdyhj te/KGT/9CyP69jR5Jeyg42gWWFKorqnvEAvSFTMAYqSQJNSdg0JpQ7ZdLAEIWorYewog 7VR6d7p9gjKonicWxrh/K0hFRIayRDlyaLAVcq/WxS7y0cw4YbTe0c+mqmRjt9fwjh7p nVBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=z4/pNCHI283KKuePOzwLmr4dBnk97r6avYLeG90haa8=; b=g4YG1SbV7Cr92oLcUPIYiEf5mVKj5QRlAxMQlHlMlCboPQFvpnGXcJxgiGLWRbDIAv vLU0TprcRa51Wp21U/387siJC7gfIK13hgILoYu1I4gKAzEDdgVeNpPkanR5IrwdgivP 5GmddNI3MYjgRWV0V2wgt/i4kMrkm8/Fj0+h+38JccKCafOFXts/200qUvdpsvscD/TV m1OjiXEK3kf7J4ofAScnQziL42pNLWdYP+PtI9B1iqIE3cSJF0Ms6kDV7rmmt+QOKP2y BGeWsBoK6J4fqHciknwx28rz56cgeD4H6VejME2JKbQAIlALePeRMud3VNoNKKEBQqq7 pW7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=unaWHPU7; 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=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id r16si790289wrb.109.2018.04.11.04.49.10; Wed, 11 Apr 2018 04:49:11 -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=@gmail.com header.s=20161025 header.b=unaWHPU7; 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=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C6C7368A2C7; Wed, 11 Apr 2018 14:48:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com [74.125.82.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AEE0F68A2BF for ; Wed, 11 Apr 2018 14:48:37 +0300 (EEST) Received: by mail-wm0-f45.google.com with SMTP id u189so3547284wmd.1 for ; Wed, 11 Apr 2018 04:49:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=3k+WVePdny7e47uitsn7E4CaRDtqAIXnuOj/XoKwNKs=; b=unaWHPU7nyG4vpqlKbS1d77lXCctNsXyz0hVVkKzf3KDZU8iqLDRxeVs0b4R1ljIir iYI+KJrdExLFUkSDpoPGT8LjWbRqvsOHIwXhUMYnEJ8szFLXofNUcswlLCT5pTA9ZKC8 7nUEih4rYI/YGXbF23YCmwG2l000HtjjKUvJzgKWY/1UUSLnoJpsTeAadIrNzdmI0b/V QuNA9MbaMlBDy3h0zHXXX7xiIsGaLAhCXZaVErYI0Ng9lH3AePxlkNyrVUiJ2aAWOowj n3QxhOHRtAT8IKxSmZNGWr3KhJ0xI8g8v4WQUbkjuS5XwP0dZlAj1KLEwQP5JM0Uq2eN doOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=3k+WVePdny7e47uitsn7E4CaRDtqAIXnuOj/XoKwNKs=; b=UHyrIDEjwGEXyrNcflb9EJSJCSDcGbQ9U84jgxc1DjrFKmjNkljLdvsV0OU+Dpt9tH 5nU04axFi36mzJ0O0zcjNE3OTamCPmBLY202zm1iwCW0qTafq5G0L1wEpWSl1HNvzTI0 m31ofOLEvTSWX9jRaVR7BAp4j6uyWDWread8gDAmzINOI+zLBsWPZIDFdAb97Ja3pwPI 2tpzv1ZITI0LQsSJaSAAC15HNeWyGSpN4/AH0x/zlAk/miO5cmWco4gACaJeMS/AG4lN Z5ALCojK9+OL8vudUCDapiFlezAJ0lVokhWEDR+1767RuqWNvgFOofprwYd8u5YXNpij mDyw== X-Gm-Message-State: ALQs6tAzgxJcI9wXQGL1D3nFJMnCNMItYmpwDK6/vZSYUxOWXxsyQnGz XVMxjL3ZYgI2uc2os6SDph0zNCyD X-Received: by 10.28.194.85 with SMTP id s82mr2343252wmf.20.1523446842875; Wed, 11 Apr 2018 04:40:42 -0700 (PDT) Received: from localhost (p4FC4F922.dip0.t-ipconnect.de. [79.196.249.34]) by smtp.gmail.com with ESMTPSA id j21sm1473950wrb.49.2018.04.11.04.40.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Apr 2018 04:40:42 -0700 (PDT) From: Hendrik Leppkes To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 Apr 2018 13:40:40 +0200 Message-Id: <20180411114040.1596-1-h.leppkes@gmail.com> X-Mailer: git-send-email 2.16.1.windows.4 Subject: [FFmpeg-devel] [PATCH] avcodec/aac_ac3_parser: account for data already in the parsing buffer 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" If a frame starts very close to a packet boundary, the start code may already have been added to the parsing buffer, indicated by a small negative value of "i", while the header is still being tracked in the "state" variable. Reduce the remaining size accordingly, otherwise trying to find the next frame could skip over the frame header and lump two frames together as one. --- libavcodec/aac_ac3_parser.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/aac_ac3_parser.c b/libavcodec/aac_ac3_parser.c index 019074b0dd..7f20626285 100644 --- a/libavcodec/aac_ac3_parser.c +++ b/libavcodec/aac_ac3_parser.c @@ -60,6 +60,8 @@ get_next: s->remaining_size += i; goto get_next; } + else if (i < 0) + s->remaining_size += i; } } }