From patchwork Tue Jul 12 18:43:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 36761 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:6da0:b0:8b:e47:9dbf with SMTP id wl32csp2206175pzb; Tue, 12 Jul 2022 11:43:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ugSjBeJa7VfjOANszBxZ+RmYa2D5uD/+9/h7zgBH+xEtvjczq+8Om5IpFZjOK4mm8SAp28 X-Received: by 2002:a17:906:7949:b0:726:40d1:60aa with SMTP id l9-20020a170906794900b0072640d160aamr24648286ejo.511.1657651416054; Tue, 12 Jul 2022 11:43:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657651416; cv=none; d=google.com; s=arc-20160816; b=OeaZNPwq4rZii/cC4VWunNzvHBQKQ3W3HUX6Q0u1VfPJOqtpwQDKulI5mYgs5W3/Cj SMBc+beXdbDKGKRMAFq+76bI6MKXxTkPpGSyhpV5HryXr/jPj89PFXzpt0D00e/e74c0 A0jAhKRNqBazyEb199KZaV27FYiN0rJ3ALKmwI7+pDZrGrYyycD2mqNUfh7Yv+nf4MSi 7iV/bB0cVVVmuuwAk8/f7wZPzgNWiifdh44BOJhmFoF972mnJz6nwGlawXj9LzDgNTLz 3svOKkIXBNIJ6KXXcGQTbOz/UqT5lT/TC0lvrHTcMtmcdAodAhnjA21G9Vev/Ocdogao +Ndg== 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=t317Ft8yFpvKIN1MBT4/U8OMBUhKtYcmVsaE4p3a+wE=; b=ApJCZ17zq/3qknLiW7gEnrMcyT15HKn7cinHEXZh6dM5xMAfBCMfVWjj6IfzZkVe6+ QonmkbGGhpbJXzsNPlDOYYVp5deRc3Lr9NML/2TnkD7sQmX4vqgISz0HVbUsWkYvQFjC I5f2PEfzRhrYjMEEI/8vSwbar9wWICPTC2MTwY2rdMoV2mc6sCaSNTFrGwHNBFy5G+Xh e3P6PcxEraRDEg+pEOUrpLq0Bj5z/HIRiifZAkflYvWbI1rhJPeAgMFGM72xdCL+iMxf QPykWx8uGz/2qLJTKgSSuEv6vBjPp0oOvUXsO47HHQiC90L+X/qyPVSclfmKu3QMW7+H fOOQ== 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 gi21-20020a1709070c9500b00711f646bb8csi12567559ejc.916.2022.07.12.11.43.35; Tue, 12 Jul 2022 11:43:36 -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 CDF7568B987; Tue, 12 Jul 2022 21:43:31 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-at02-1.mx.upcmail.net (vie01a-dmta-at02-1.mx.upcmail.net [62.179.121.148]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6E3B268B7FF for ; Tue, 12 Jul 2022 21:43:24 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-at02.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1oBKqx-0009xc-Te for ffmpeg-devel@ffmpeg.org; Tue, 12 Jul 2022 20:43:23 +0200 Received: from ren-mail-psmtp-mg01. ([80.109.253.241]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id BKpRoRcNV8s8UBKqxoLuVI; Tue, 12 Jul 2022 20:43:23 +0200 Received: from localhost ([213.47.68.29]) by ren-mail-psmtp-mg01. with ESMTP id BKqxoYsajOPqFBKqxoSboY; Tue, 12 Jul 2022 20:43:23 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.4 cv=OcX7sjfY c=1 sm=1 tr=0 ts=62cdc0cb a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=NEAV23lmAAAA:8 a=xu4UWSKegsD0FtjWAGUA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 12 Jul 2022 20:43:22 +0200 Message-Id: <20220712184322.22814-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220712184322.22814-1-michael@niedermayer.cc> References: <20220712184322.22814-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfC9NfDjwmRe0TXAqgUS/iGtIrceZtTBi46rRY84ADCQEJBA40l6pJJPwo/SXepXB9XRRworiIY6vb7TDwF6DJ9wJoIO6FG3CyS9mlbo64oSYL+vGlAM0 hoBtU5P2EEyDsCGIt5hacjaH0bQ4rebuHl2zB4AKKMFyFs/VSqDBM1wSnbZwLJGEji6OMKtBcobjVQ== Subject: [FFmpeg-devel] [PATCH 3/3] avformat/flvdec: Check for EOF in index reading 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: 7vHyuCtqKHoq Fixes: Timeout Fixes: 47992/clusterfuzz-testcase-minimized-ffmpeg_dem_LIVE_FLV_fuzzer-6020443879899136 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/flvdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index c5d3c63bd0..8dba92661b 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -463,6 +463,8 @@ static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, int64_t m goto invalid; if (current_array == × && (d <= INT64_MIN / 1000 || d >= INT64_MAX / 1000)) goto invalid; + if (avio_feof(ioc)) + goto invalid; current_array[0][i] = d; } if (times && filepositions) {