From patchwork Mon Nov 21 23:58:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 39383 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp2622312pzb; Mon, 21 Nov 2022 15:58:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf46e2xzBXjWCemjc+JMP7hqsMkrfMP/LLUUgh2oVBt2aFSs36m6fFQE0b4pV17CD+7vKiG8 X-Received: by 2002:a17:906:124d:b0:7ad:b822:d2e4 with SMTP id u13-20020a170906124d00b007adb822d2e4mr17412024eja.35.1669075125225; Mon, 21 Nov 2022 15:58:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669075125; cv=none; d=google.com; s=arc-20160816; b=OMvRdIFsg6l57lAgqvLTwwgD4+bBjO9PaXLiyEMsFJlr5scrO6QiW2XjpC+VFDev0M /vgyoXJEBChsOIHu8tV+ofNfNuIi3V2/JDeOTbE5glZEOVo7ErluH6LvUizuR+cah+Ko Lf93njBaujBoF1B9xWIICe9BCfZDYomVwSAmA6pFudzatdbsKY5C/YN4zS9BtkChJeB2 iEIMAdO159wPAVj9bzm+DTqzRri/HncGTFoKfk3zwO/hmBbdJ9/e9w7ZmyK+T7kOmPdx 6219Gt2D4PlZGkwiRXvOZ3kykA8eo+rRQyarHV6CV5ymVFp4nLhzC5xZUYIQtW3RMtb5 kkcA== 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:references:in-reply-to:message-id:date :to:from:delivered-to; bh=d7LxUjSRJA+0dxelidTkhV1OjZSRSRD8hrJec8nJdj0=; b=LVg1vatrJA01oXkKjNM1FlvMDhEw7E7qXEQ6GBjgAJ8rlOiH3h7MZ8D6EEy8BwlQ8t Io+V5pDE+LFpDW71ApuG+BiTnsJ8CgQtSjVAO4ouZiWilJUS47XiZQXJEg0YqzfdXS1f gGX8phK+eNnKQGHYm1WE/3xJHA3LNYkO9+1ig8giVW5iaBgqQDmFqxqkePYvI5M9EcsK QYvZ54bc+g0jRz8ofEzeqJVDDkAExQZy/Oshh+K0HWNO040DTWmpG4siIDcGk8UFn6Kj MIIXSXLR5qZE8uOcKCeowhTobIGgKqOEu/g9Wrurb7WmyLVQXKSwdedOGXCObxuuCL0F N9UQ== 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 wv4-20020a170907080400b007ad855bc09csi11748230ejb.595.2022.11.21.15.58.44; Mon, 21 Nov 2022 15:58:45 -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 7D69868BAC7; Tue, 22 Nov 2022 01:58:32 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C795D68B1A1 for ; Tue, 22 Nov 2022 01:58:25 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id EB7E140003 for ; Mon, 21 Nov 2022 23:58:24 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 22 Nov 2022 00:58:22 +0100 Message-Id: <20221121235823.28468-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221121235823.28468-1-michael@niedermayer.cc> References: <20221121235823.28468-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 2/3] avcodec/mlpdec: Check max matrix instead of max channel in noise check 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: kPv+JHUqhgpg This is a regression since: adaa06581c5444c94eef72d61b8166f096e2687a Before this, max_channel and max_matrix_channel where compared for equality Fixes: out of array access Fixes: 53340/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEHD_fuzzer-514959011885875 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/mlpdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c index 0b0eb75990..5b14a3b03b 100644 --- a/libavcodec/mlpdec.c +++ b/libavcodec/mlpdec.c @@ -539,7 +539,7 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp, /* This should happen for TrueHD streams with >6 channels and MLP's noise * type. It is not yet known if this is allowed. */ - if (max_channel > MAX_MATRIX_CHANNEL_MLP && !noise_type) { + if (max_matrix_channel > MAX_MATRIX_CHANNEL_MLP && !noise_type) { avpriv_request_sample(m->avctx, "%d channels (more than the " "maximum supported by the decoder)",