From patchwork Sat Jun 17 02:54:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 42168 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c526:b0:117:ac03:c9de with SMTP id gm38csp1965880pzb; Fri, 16 Jun 2023 19:54:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ70orakmaD9CfNCOUrw4SjAcOD34AkaSYCinzRsUPOeKfzcfzrg+TBMTPZwtwN3NcEvvxa4 X-Received: by 2002:aa7:d64a:0:b0:50b:c456:a72a with SMTP id v10-20020aa7d64a000000b0050bc456a72amr3561893edr.19.1686970495118; Fri, 16 Jun 2023 19:54:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686970495; cv=none; d=google.com; s=arc-20160816; b=oa44MdYa/nUqWm1muphcuFEiNcabGUWgXClSr+mSosntAUVXPt6EOoHxu8UkzyQH7w YKrAnApXKl/BR14DVHI/WkLXTgDo4hHNhgF0A3kyKJ5rNrpk10OmG9xQQTEWGhHri51E FPnS3bJd17VpOxe01fO4DP6e6jk75PanN1C3TQSgO+BhRs9ATaebICoSYBPfgYcsQF/j nZfZiiLVArpzNkoC5RCpAQxOqknOvbR1qrpxzrBWe6OQn0CuTeOC+Kht87/4JO/vKpSu d0jHKfK/6MtM/JzeiAHnH9yn440OvScbThJ+jDkOJ+R4mSomK0C7jMEgtxMiymttQjQa 342w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=R2iLj5Pbrskrc+a1a1znHtBcv34cro8Mvi9omJYZ6TM=; b=Rhv3QskykiXtmLYTzcnxxT4KigxN4/A7go8Ftx6cJXMgTNx+UplDZPzNv/ppRqA5gW bAYHR331I9QG3j/FcL69lvYBLJb+ooqPBL/+6mbhGjo5y2jqy5+2ma0wIwk7xkegZIVE kkuHdh/QIu81YpUO4ACgWunfRCqeXw2hPbNM3Orr9qYSsObuK7+NqTVmZNtwAMeyZgU5 aJZXTbNIsJvylKoOfxNpF0fseAMcwzpeTOD30EX2+OIQG+2py0Kja05Ts8edSn4Cd0Jm Cgw7sYzOOoVTp1t8i+d4fA7piq0cNHo1TSotkHGNw/u7zVap20jdRu6k9Om9t7hDfPBv C8tg== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l4-20020aa7d944000000b0051a2eece508si2153301eds.170.2023.06.16.19.54.54; Fri, 16 Jun 2023 19:54:55 -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; 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 F266368C39B; Sat, 17 Jun 2023 05:54:50 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C2AAE68C02A for ; Sat, 17 Jun 2023 05:54:44 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 003702404EC for ; Sat, 17 Jun 2023 04:54:44 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id Hh0t5m9QsrGx for ; Sat, 17 Jun 2023 04:54:43 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 44A462404EA for ; Sat, 17 Jun 2023 04:54:43 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id DB2C63A02F8 for ; Sat, 17 Jun 2023 04:54:42 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sat, 17 Jun 2023 04:54:42 +0200 Message-Id: <20230617025442.1621-1-anton@khirnov.net> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavc/binkaudio: reset input packet on errors 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: MCGQWyQ1Xnad Make sure we don't repeatedly try to decode the same packet, making no progress and possibly causing an infinite loop. --- libavcodec/binkaudio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index f28ecba760..265f93a822 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -325,7 +325,7 @@ again: if (s->ch_offset == 0) { frame->nb_samples = s->frame_len; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) - return ret; + goto fail; if (!new_pkt) frame->pts = AV_NOPTS_VALUE; } @@ -334,8 +334,8 @@ again: avctx->codec->id == AV_CODEC_ID_BINKAUDIO_DCT, FFMIN(MAX_CHANNELS, s->channels - s->ch_offset), s->ch_offset)) { av_log(avctx, AV_LOG_ERROR, "Incomplete packet\n"); - s->ch_offset = 0; - return AVERROR_INVALIDDATA; + ret = AVERROR_INVALIDDATA; + goto fail; } s->ch_offset += MAX_CHANNELS; get_bits_align32(gb);