From patchwork Wed Aug 14 22:37:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 51031 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:a746:0:b0:489:2eb3:e4c4 with SMTP id f6csp1229939vqm; Wed, 14 Aug 2024 15:56:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXNcsPywLQ2S3H7YR0div5iUQu/p89yT9k57TuTCj49xOZXdn9id0ExwdwoZbkqt5PueE17SOncaQPfORf/+hjcKSRfKx9SKpCG4g== X-Google-Smtp-Source: AGHT+IFJ8NQt1UEhqbNWXx7xjpqY4xxow2QSnI6/9uSzybttBX6Or6v+b4fSkvyIWMRN2Rk6Fh7u X-Received: by 2002:a05:6512:3e22:b0:52c:86d7:fa62 with SMTP id 2adb3069b0e04-532eda6be38mr2760340e87.23.1723676174991; Wed, 14 Aug 2024 15:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723676174; cv=none; d=google.com; s=arc-20160816; b=dE3cJyZucdS1f+ZhPx4k7eGY87JKpdxg/6t4gyZsS60CQ/hYbfK7xbOQSuBmzeS+8i Lfas4IWRlNMNcnb45xyKQLjYsQxNXrdifehTn35+ZthRxVp5khGeyYPeCFMy9Xho0wsg YHMLIZhw6I4a33bk1AcUdLeQL7+g8rxl5+p+ezta1iJzG2qOqEOWu+XJirIc5LTaPz8l sxWWvNMN8JSONeUHtayzx1xQQKLeCTOq2V7awTTL9P28hbji7mcSDrfY0/AdToi1+GGp l//7h7wNGUSJ5CQgusvosPX02XW8rbfQIpLRuVUdem991isAjNrA8slmBci067zbZ8vJ A+Sw== 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=zloUSaZqdvp7auZseSn5/BftUiMr21GqtjI9Ew75KIM=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=HQ57GAzpMAtkjVUwNK3kIFkQN97/w0VlrYhIQfSwSAlTJHX94kua7/vwrp1BR0XenJ B0YvxhwpM2Zm6Vq39MECaL/iVzYviNrYJTXv46gtzE62sMXTbVRXFWFjbYM4mYRXKv5E KMi/J1ELnwfkCCPLUDvdPboDAMVIOdE3NV9SAlvRQ30vGDiCLddNzaVThex/Mnyqga1x 3SqYLpXE1B6uCjzF80tnZxd2gUfc/OoHW46Ge+H3LkRKDZEWC/+rqBhYxurjOOvnDKoV TFkzB/4mZ9s3d8bsWgs//TTdYYvvhJ4UvNNg5aWP7yq81rw17HMtZnrbZPSyiQJ0aPh0 Vrdg==; 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=Xr5D8y0N; 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 2adb3069b0e04-5330d3aa135si63923e87.9.2024.08.14.15.56.14; Wed, 14 Aug 2024 15:56:14 -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=Xr5D8y0N; 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 60B3D68DB58; Thu, 15 Aug 2024 01:37:28 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7509E68D9D5 for ; Thu, 15 Aug 2024 01:37:19 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id CB5B9E0003 for ; Wed, 14 Aug 2024 22:37:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1723675038; 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=fOdstOVis5Fj4QM5S6FT6f8dZ+1I6vJPt0R+PtcGFDo=; b=Xr5D8y0NMckMgV+xpJ1B9YPJko82SHTSfOoqmT9CdKa4RZnofT2RU/MY+A3h1tsBGjbMCQ v3Nc4Gdopw4+otdQHwUaxKKH3plRfBYHElA4GJ5gZAA4cMJDP1PH1Q4iCB8UlvU3K1TXQs cYZoeq/v6JxTb5xIQBwYFhRsVWG/ITAdZ8yptsHBJgtLvdKsKoQKn1pIYJxzvWu4gjNLl3 W+7DEA5dL3J6cy9ZPxRMquAsUHu9pz5YN9eocODEgST/5T0E6q/X8PlWhM3qpDKMRG/GBN 9TR+F4izcIfVuilwswk0ajSd1NXNyuues4+kRVtI1tTBrBMdAnwbUpG4nO6JYA== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 15 Aug 2024 00:37:05 +0200 Message-ID: <20240814223714.2436993-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240814223714.2436993-1-michael@niedermayer.cc> References: <20240814223714.2436993-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 4/5] avformat/mvdec: Check if name was fully 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: wd/mDWoX1jHI Fixes: use of uninitialized value Fixes: 70901/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-6341913949569024 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/mvdec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/mvdec.c b/libavformat/mvdec.c index 0718f0483a7..c045d2c7c8e 100644 --- a/libavformat/mvdec.c +++ b/libavformat/mvdec.c @@ -256,7 +256,8 @@ static int read_table(AVFormatContext *avctx, AVStream *st, if (avio_feof(pb)) return AVERROR_EOF; - avio_read(pb, name, 16); + if (avio_read(pb, name, 16) != 16) + return AVERROR_INVALIDDATA; name[sizeof(name) - 1] = 0; size = avio_rb32(pb); if (size < 0) {