From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 857F7499AF for ; Tue, 26 Mar 2024 02:31:05 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 81B2868D4A5; Tue, 26 Mar 2024 04:31:04 +0200 (EET) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8CB1468D4A5 for ; Tue, 26 Mar 2024 04:30:58 +0200 (EET) Received: by mail.gandi.net (Postfix) with ESMTPSA id DC34B60002 for ; Tue, 26 Mar 2024 02:30:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1711420258; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc; bh=IqI6J08s+ZE23X2CcSYim/nJhz7Z20QxLYA45Lv/SFw=; b=BFJkV3BPooWOb2lhIF7f19+mTnnUgRoRxx2iqJDtSBXIcgFbGYLO6BkhWCinEvhjY/AJi1 ljyuq2cHl+2ptQv8BzO9Vfcqov8VxHHr2GTGldsI9/b/iknrv22qUh8vYpJ0d5OCKH+QK3 ynQhKspkyBsiYlgtrMDCmVbbGhMhPfGgcH4XGNA2Eo6EmKnTjA2590M2Ylex4LEQqBKck9 wdc6PjXWKx8QAgCJ4JA24GljnhvSw+49D4uBFQLHHocmSyTVdIvDF3hh3Cuin7eihRQDDa OQMBbhrVieySHEYLzJkUa/glys0/hqoSJHw2LUIglSXoc2XVj9UWgnlhd09QVQ== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 26 Mar 2024 03:30:50 +0100 Message-Id: <20240326023056.20548-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 1/7] avcodec/hcadec: do not set hfr_group_count to invalid values 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Fixes: 62285/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HCA_fuzzer-6247136417087488 Fixes: out of array write Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/hcadec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/hcadec.c b/libavcodec/hcadec.c index 026b998341c..8c8c235f7b3 100644 --- a/libavcodec/hcadec.c +++ b/libavcodec/hcadec.c @@ -212,6 +212,7 @@ static int init_hca(AVCodecContext *avctx, const uint8_t *extradata, int8_t r[16] = { 0 }; unsigned b, chunk; int version, ret; + unsigned hfr_group_count; init_flush(avctx); @@ -336,11 +337,12 @@ static int init_hca(AVCodecContext *avctx, const uint8_t *extradata, if (c->total_band_count < c->base_band_count) return AVERROR_INVALIDDATA; - c->hfr_group_count = ceil2(c->total_band_count - (c->base_band_count + c->stereo_band_count), + hfr_group_count = ceil2(c->total_band_count - (c->base_band_count + c->stereo_band_count), c->bands_per_hfr_group); - if (c->base_band_count + c->stereo_band_count + (unsigned long)c->hfr_group_count > 128ULL) + if (c->base_band_count + c->stereo_band_count + (uint64_t)hfr_group_count > 128ULL) return AVERROR_INVALIDDATA; + c->hfr_group_count = hfr_group_count; for (int i = 0; i < avctx->ch_layout.nb_channels; i++) { c->ch[i].chan_type = r[i]; -- 2.17.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".