From patchwork Wed Sep 20 00:30:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 43851 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a886:b0:149:dfde:5c0a with SMTP id ca6csp307190pzb; Tue, 19 Sep 2023 17:31:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHy8GkkoHzSJF371QiEbN3ycjAgOisTgo8Lgs/TVzM6JQclZUl3Uf3b2Ro3EGvX+xsEMr0F X-Received: by 2002:a17:907:75c8:b0:9a1:b967:aca7 with SMTP id jl8-20020a17090775c800b009a1b967aca7mr643922ejc.42.1695169887407; Tue, 19 Sep 2023 17:31:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695169887; cv=none; d=google.com; s=arc-20160816; b=iUZ9OxEYTtjIxMIMdoF9o+/mMtGb/a1v2poE1cBobaEE4LPOPV5IRpqY1BiSXDAXCU QA7YL8DTlbRMHDIYwCaBQjcOwRmBnmIuYKQOlb+HdBlrJMEh4tS1EC8iAU0vx5QN1d5q +t0pGSQAIEQHyWxZn6Nsmtbh9Km07vROgWIbmxBwNU7lalPKWdvSPM//vramU0Z0v+8j d8bRp7+uPK2NGssPRpghHtMgWTAZa5fVGgJ41Q/cFFXJ9Gt3/sR56bjhIKODg6CuHWcH KRr+LlF80khOnXYS379hxJ87CqoZmkV2y5mpuLp19tFFFuLFSlVD9J+gXntOvyeLL5st AgYQ== 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=x1xGWaa6MoET2XhW4cvUy2YxjEVVyejlaj28L/vNedU=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=K7fQD/XOR4QxplqNnQZYgCVaFbyS1NMSsOA+GF/Cze1eB79OH5UxgE4AGUPow5TEOV GTZ1fbPb7dOb5Rb/ErYhy6fJumnlGhEP+kJ1qry1gMTuPfd3j3IuHjSXABbmMlugdlmT qMzawEcceSpiCRL1UCnysUGfv9uSGl6k52raEtz4u5smJ95cjzRWhQaFpLWagnYEexlI u/yzoHR2ZxiSCgtuRICn09HZSw/YxMcokwjBRt8UX1Dx+LiqCerZZgOMgBYc8UU2wNHf q+JN+by0dj+gIeZbn9ZU7LhCCwT163AKAqPzlXpDOWx3nl7Sh6SfwGAldhcoGmBz7VSM C3KA== 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 p4-20020a17090628c400b009adc86b75a1si8631584ejd.748.2023.09.19.17.31.27; Tue, 19 Sep 2023 17:31:27 -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; 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 D467C68C931; Wed, 20 Sep 2023 03:30:48 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 87A3A68C912 for ; Wed, 20 Sep 2023 03:30:39 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id B602A20008 for ; Wed, 20 Sep 2023 00:30:38 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 20 Sep 2023 02:30:34 +0200 Message-Id: <20230920003034.7241-5-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230920003034.7241-1-michael@niedermayer.cc> References: <20230920003034.7241-1-michael@niedermayer.cc> X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 5/5] avformat/avs: Check if return code is representable 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: eN6MB3pHRENe Fixes: leak Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_dem_AVS_fuzzer-6738814988320768 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/avs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/avs.c b/libavformat/avs.c index ab47980a11c..19f03731573 100644 --- a/libavformat/avs.c +++ b/libavformat/avs.c @@ -140,6 +140,10 @@ static int avs_read_audio_packet(AVFormatContext * s, AVPacket * pkt) return 0; /* this indicate EOS */ if (ret < 0) return ret; + if (size != (int)size) { + av_packet_unref(pkt); + return AVERROR(EDOM); + } pkt->stream_index = avs->st_audio->index; pkt->flags |= AV_PKT_FLAG_KEY;