From patchwork Tue Apr 17 00:13:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 8470 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.1.85 with SMTP id c82csp1375183jad; Mon, 16 Apr 2018 17:15:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx49MsPkmGuQg/82mrCbUnT7MwZAIUP9rikidLaWN/mII9YPEHer4o1hjSxHjWzVy4EhytCg1 X-Received: by 10.223.146.103 with SMTP id 94mr5803563wrj.206.1523924122556; Mon, 16 Apr 2018 17:15:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523924122; cv=none; d=google.com; s=arc-20160816; b=OlyY9eTX+ldeXMe4DF4o9vfYWxVF0Z1IRFN7+3wDb9GJVtq1lwJ2C8mMg4zlSXyeVi B/Izw5rfGfzoFg9tIOX3nlr5cyO8iGl1xO5cniZUaOviubeIrJBzD5Z5DD1GIMcDwhIX 1bv5Mj93nvDdVOHYhk1YW5ZuZxqjLGH9MuQjcSt+Ep7bjaQxh1UoLFcAunut4IM2ny6V E1DPmI358nw48L6vFJl/LGse1DATAxGC7L4mm74TNuLqvPwoTRa+9ZqgDhZMt9CfImUv rw94BBWB+P/6tBR12pqyPqXM/G3IjfjgOzL42eHNbcjNdNrmb26wNFCDdC2jH1MY/OJh VF/g== 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=9aUd96mgq1/eHtRfdGeu2vyBYuIbSzfeWch3Rp1OWqg=; b=A+/V3+nS4aNOtRLu3kh/JsAleuU8+Stod6EElswuSG4Sexm9QnAeLsmBYAFPqP5aOJ 6q5B4W+mWhOQW2Me2SBHKx5VS6QObhsKuTrs9Sbiy6FOzu96Yv/tVkuFMdToaGHbGFCy tuCsm7bE4QAbzDWmRuABLOO0mMGk3GKk73ObDkZeqe2XoJlcGopRbGEZ3l+AwbIacZ1k 086rGLIzaW0/3uuJrqXys8k3N+uN5qXioVNWKhHd0L5i0hajRa3wDZvbgkOhCrK/BFx1 0aWIrYymcs3wWywCgwjfs2xujuaVJ3Dr8nCChRvfpSvUCw1v4C4GMY9o6UdgiN6rYenM Swng== 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 v23si3100594wmv.146.2018.04.16.17.15.22; Mon, 16 Apr 2018 17:15:22 -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 0A97A689E69; Tue, 17 Apr 2018 03:14:31 +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 3F470689D80 for ; Tue, 17 Apr 2018 03:14:27 +0300 (EEST) Received: from [172.31.218.45] (helo=vie01a-dmta-pe05-3.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1f8EGq-0000Qs-Qv 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-pe05.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1f8EGl-0007Pd-F7 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 bCEl1x0230S5wYM01CEmMx; Tue, 17 Apr 2018 02:14:46 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 17 Apr 2018 02:13:46 +0200 Message-Id: <20180417001346.8174-5-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 5/5] avcodec/dsicinvideo: Fail if there is only a small fraction of the data available that comprises a full frame 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" Fixes: Timeout Fixes: 6306/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DSICINVIDEO_fuzzer-5079253549842432 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/dsicinvideo.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavcodec/dsicinvideo.c b/libavcodec/dsicinvideo.c index add7afa383..aa080417d2 100644 --- a/libavcodec/dsicinvideo.c +++ b/libavcodec/dsicinvideo.c @@ -158,6 +158,9 @@ static int cin_decode_lzss(const unsigned char *src, int src_size, } } + if (dst_end - dst > dst_size - dst_size/10) + return AVERROR_INVALIDDATA; + return 0; } @@ -184,6 +187,10 @@ static int cin_decode_rle(const unsigned char *src, int src_size, } dst += len; } + + if (dst_end - dst > dst_size - dst_size/10) + return AVERROR_INVALIDDATA; + return 0; }