From patchwork Sun Mar 5 11:43:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 40585 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:d046:b0:cd:afd7:272c with SMTP id hv6csp2128646pzb; Sun, 5 Mar 2023 03:44:06 -0800 (PST) X-Google-Smtp-Source: AK7set+xCGoaaDZ9dlO2qMpIIS+8/53g1aFtlQYSzv13m8stKvXX6oCaY3YyiUe4IOX6J+Y6XCIF X-Received: by 2002:a17:906:30d3:b0:8b1:3d04:c2da with SMTP id b19-20020a17090630d300b008b13d04c2damr7839247ejb.45.1678016646437; Sun, 05 Mar 2023 03:44:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678016646; cv=none; d=google.com; s=arc-20160816; b=syk528xPhd1M1D9eC0SVHIphstnhkrht/LJWSSXVfMUyOto13PrR1twZiSTT4uZprg NioxCyVS5O73EzHjvX6M7i0ewvWzaWFLzpgBPoKJifJzjEXMyYvdAQqaVrCNf+N9k5O3 DX/BKpnHmKtUM5WtJ0DC3g13jjlUjbxNlK5dqG7CzoX4IJ58dBK26rdUFsqSeilxJgqg hQjgTuaCFpw/O3viO7c990piujTCvEVCP9Wmcq6UL7LPRAY9D0VXQ5D/5fSDa69L7HqS IwEC8Eex48X+y09n2KaxXP3gga/Fldva6BTC8y3wA772i/CJ5rdXfHLgkndV5D6hFu2p vP3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to; bh=+0AWAWdNeZio/UhVJwS9aLnuj0kgk24ha7lbaVSxB1w=; b=mE2AareDfzHcesCjkvNJpoXqFCVcyiSgORTBVIMMBsq3pMqmDkXDi9gBZ2rkMSUR/X fTIosDkwEDefHJOJLymjSbkNIG4KPMYe2J6FfGrVYf7BFCVeK3clv7eiEjW/G2UEg+eh +uzcKpjRXb1ZPrlOlH6dlLXBuF+EoE5xOGPY3NGpLLZADO6tk0ffySNCNQyffrK2Xlw2 bj9apXHPOcbEZYur7G3mdGACOl8aimEXZZCsrKlDNE0Gm2+YVuOVHu4wgmMnKIcY/vKZ 5vp0GYTSheh1SddPK1Zg+QDcLlRYF4uUfP3/dW201+/bo2DrZMThKAt37ZFflXRE9Leu +w4Q== ARC-Authentication-Results: i=1; mx.google.com; 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 gs20-20020a1709072d1400b008de9287d513si10484219ejc.7.2023.03.05.03.44.06; Sun, 05 Mar 2023 03:44:06 -0800 (PST) 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; 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 5446E68B2EB; Sun, 5 Mar 2023 13:43:56 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org 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 8D7C968B14C for ; Sun, 5 Mar 2023 13:43:49 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id B6E0140003 for ; Sun, 5 Mar 2023 11:43:48 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 5 Mar 2023 12:43:46 +0100 Message-Id: <20230305114346.19875-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230305114346.19875-1-michael@niedermayer.cc> References: <20230305114346.19875-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 2/2] avformat/wavdec: Check that smv block fits in available space 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 8esrLVp49Z2B Fixes: OOM Fixes: 56271/clusterfuzz-testcase-minimized-ffmpeg_dem_WAV_fuzzer-5290810045497344 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/wavdec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c index e3f790fcc9..97e69ab2ee 100644 --- a/libavformat/wavdec.c +++ b/libavformat/wavdec.c @@ -730,6 +730,10 @@ smv_retry: goto smv_out; } size = avio_rl24(s->pb); + if (size > wav->smv_block_size) { + ret = AVERROR_EOF; + goto smv_out; + } ret = av_get_packet(s->pb, pkt, size); if (ret < 0) goto smv_out;