From patchwork Mon Aug 12 19:17:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 14444 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 2ED15449C0F for ; Mon, 12 Aug 2019 22:19:02 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1683268A7D8; Mon, 12 Aug 2019 22:19:02 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe05-1.mx.upcmail.net (vie01a-dmta-pe05-1.mx.upcmail.net [84.116.36.11]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B19D568A0FA for ; Mon, 12 Aug 2019 22:18:54 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe05.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1hxFqI-0005lt-26 for ffmpeg-devel@ffmpeg.org; Mon, 12 Aug 2019 21:18:54 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id xFpJh83C0wlysxFpJhCBub; Mon, 12 Aug 2019 21:17:54 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.41.20 X-CNFS-Analysis: v=2.3 cv=E5OzWpVl c=1 sm=1 tr=0 a=I1eytVlZLDX1BM2VTtTtSw==:117 a=I1eytVlZLDX1BM2VTtTtSw==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=nZOtpAppAAAA:20 a=Hs7Dfz7Sze0HmvoSQGoA:9 a=Yki5XwySsS95PlGS:21 a=Y4Sb5-4HzUwc09cy:21 a=1fhp2MxaeJtTNGEnv6mo:22 a=Z5ABNNGmrOfJ6cZ5bIyy:22 a=bWyr8ysk75zN3GCy5bjg:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 12 Aug 2019 21:17:01 +0200 Message-Id: <20190812191708.22608-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 X-CMAE-Envelope: MS4wfLYFkCxiRMw302eJTM7JjFFTXpWXif4TY/vS8oRatw3VhAQrHkXxbkCxo+OpeN4vWp3us/ztKWEqTKSBn4ADakD7p8JrUJ64Fr6dkoGFbasFNadaciiU xW3zRhobwg6gNXagQhbDxbafpAHlZXZlUhUYxzTCBIFOqP2e+OyVU0Hp Subject: [FFmpeg-devel] [PATCH 1/8] avcodec/cinepak: Require 1 bit per 4x4 block as minimum input 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes: Timeout (12sec -> 32ms) Fixes: 16078/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CINEPAK_fuzzer-5695832885559296 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/cinepak.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c index aeb15de0ed..62eb794332 100644 --- a/libavcodec/cinepak.c +++ b/libavcodec/cinepak.c @@ -356,6 +356,9 @@ static int cinepak_predecode_check (CinepakContext *s) if (s->size < 10 + s->sega_film_skip_bytes + num_strips * 12) return AVERROR_INVALIDDATA; + if (s->size < (s->avctx->width * s->avctx->height) / (4*4*8)) + return AVERROR_INVALIDDATA; + if (num_strips) { const uint8_t *data = s->data + 10 + s->sega_film_skip_bytes; int strip_size = AV_RB24 (data + 1);