From patchwork Mon Jun 27 20:02:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 36489 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:8b27:b0:88:1bbf:7fd2 with SMTP id l39csp2225933pzh; Mon, 27 Jun 2022 13:03:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sZZMRCiVtaN4p2qsBP0qFAyq8pE9gqMEOeJH2bVIcF5gnbCJS1AqyfbzlozSeMrMm9jcc6 X-Received: by 2002:a05:6402:498:b0:435:daf0:915b with SMTP id k24-20020a056402049800b00435daf0915bmr18426107edv.322.1656360204436; Mon, 27 Jun 2022 13:03:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656360204; cv=none; d=google.com; s=arc-20160816; b=l2NvhHxdJ7yaDrv+XBrxOphNTbO5AHCVpSCeAVSzhGRvR9sK8V0NjfxclzKbFS6iev h2XDqOz3zPkQD6lkWVPHb15lmXeSOfQnfjh3naAVdLkRDxn3ZjAqGgL6FQlMC1Q4VQiZ xb2M4rjk00BRTqPIPh6Hjzc8S5xBxu8VMlyzo2XE3KCkNxNl66JuMX961YlYS7Lpe/GH APVJ3jEG9NN4dYk/DCS+Pam9Zc24jJ6bK9+7rZ6ebtHY+/CZVTfDZ5v+5nDmCTmohQqA RMouk2fx8U2PFvmBe/4ObHSK8fhtJV3KaN2oG3v6WcqBKo29eBSSNR9EB3jIXmU2vMMm MYZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=lvvFaj0RsvTWeNmG/nBtf65YC2CkHavOVjYWP3JUeqg=; b=OFqGuOr7T8/iMu2NRBlASOPNbQn8NZMrWbS6rV8jDa4TrVYVFGuJKVOe/ht+T8zMvx RJZT1WngW9u4wa0g1n3wqURMhTHQQSM7Jhd2bSZ4AFyl884u/PABcJAsBaDGUyrl6rbw Vijacy5GPJqM/OPbC6rqWe1wWXP+CMOharj0GaO7w7lNKsLnDW3ncCdsoYUOfSMuHpvE Nch8uTX1xzF/LCEkr0kX0GAhi8VFNS5v/VV++O2gSboyvXNzm1a9fv6Fgk2/bf33s76n 3a2Ksu1s3AR6bvsWd5++btWwI3TOqEVALeXe4mNnkbQB0IA1EXhCum46oWWnjXhtf2hN v7iQ== 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 f1-20020a170906084100b00722f70201d6si10538516ejd.612.2022.06.27.13.03.23; Mon, 27 Jun 2022 13:03:24 -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 0769E68B8D9; Mon, 27 Jun 2022 23:03:21 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C717768B682 for ; Mon, 27 Jun 2022 23:03:13 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 03DA8E74EF; Mon, 27 Jun 2022 22:03:14 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pLKsVUOfNaFm; Mon, 27 Jun 2022 22:02:46 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 91619E5349; Mon, 27 Jun 2022 22:02:45 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Mon, 27 Jun 2022 22:02:39 +0200 Message-Id: <20220627200241.7102-1-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] Revert "avformat/demux: Count EAGAIN as 100 bytes in relation to read limit in avformat_find_stream_info()" 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 Cc: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: KIxiG5lbv6ML Modifying avformat_find_stream_info() behaviour based on the number of EAGAINs it encounters is a hack which usually only hides the real issue if such thing happen. This reverts commit b0cac7082d8a3ff2d4f039af01b45c48bb578de7. --- libavformat/demux.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libavformat/demux.c b/libavformat/demux.c index e121253dfd..57720f4311 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -2615,10 +2615,8 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) /* NOTE: A new stream can be added there if no header in file * (AVFMTCTX_NOHEADER). */ ret = read_frame_internal(ic, pkt1); - if (ret == AVERROR(EAGAIN)) { - read_size += 100; + if (ret == AVERROR(EAGAIN)) continue; - } if (ret < 0) { /* EOF or error*/ From patchwork Mon Jun 27 20:02:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 36490 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:8b27:b0:88:1bbf:7fd2 with SMTP id l39csp2226006pzh; Mon, 27 Jun 2022 13:03:34 -0700 (PDT) X-Google-Smtp-Source: AGRyM1saZkhaijzFEyfJH7IS+xJDd/YWi/crNGrnbx2/V9rjnLRwNYhnpNWM3zP0O22FTltKHQ+r X-Received: by 2002:a17:907:7204:b0:722:e164:933f with SMTP id dr4-20020a170907720400b00722e164933fmr13971191ejc.768.1656360214160; Mon, 27 Jun 2022 13:03:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656360214; cv=none; d=google.com; s=arc-20160816; b=STztW9spJWfMvq+jqHJ9pLy9SeJt3fjVhyiP4hAKBk7ZnH75X5EZwnoUjDVoovjNY/ IKYWjLjOTZUgjqETOFAF5a6FUB4OYZO5BAegb4hKIIyD7bTJCn8kMa9GpIrZgQbiB+CY 9HVFVqjXWl0AtN8Fu1vFCFFLhc73TRU+tBaP2i5NJUL01cqtA2Pb+hkfkr+yCL+ZTOBB S8KJtX1rFMC2WdCOtAUIb+oz1h/LLL1eAUiO+xHGUKCoYHFVRR2Sv52c7XmR1VCT16Ix BCXCLqcRSx841mQHOTyuJy4Pj2ZDVAxDcl4TmJulC/G/AHlC9hRr5rYjSY/GbkDEd5Gj s7QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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:delivered-to; bh=EzrQZ1IGOlKnLUasoAdOFw/hAHZ+20PvXBIasBqRfLw=; b=rYu/2tHitg2ptau0qZLf7A9Sa6+8uOrwT5aHYvh7uDsbDClHhx3vn90EioHEL2XZc+ M4KPw6uSEVxbyhU8xweVxLlse5cCRUW73WvBYIg1V0wrg3ZIPk4dTZadD8oksk1KvpEo eKMJC4fgzt/wBYSLGdRqqAR9T10zLag2Bswo+LnHVaDwoZ5JwZ7+k61EX3Z1p73HDcRj nuQRxAPnH5Ae2puvOW2dehvLYM1XHrvrPaq6PwOWPBXPpaWJWeXJ3r0he3Q90IZqzPNv CV1rs9sw/0WkEBHE9qBmMosXKLC45+wyoqX3HLDdQy1Gcr8+SO//r4ykjFH03kgiEd2+ TFpQ== 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 m15-20020a056402510f00b004372b5307cfsi12537365edd.247.2022.06.27.13.03.33; Mon, 27 Jun 2022 13:03:34 -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 34F5468B8E8; Mon, 27 Jun 2022 23:03:24 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5B3B068B8A1 for ; Mon, 27 Jun 2022 23:03:17 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id CBC52E5349; Mon, 27 Jun 2022 22:03:16 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pUJlhJ7kp4sR; Mon, 27 Jun 2022 22:02:47 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 63D45E7451; Mon, 27 Jun 2022 22:02:47 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Mon, 27 Jun 2022 22:02:40 +0200 Message-Id: <20220627200241.7102-2-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220627200241.7102-1-cus@passwd.hu> References: <20220627200241.7102-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] Revert "avformat/demux: Make read_frame_internal() return AVERREOR(EAGAIN) on stuck empty input parser" 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 Cc: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: y2VeDS84y1Sx Hides the underlying real problem with a demuxer returning 0 sized packets. This reverts commit 02699490c14e86105104940c009953081f69432c. --- libavformat/demux.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/libavformat/demux.c b/libavformat/demux.c index 57720f4311..1620716716 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -1235,15 +1235,11 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) FFFormatContext *const si = ffformatcontext(s); int ret, got_packet = 0; AVDictionary *metadata = NULL; - int empty = 0; while (!got_packet && !si->parse_queue.head) { AVStream *st; FFStream *sti; - if (empty > 1) - return AVERROR(EAGAIN); - /* read next packet */ ret = ff_read_packet(s, pkt); if (ret < 0) { @@ -1334,8 +1330,6 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) } got_packet = 1; } else if (st->discard < AVDISCARD_ALL) { - if (pkt->size == 0) - empty ++; if ((ret = parse_packet(s, pkt, pkt->stream_index, 0)) < 0) return ret; st->codecpar->sample_rate = sti->avctx->sample_rate; From patchwork Mon Jun 27 20:02:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 36491 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:8b27:b0:88:1bbf:7fd2 with SMTP id l39csp2226159pzh; Mon, 27 Jun 2022 13:03:48 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sADE4Rrs2C7VOKOmnp3ZCDt5yDyNSQJT2ZosWYrFh6CvNQYZX8fqn6iMjEJmVnBzzIpRLe X-Received: by 2002:a05:6402:5249:b0:435:a419:300a with SMTP id t9-20020a056402524900b00435a419300amr18762926edd.56.1656360228189; Mon, 27 Jun 2022 13:03:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656360228; cv=none; d=google.com; s=arc-20160816; b=kScrS2jPcwujek8tXrwDeTkw2huOTwUgn10SpksHFmH5h62okAQrd4MLXLaSam5LCU tD7PERJ7getbfmg5lqNQ6N6vYumDSE8rupK3MrXH30jPWJ8wcKp/CzuD8vRqm5Apjg9G oiuz8aXIqIC2B7oKHI1CBEWyoZVsJ/Bku0ux0oSp2aXooOPZO0nREGF5vWIZTfRnJQCc 69T/3Uo/fKVGrSwTGF2RlOSU+qcLWIWi9pBzXuYrfvRuHok/PCvC1eIs0l/2yyl3v+7D YSQXSbG0G8q8GjfdBwlJEukmhShiJD08baDLL+/ubPqi1K/InF1Opn3q7/Usv5yeDtVK LtEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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:delivered-to; bh=Njk7ncWt6uT5OP+Q9v5LNrMk36bSzhkSK3H1/Sp5uiA=; b=buPGAGg0f9f+SRYzgZKos1LZ2PdVKS107/XKGx4r7WZcIMYX6eZBG0ie5zkOMo/UAl 1Dnm0yIdgc5xtzxSV/tT8HXUDAy+w7pzKZo52rTRF0OgHSrjwNz/6PJOBi52fGoE2fZz b6ACuAfmj97GoFH1Pj55wMrQki6UoWJLS95iVmR5lDVpcg1hBhSjUw1DWv3bM7bEnm0c 2SRCxX74Uisqwt3SJqeRLzCcF84eZyYOo0sIkANwvP+ADHPStwnxACzWuNm50ggLwDSs zKq/pNuXfD6T+k6ELAUoEb4wtyGJkRTfKF2e12I1vuNJqMGTkth1jbcQuDHkfyXzQfYb JRyw== 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 g11-20020a17090669cb00b0071728eab6a8si552730ejs.124.2022.06.27.13.03.47; Mon, 27 Jun 2022 13:03:48 -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 3A4EC68B8F6; Mon, 27 Jun 2022 23:03:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C1C4968B8F0 for ; Mon, 27 Jun 2022 23:03:42 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 85E4FE74EF; Mon, 27 Jun 2022 22:03:42 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QkYx9yx1Yt4w; Mon, 27 Jun 2022 22:03:14 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 7E9AFE7455; Mon, 27 Jun 2022 22:02:51 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Mon, 27 Jun 2022 22:02:41 +0200 Message-Id: <20220627200241.7102-3-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220627200241.7102-1-cus@passwd.hu> References: <20220627200241.7102-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] avformat/mov: disallow a zero sample size in trun atoms 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 Cc: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: IGvI7VYwGbJ1 In order to not generate 0 sized packets or create a huge index table needlessly. Fixes: Timeout Fixes: 43717/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5206008287330304 Fixes: 45738/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6142535657979904 Signed-off-by: Marton Balint --- libavformat/mov.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index c6fbe511c0..d7ef6ba6d6 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -5179,6 +5179,8 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) distance++; if (av_sat_add64(dts, sample_duration) != dts + (uint64_t)sample_duration) return AVERROR_INVALIDDATA; + if (!sample_size) + return AVERROR_INVALIDDATA; dts += sample_duration; offset += sample_size; sc->data_size += sample_size;