From patchwork Mon Jan 30 23:45:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 40184 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3ca3:b0:b9:1511:ac2c with SMTP id b35csp3799515pzj; Mon, 30 Jan 2023 15:45:50 -0800 (PST) X-Google-Smtp-Source: AK7set863TZI8eEOxRLbgxofzGhCHepKvdbg9+3knYNgOy+0gg7lb5e1uXHeaky3jcASuunZlhTe X-Received: by 2002:a17:906:4912:b0:878:4e83:b058 with SMTP id b18-20020a170906491200b008784e83b058mr19675090ejq.1.1675122349983; Mon, 30 Jan 2023 15:45:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675122349; cv=none; d=google.com; s=arc-20160816; b=e7Ewv6uK1E+7fiiyplxVbJLyiQFOY1Vr/4sg3iz+QJgB95ELqVAuc9C9JpbUuGTQBA xYrLfDhEe/z58WthLsSskYPaP6GN1LcvE8kxXixBo+k4E9Le2ONfPeT2PFAzvDTeZtk2 ABnBH22y9lK8WEaJ3rYLAkIPRsmb6hXMIuZ68HGrtD52HMoeIlQ0SdaBxc435sAbnQ6b 1em4DR1HHowgfHQbNqdvKiSzysQJyGKVVLvjcfhClAtIEdY+X1rCoyhksYWvqUqMZxEi aokTWihYb9kl9kx8IGEaKBmWDHc9/eh1Y+a4OeREmL7iQsFFeREGvJ23Bg0SIKPOXj4D fCQg== 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=/dmRd81KM/ksrWobSpEa2uA4gcfVSixO3iOVTjtwZs0=; b=AqzOMxu8UGC7OIRLmUYrS0mLAs1uDnrPfrvphxuTOnTNHFVSUOgnDZXXs8d+Qj4fPG maDc9pYJl3Jb7+9S/gxrTVu9d+dbxARGp2SGLFsG8CfDIKwhrt+EohVZuxdWeXdnCYcw n7uNHoDvMf8V6zikJeBNNsed6lGNqTNE2SXjCjXyGDSjyw0W7ei/o3bDonJbljxIedQq r9rhgdsTkn35boxwlh/sZwzg6S7E+zb8V6NyWncIttyB+o7pu3SYyqy2/LDcftXbHDGq KVTrxtl34C4h1yOjOE1oJJY5IeaPk0SLSNJgB1rU2SKUaZvHxgr2sq3HlNp+qMfViu/N Kisg== 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 u19-20020a170906109300b00878b89075c6si16727734eju.738.2023.01.30.15.45.49; Mon, 30 Jan 2023 15:45:49 -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 0ACA768BE0E; Tue, 31 Jan 2023 01:45:37 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F044A68BE01 for ; Tue, 31 Jan 2023 01:45:30 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 2BA79FF805 for ; Mon, 30 Jan 2023 23:45:29 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 31 Jan 2023 00:45:26 +0100 Message-Id: <20230130234527.13149-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230130234527.13149-1-michael@niedermayer.cc> References: <20230130234527.13149-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 2/3] avformat/lafdec: Check if all data was read 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: mjOXgD7BJc2Y Fixes: OOM Fixes: 54572/clusterfuzz-testcase-minimized-ffmpeg_dem_LAF_fuzzer-4974038870523904 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/lafdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/lafdec.c b/libavformat/lafdec.c index d02b479c4d..b78ec3649c 100644 --- a/libavformat/lafdec.c +++ b/libavformat/lafdec.c @@ -208,6 +208,8 @@ again: ret = avio_read(pb, s->data, st_count * st->codecpar->sample_rate * bpp); if (ret < 0) return ret; + if (ret != st_count * st->codecpar->sample_rate * bpp) + return AVERROR_INVALIDDATA; } st = ctx->streams[s->index];