From patchwork Thu Sep 29 23:09:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 38471 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp1320141pzh; Thu, 29 Sep 2022 16:10:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5A5thmTgdfhxs26xJ1gm8Ax13ZMjDEijAsLeWW0w7MY6qeW5si5J2uZppY1+lxgEXqRYyR X-Received: by 2002:a50:ff0a:0:b0:455:2cc3:920d with SMTP id a10-20020a50ff0a000000b004552cc3920dmr5451443edu.39.1664493037945; Thu, 29 Sep 2022 16:10:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664493037; cv=none; d=google.com; s=arc-20160816; b=sxdzoqsGqI7U2kXUFDW0yLEV5k/TsqtEZ/bsQWR7oRa01u2fuNjpv8c9mPhDoXFxC4 NdtwcZt/eFtIbuxs9+VmB5D0LeS7jgrgYwhdG9bopyx7GBBaF14zksXJvBh8rC4hNYlG kt+A2eAE56lP4EdwhlT5/9Qomd09Q9RRAqHWG/fDGtMNcDPGdMqTKAIfDIjtulB3JiMk QL21cH+7jJ91q0Zf/GyG9M1cEYalDbUjqPDmQbIdKqETzHKT197KtE6uIIV+ILnZkl0t OKPmtSfYqeSDs6FjEzLPq26V9R4SUdx3Aw0svObFigBFPb/D1QOza2KGAx2tCzf1Beqe wn/w== 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=JL06rgxSQA11nC6noiHOWvigln5JcRw3RUyZww5TjUA=; b=TKskkcBfe1YzpPqH/oMnApkJzEQhmMauoEvbXtR2yg6NVHAzahr3PrYAHBn4jMWIad bNC9xsxLBsU2//dZxXUa8SC62cZOTQnGLZICBe3m2C6CIxn7vv0IUBs+oNtPndlOOpfh Jy/bexj86ZEWg/dfiKb6pYJ1z9Nn5odFp/cKteDW36jW2KZmyMk9M1YEpE+fMOKsAPGk UQOdNwTm/snPn3j0vrYxCboQNnVsSgYQeHOMsC631usRWpDDj9rRG/RPoDy045m6ZPk6 wgCRudIk7iWRRnFIn9NnbgrMNhTY5HEiplvfY16n67F5hH+aUCjCaL11TVa2stGtSPYu DFbg== 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 o1-20020a509b01000000b00457cc36dfe3si699034edi.159.2022.09.29.16.10.36; Thu, 29 Sep 2022 16:10:37 -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 AC65C68BB6E; Fri, 30 Sep 2022 02:10:34 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-at03-1.mx.upcmail.net (vie01a-dmta-at03-1.mx.upcmail.net [62.179.121.151]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7835168BB5A for ; Fri, 30 Sep 2022 02:10:28 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-at03.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1oe2fk-00FoId-1T for ffmpeg-devel@ffmpeg.org; Fri, 30 Sep 2022 01:10:28 +0200 Received: from ren-mail-psmtp-mg02. ([80.109.253.241]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id e2b6oUHpr8s8Ue2fko49MI; Fri, 30 Sep 2022 01:10:28 +0200 Received: from localhost ([213.47.68.29]) by ren-mail-psmtp-mg02. with ESMTP id e2emoJ04UbZLDe2emoYG96; Fri, 30 Sep 2022 01:09:28 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.4 cv=Ufwy9IeN c=1 sm=1 tr=0 ts=633625a8 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=NEAV23lmAAAA:8 a=Q9UrsvVGrccBEQDGor0A:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 30 Sep 2022 01:09:26 +0200 Message-Id: <20220929230927.28439-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220929230927.28439-1-michael@niedermayer.cc> References: <20220929230927.28439-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfMtl41bYGeuFBOYhWhXelbr/jzMFlDBfkO/k1eOnsnJaP7DlqUdjRxpY7wMspcgPxeHE+QI6Cy5y6NWFbiyvthy0KExlKOq8gwGBwZNEZ88EgO5OrZs7 wakLWr/XXmlSQyaqfT5+7iox2eWumJfxHuTnFB6snjxU8vxVcsbi5RfrSeqPxjyNvAxz/EWEL8zqKQ== Subject: [FFmpeg-devel] [PATCH 2/3] avcodec/speexdec: Check channels > 2 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: 6yrTWBpKw4/H More than 2 channels seems unsupported, the code seems to just output empty extra channels Fixes: Timeout Fixes: 51569/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SPEEX_fuzzer-5511509165342720 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/speexdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/speexdec.c b/libavcodec/speexdec.c index 9793d939fcb..08c7e77e7d5 100644 --- a/libavcodec/speexdec.c +++ b/libavcodec/speexdec.c @@ -1452,7 +1452,7 @@ static av_cold int speex_decode_init(AVCodecContext *avctx) return AVERROR_INVALIDDATA; s->nb_channels = avctx->ch_layout.nb_channels; - if (s->nb_channels <= 0) + if (s->nb_channels <= 0 || s->nb_channels > 2) return AVERROR_INVALIDDATA; switch (s->rate) {