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 D1F334975F for ; Wed, 20 Mar 2024 02:19:46 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id ADF4D68D4BB; Wed, 20 Mar 2024 04:19:35 +0200 (EET) 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 0910A68D3FC for ; Wed, 20 Mar 2024 04:19:28 +0200 (EET) Received: by mail.gandi.net (Postfix) with ESMTPSA id 3B8F340003 for ; Wed, 20 Mar 2024 02:19:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1710901168; 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=5SVshkR0/NqBiezynFLwr1qgIo2msQYnibEWTIvlwe0=; b=MJ78Hk8OOdB8Fhq5QxFvu6Hna5nbDVw6eBauahJKeM4mQhZu831VGXyhbBpJPHqg7bIqGd yiwiTzDPCWQn+8EDAjwQFcGPojVxtDTdR0BucRxqlKL0Da/rAR+7SdE36a5fl0fQw/icWx azyVWtF64Pv1jTDjEG0oyDALt33TiEsmHdMw0PoX98GE15rCd1hVxbHaVmfm4dFZj/Xmsj dlGE+/af+y7GHwSIVAXg6cjTpvLQP87QBD38GhpJG1biGvtXFugfxd7NyIyNwQ5qxybSC5 EAdIQLvXcx7zErvXtEVQq3PyJViaADJqzEVJM8OZWUm3jpHQzaz5LTLp3DSnyQ== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 20 Mar 2024 03:19:25 +0100 Message-Id: <20240320021926.3759-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240320021926.3759-1-michael@niedermayer.cc> References: <20240320021926.3759-1-michael@niedermayer.cc> X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 2/3] avformat/mov: Check sample_count and auxiliary_info_default_size to be 0 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: This combination causes 0 size arrays to be allocated and to leak later Fixes: memleak Fixes: 64342/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-4520993686945792 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/mov.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index 8d1135270c..f954b924a0 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -6994,6 +6994,9 @@ static int mov_read_saiz(MOVContext *c, AVIOContext *pb, MOVAtom atom) sample_count = avio_rb32(pb); if (encryption_index->auxiliary_info_default_size == 0) { + if (sample_count == 0) + return AVERROR_INVALIDDATA; + encryption_index->auxiliary_info_sizes = av_malloc(sample_count); if (!encryption_index->auxiliary_info_sizes) return AVERROR(ENOMEM); -- 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".