From patchwork Wed Nov 15 16:29:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 6099 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp4775931jah; Wed, 15 Nov 2017 08:29:38 -0800 (PST) X-Google-Smtp-Source: AGs4zMagjMLRi8NF+nR8uQMA05xpUqSMtLmg+ix4FP4uTwYas10oWvJ2PrdIA8xFmLHTeFMrgIax X-Received: by 10.223.135.243 with SMTP id c48mr12102331wrc.140.1510763377986; Wed, 15 Nov 2017 08:29:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510763377; cv=none; d=google.com; s=arc-20160816; b=dKOaiCL+Lcwp7mfxmfeJsxKG17FWsxKviW8p0Y2hHi2Eo6+c2A1zwMsfk1fa0ZGx/L 9Jk7/6E8iA8ziIZzD1NQBzBfgTXSCzDJI6q4u+RIlQqGRvucUL0qvPERwQURBLdwZosw pbbFepugDUn5M/IunNOKqzXMG+ZTwCAca1crTGhuqqwrlTFzsRYdUVGLHbqQo1dqTHn0 1uanPGseHk+FfkhLhLWXzZyDhxRI5rC9MhNCSs/1i9zKzQpoOziWaDAXDYX5zbSmgoCT jjEhjHs2rWjdrAqoS1uekNUQFnlPZgoGOj3LorbXn5/75oj0s44QgtMZfgmZlnZcvyTQ sAjg== 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:message-id:date:to:from:delivered-to :arc-authentication-results; bh=1Liz5sAIUREyrvG1IbS0sIAmv0i8ats01TXTk5oRRZU=; b=EJ0yx0nqx83mikqE6Q6WVAb0p4kPKBTFKevg0bizwSKpSlA0UJnZOJIW+wnubbm+i6 hPivoL6p4BZHx8tfmifK6AauBh8SwiHjc86fZ9xNzsYcA/XZ8CmgNJrY7A2ENou+cgQy q0pdIglCcaJDl9IXxSBFpT7DD2mNHPYnp0ZkoInqGqjyqJVw1XGNmwGSDsMkxXfp85tZ O2HEGwKoUjQ8oV6VqwvBila4fFENurfD6iufSW3pD84XBHBGtO9ZZ2l/fa4qGGLjbua6 i1o+Y6CdCVRX0sWRGEny/5ikZduDdFryplF/5+6/EOj1vPaa8nMKa+EObewTExgXRF7T /RCA== 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 89si17452305wra.274.2017.11.15.08.29.37; Wed, 15 Nov 2017 08:29:37 -0800 (PST) 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 F1D7768A0B7; Wed, 15 Nov 2017 18:29:20 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe08-1.mx.upcmail.net (vie01a-dmta-pe08-1.mx.upcmail.net [84.116.36.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C2A4C68A08E for ; Wed, 15 Nov 2017 18:29:14 +0200 (EET) 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 1eF0Z7-0004sw-P3 for ffmpeg-devel@ffmpeg.org; Wed, 15 Nov 2017 17:29:29 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id aGVQ1w01r0S5wYM01GVRKv; Wed, 15 Nov 2017 17:29:25 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 15 Nov 2017 17:29:24 +0100 Message-Id: <20171115162924.18146-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.15.0 Subject: [FFmpeg-devel] [PATCH] avcodec/zmbv: Check that the buffer is large enough for mvec 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: 4143/clusterfuzz-testcase-4736864637419520 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/zmbv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c index b09dc41ebd..f91d2e3931 100644 --- a/libavcodec/zmbv.c +++ b/libavcodec/zmbv.c @@ -539,6 +539,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac } else { frame->key_frame = 0; frame->pict_type = AV_PICTURE_TYPE_P; + if (c->decomp_len < 2LL * ((c->width + c->bw - 1) / c->bw) * ((c->height + c->bh - 1) / c->bh)) + return AVERROR_INVALIDDATA; if (c->decomp_len) c->decode_xor(c); }