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 839C94A16A for ; Fri, 22 Mar 2024 23:08:39 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 857F868D4DB; Sat, 23 Mar 2024 01:08:28 +0200 (EET) Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B80CE68D4C7 for ; Sat, 23 Mar 2024 01:08:20 +0200 (EET) Received: by mail.gandi.net (Postfix) with ESMTPSA id EA38A1BF206 for ; Fri, 22 Mar 2024 23:08:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1711148900; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:in-reply-to:in-reply-to:references:references; bh=imzO7dm8F0h/35i6YzZqeC+zHMJ0IAe6Ev0D13B1Liw=; b=mCRMUKhPQONUGEAp++XWVaeu6WtaR2H0jZCfHPKvVL2b/A6VSUtNVg2t9xXJqs3Uq5+ZO9 LmkH4Jx3CpWKBj7yxQY3qZv1mb74ZHXx2dvd8iCMVZKzrbTvVjgNAWKlfWKb8jO7TO5e+/ TJWFD0urrvVRJ7hl7dHRDpMyNX8/kUuA+xTRqjsWLfKnU/Kw18dF4uYa2u4/WRg64YBBg5 YenO6WAYxNbIViOCmCnzRjuUJzSgaG94tiwxrII11ukgGqgWRC8FYioRNwiBZTDxYAabcJ pCgkVNGco0D3s2hCF3PciMvCRxsvqL4jADtw/t7bnhI7iTtSljo9bWC3p6HCMA== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 23 Mar 2024 00:08:17 +0100 Message-Id: <20240322230818.18997-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240322230818.18997-1-michael@niedermayer.cc> References: <20240322230818.18997-1-michael@niedermayer.cc> X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 2/3] avformat/mov: Do not deallocate heif_item in a input dependant way 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: out of array access Fixes: 67070/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5685384082161664 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/mov.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index f954b924a0..a87ce5cefe 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -8077,7 +8077,7 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom) } item_count = (version < 2) ? avio_rb16(pb) : avio_rb32(pb); - heif_item = av_realloc_array(c->heif_item, item_count, sizeof(*c->heif_item)); + heif_item = av_realloc_array(c->heif_item, FFMAX(item_count, c->nb_heif_item), sizeof(*c->heif_item)); if (!heif_item) return AVERROR(ENOMEM); c->heif_item = heif_item; @@ -8202,7 +8202,7 @@ static int mov_read_iinf(MOVContext *c, AVIOContext *pb, MOVAtom atom) avio_rb24(pb); // flags. entry_count = version ? avio_rb32(pb) : avio_rb16(pb); - heif_item = av_realloc_array(c->heif_item, entry_count, sizeof(*c->heif_item)); + heif_item = av_realloc_array(c->heif_item, FFMAX(entry_count, c->nb_heif_item), sizeof(*c->heif_item)); if (!heif_item) return AVERROR(ENOMEM); c->heif_item = heif_item; -- 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".