From patchwork Tue Apr 17 00:13:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 8469 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.1.85 with SMTP id c82csp1375072jad; Mon, 16 Apr 2018 17:15:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+rvIm7n6fPsqhQnJ2deB8e1inDpu6+0kFO48RXxu+b4Ae8hka6eHQI5ecqiYIZMYGcEVcT X-Received: by 10.28.172.135 with SMTP id v129mr174386wme.144.1523924113873; Mon, 16 Apr 2018 17:15:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523924113; cv=none; d=google.com; s=arc-20160816; b=guFVNI7naVhyddzQNqZfoykxZHmIV9TrwkuyQ7ijr1AYJeSyQO8zstWMBti1v9+s+4 Ya2xgW3mzypCTQX4NTRHzXGxc5LEX/LFhgynAFW6SLblogAv/y+898UvEDv5t4iNRSQ3 ghbnolWQ/UwH/xG0R/KtiwlEp7oSghZCVtzLqxwbB/9BEH6DIe1ioXK41kUCkl2GAFjN 5OtAVcXhnVfkq6lcMytlvYz8b/2B4R50TuKXHhnrshNGkZQe4FrhVWxJZCC7NWLJLhIa /icceAlehBsm32HKWgpcrMWRNE4hg5oNUYlr8Fh1fjDMf083MKtHjVgBrWwiBuhNxQis 19/A== 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:arc-authentication-results; bh=qYRBH0BV0ipiMHy71lCyduProTycj+3PvsY15eOoSpA=; b=JfIv9WPzddFpEonxnwfA2gUPCT4qzs/4CKQo3pZPf21NTD5+jmhP4yHv/ufLI10uwV e2gRfBQJdIQF4DafxdRVG9LCuP9Qejm/AKRQPPxS1Ogz0YQ+o+F3cRUzKk4N2nTxn2Bd D9GNHkAYVYa0OZkNYEE2mZZVIQ8/MAwKOpZGmXn3UjWrLN/k1btSYIjFDHA1FNFh5LJ9 e75gFRE0me9s/9b1KsWDv8uXSRHRmEhpptWzHtgboWuKFxHOog3z/yvNHzsaTP1HyPQh Okp5mL/AoOgEU5VhqV6f8p3kaOZ9lcJKYWMwPf+KNQyY3Js+iJALC6sfq0GELuozOozg MeFQ== 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 77si6943638wmx.81.2018.04.16.17.15.13; Mon, 16 Apr 2018 17:15:13 -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 78EED689E35; Tue, 17 Apr 2018 03:14:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe02-1.mx.upcmail.net (vie01a-qmta-pe02-1.mx.upcmail.net [62.179.121.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3D811680C92 for ; Tue, 17 Apr 2018 03:14:27 +0300 (EEST) Received: from [172.31.218.53] (helo=vie01a-dmta-pe08-2.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1f8EGq-0000Pe-M1 for ffmpeg-devel@ffmpeg.org; Tue, 17 Apr 2018 02:14:52 +0200 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe08.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1f8EGl-0007tP-8a for ffmpeg-devel@ffmpeg.org; Tue, 17 Apr 2018 02:14:47 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id bCEj1x00B0S5wYM01CEkMe; Tue, 17 Apr 2018 02:14:44 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 17 Apr 2018 02:13:44 +0200 Message-Id: <20180417001346.8174-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180417001346.8174-1-michael@niedermayer.cc> References: <20180417001346.8174-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 3/5] avcodec/dfa: Check dimension against maximum X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" The headers from where the dimensions are read in actual files are limited to 16bit per component. Fixes: Timeout Fixes: 6305/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DFA_fuzzer-4824270749302784 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/dfa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c index 536040d65c..970175fb73 100644 --- a/libavcodec/dfa.c +++ b/libavcodec/dfa.c @@ -41,7 +41,7 @@ static av_cold int dfa_decode_init(AVCodecContext *avctx) avctx->pix_fmt = AV_PIX_FMT_PAL8; - if (!avctx->width || !avctx->height) + if (!avctx->width || !avctx->height || FFMAX(avctx->width, avctx->height) >= (1<<16)) return AVERROR_INVALIDDATA; av_assert0(av_image_check_size(avctx->width, avctx->height, 0, avctx) >= 0);