From patchwork Sun Aug 4 14:23:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 50889 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:1f5a:b0:489:2eb3:e4c4 with SMTP id jm26csp926129vqb; Sun, 4 Aug 2024 07:31:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXkRG2bBYDgOmAvbsx688oKXb8L2/M92jG6djNOTHLzCazCB/dwvpDjXbNoOWFgsHZ7M2sn2HE1OAAncdAqpKa2FrqliCmVVp6wsg== X-Google-Smtp-Source: AGHT+IH3i5WCPnG+/wDGU+ZacnPrYI0LuKw5vSAmxtyx0CRNNWY8BrfSjzHvR1bJuOdaaKvJlS9E X-Received: by 2002:a17:906:4fd0:b0:a77:e48d:bc3 with SMTP id a640c23a62f3a-a7dc4e4490fmr555311566b.19.1722781868301; Sun, 04 Aug 2024 07:31:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722781868; cv=none; d=google.com; s=arc-20160816; b=OWz5eFyxT+Z8wwbZLbeyiHvqcfFMMZMZSIBoqY75Jel/7FJwAvTqRqZR0a5fHuwcRG FRyzZj58BxSiRZgrwizTuseZMKyAiJhrTJSbjK8+R3VDyfqOdn+Oh4cAMoXoyINHV0m7 KB67mOgGud5STYQ9+Q3Jo6F0j+wKevpvh4uE0SnMH+Aeak7QXrp7qqxL5PfMyqOLA5dQ vGdfYiwKtWApqI2bWQzSPNFaAXAozA6Wq0x99iBxvbAYiJNSER4UGfO+kzp4VLIBTAfy 2rqo4Z0tpD/4UFK6qZjYkEmv6MTYR8wD2lJDkMIAw762RFyRVEs4C8CXrzgzJafeA0Mk 67jw== 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=UfSMemwNm7XGVDjOsUAo89q6nvGB4/rzbtaJ5Bu5M2s=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=k+cBvrLO56U7t8uUPUyZgKTgpstMKffPBEOVcVf4CmhUsVDH1izrq+LvXXOJNdDpvC DqzlEvY5pltYKXt850/nqttjU8s6bv1C7DXqHzgQ5YNA55i6UhrXxChYa2JvmJtNY9Ac BwJojWYTOoz7X9keusttWObysQN25rWzoGfW1iP5yS6xnr/mxmWUQEtIVYWKKHfUkrGg Y2Tnqy0Im4AOdU3EGZpvJ+13I2/XVOWTjqc2h8bpXRcbKa/fqqxKmP2ClrM9NsPqKYjz T7WflENO5b1m3XbbYrCablcRNmRAnPB/CF2gCVLj9MG4sPjVLWGm9y+38bj4ycjnWSTM EQPw==; 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=KhNGw5is; 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-a7dc9bd5365si325699366b.68.2024.08.04.07.31.07; Sun, 04 Aug 2024 07:31:08 -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=KhNGw5is; 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 42DC668D96F; Sun, 4 Aug 2024 17:23:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C0D7168D95B for ; Sun, 4 Aug 2024 17:23:20 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 0FCB11C0004 for ; Sun, 4 Aug 2024 14:23:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1722781400; 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=KQHrfaYjGBvnwsGWpVcjIGsH3Sz0D2r0/2STGSMnSts=; b=KhNGw5isOpKHDIQy8vK3kj78/HfFHlPxa8EY3rekWsnzy9fYKRQTAoZlyGxW+w34l4P6ZI YQ1DqixP/ExxcfUlu3Xgo+1OwYtaXmWwBldlo6XEE7SfSB9k6KGELQ3X21soZqf/9yUzoN uGeVRSv6xJZF64N/QN5A59EKTaZNOft4qrhpAXteOgv28/Wq1/mEMcSESeW3qX5ejw5BQT l5DmDv28j3/dIuINdYzv5BNYyVH2gNc8u6vDPQedFRAFlTfWzlc5gUPFeQZnJF8mMnaX9Y 7XfcIrSbgFjSt1JhBTgLk/sYaGoN2BkKdrkDlxufoTF3chYWLctyXQcXoTYN8g== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 4 Aug 2024 16:23:15 +0200 Message-ID: <20240804142315.1430389-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240804142315.1430389-1-michael@niedermayer.cc> References: <20240804142315.1430389-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 4/4] avformat/wavdec: Check if there are 16 bytes before testing them 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: MZWIv/VNWWUC Fixes: use-of-uninitialized-value Fixes: 70839/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-5212907590189056 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/wavdec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c index 00856a5eca2..78e37b88d75 100644 --- a/libavformat/wavdec.c +++ b/libavformat/wavdec.c @@ -874,8 +874,7 @@ static int w64_read_header(AVFormatContext *s) uint8_t guid[16]; int ret; - avio_read(pb, guid, 16); - if (memcmp(guid, ff_w64_guid_riff, 16)) + if (avio_read(pb, guid, 16) != 16 || memcmp(guid, ff_w64_guid_riff, 16)) return AVERROR_INVALIDDATA; /* riff + wave + fmt + sizes */