From patchwork Tue Aug 6 22:18:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 50917 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:d7b2:0:b0:489:2eb3:e4c4 with SMTP id dc18csp22431vqb; Tue, 6 Aug 2024 15:19:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXULOAYc1yAQ8y8zMXBRpj9ClWYn3/ysfrFA3xdGDF4xcbhj7soquZpCPcoAAKGiyViET5tRiSjUEoaodk+rTqE6gq+nJcQBhnfXQ== X-Google-Smtp-Source: AGHT+IEfvEp1ivRlGjMYpTXpo+IIIlzTrqFb5NmuIxLvj4nmNxQYaspF0FfoF1ZKwlr8/qIY5bH9 X-Received: by 2002:a17:907:7d8f:b0:a7a:83a5:4a1d with SMTP id a640c23a62f3a-a7dc50fff5dmr1157043966b.69.1722982774638; Tue, 06 Aug 2024 15:19:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722982774; cv=none; d=google.com; s=arc-20160816; b=SZyHDpiItn2ehiHmNIMAYVCyHcrmf9AiTs7DScXRY8ierCO8y+H24mVZcilj3oJhDn d175PaDm3K/nXQ6RDDIoRs4+uTJBlrvDYfRGnhMhUctMvh2Aos1SbLNiQJ791apdE7+b VP1Je/5kKZQ3Vn1xRVuxLzpwtfUnhbZRps3YMzd8FyGoEUAoRP37xq3Y3/xrqREb44+3 KwlFOO+X4MTCKUNqYeE1RuWQzbV6EUVr4yKNgbb21b1+M337QFZIEf6INq5lFQHSoP+Z 47nlumHlhAVWP3A3MGoipJOU6pCmnX0cE1BDITEqswG2tyemivN3CdXw+WOVYrMTI2cs zxvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=46BuSjP0Azs+05Y0g8XxNrKF+Q8XXIv8xczBPFgmByU=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=IslPrRMeHJsCRWEd846Z1lWolQTGnECAlob8wDCQflUoG0nSIomL+7Y6gxuQwfB0dp dJ5bs/c5TaacjSH3w7l9O5s9koZPB/TTTbfW/QrtTmczp2uHbYLXEG7eBwjBxofWAjXK MFmd+IgfueQBUebH7HVQFNEWcah3gLL7SPF5rETm46g5tx2qZLFrYsbiiPLoj03FEcfK DrRH2V0o0K/TF3N59Ofy86pAULwMVad2riHYzUDOacNPpJfIA/YrjFGWgcdQSisw4Kb8 GGyJ02wcIhUG5qMezmccjSUEPB0zzxpocH+UdDRFsPdZNvgqF7QfpDTIACThiY4A4DwQ rt2w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=cW9XytkN; 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 a640c23a62f3a-a7dc9efce5esi614927466b.752.2024.08.06.15.19.34; Tue, 06 Aug 2024 15:19:34 -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; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=cW9XytkN; 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 E6E5368DABA; Wed, 7 Aug 2024 01:19:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2023868DA33 for ; Wed, 7 Aug 2024 01:18:58 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 7D865C0003 for ; Tue, 6 Aug 2024 22:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1722982737; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ReUhFi4MEAO4RwiF/nHoWgNqcs4Po6kdrcgUMBoXF7s=; b=cW9XytkNpUFLw6fp4rz9YgxZksCMIC+PeA6VBilz+JcG6rjXOpunGb1aN673a2rFOvYuRt jgSfr9Tp6apn7I4WCiaoXCnSetW8WXknXCBGEOjTn1ev5TMZnC0YK0fTivrftotJrqXPBH aDSHdVcDM69IbzcyIYkp4O3LFCswmRF9tPvPsH0KXMIv863Tpyk2VeVJIZ6up4F/ZI+j/H ZihsyE+fXVJeuuZTojbIl+Ph/Cb6w4RVjVcE8NDDeGY+A5xj1De12lRPoad5TpTBWymdsL vTu/E1rn4yKNjWKM0gQVxuVnC2ghNKEQFfJy61XqlOkXXszq9MxdM8DDB8yiUw== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 7 Aug 2024 00:18:51 +0200 Message-ID: <20240806221853.959177-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240806221853.959177-1-michael@niedermayer.cc> References: <20240806221853.959177-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 4/6] avformat/wtvdec: clear sectors 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: bQEWYvNpnaDY The code can leave uninitialized holes in the array. Fixes: use of uninitialized values Fixes: 70883/clusterfuzz-testcase-minimized-ffmpeg_dem_WTV_fuzzer-6698694567591936 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/wtvdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c index e153034aa19..1a6c4c33481 100644 --- a/libavformat/wtvdec.c +++ b/libavformat/wtvdec.c @@ -185,7 +185,7 @@ static AVIOContext * wtvfile_open_sector(unsigned first_sector, uint64_t length, int nb_sectors1 = read_ints(s->pb, sectors1, WTV_SECTOR_SIZE / 4); int i; - wf->sectors = av_malloc_array(nb_sectors1, 1 << WTV_SECTOR_BITS); + wf->sectors = av_calloc(nb_sectors1, 1 << WTV_SECTOR_BITS); if (!wf->sectors) { av_free(wf); return NULL;