From patchwork Sun Aug 26 02:20:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 10142 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:12c4:0:0:0:0:0 with SMTP id 65-v6csp5001450jap; Sat, 25 Aug 2018 19:20:33 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda54J5QG0LDtN2ixerNg0YEIc7Ry5mp0TJuZSKKFl2tY1BEKxAA2uw1vDoJOxKnhbhs0ah/ X-Received: by 2002:a5d:550a:: with SMTP id b10-v6mr5159706wrv.228.1535250033383; Sat, 25 Aug 2018 19:20:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535250033; cv=none; d=google.com; s=arc-20160816; b=GC1vf6ROtArvBH0LoqsuDzY0Vh1sGFomCODZa3q27EcV/poJ5bYiB5XElZfOT2ukpH ZeVzSS+1YB64Kib3JfDVHgyX0A4SkPC+X94wCCRubcON3OfyBfMPlMNli+RhfULaKdfS uaVo5Qku45fDofknZHg/ldrFuV5b2H3Huyj5VAoh334He8a5UsuLisxeuut18oI87pes W+QdMDT5DRns7pFdTPol7WCrAG+1S/5qmHlmukhhM6C0JGrW93kq8q+y/t55bAQ4zbk5 WAKrxiwydHRop9eSxrLCUZvemIFmYb7mdrUt6uzFb1RneR1byrO3yFvIogpGFhk/Eb5M yYgQ== 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=mmROyO/qhCPUnLCjV77/7P93c3PEjrfIfn8oDxTyuT8=; b=yOPBpG+6nmXLRottOJiESSqhX4xyRfcrm/SZATT1hNNPmnib66qmXS5j9TQtWfCeY8 hOom9e2IT0RiSGjGlwdZdOg5gBOn6qZwADU8MvNu1r+ePReHP9jB/D0z5tvaqTH0zKYs xtK17ojIbfNOdjoLLrBNLf4sA/3eBAPQskg2DbusoO+zcdjnair7ne6obdjJ0m2lonUb SM+U2UCRl31p4suvvEwxcmLyeTAlJDv0rJa1KKKNDiJaZG/bQEHgFSCayfE83JwWn/ET BAUodpFwtYuPYKniFTHqhkDLksCwoz5tJFi7MqDNzS2eWxRHmPTwpyv72ZXPShHwzdq/ KHAQ== 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 b193-v6si4091901wmf.137.2018.08.25.19.20.32; Sat, 25 Aug 2018 19:20:33 -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 EE9D1689A42; Sun, 26 Aug 2018 05:20:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe02-2.mx.upcmail.net (vie01a-qmta-pe02-2.mx.upcmail.net [62.179.121.182]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5B839680480 for ; Sun, 26 Aug 2018 05:20:22 +0300 (EEST) Received: from [172.31.218.54] (helo=vie01a-dmta-pe08-3.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1ftkfA-0005Rg-M9 for ffmpeg-devel@ffmpeg.org; Sun, 26 Aug 2018 04:20:24 +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 1ftkf3-000889-RG for ffmpeg-devel@ffmpeg.org; Sun, 26 Aug 2018 04:20:17 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id TeLF1y00H0S5wYM01eLGnt; Sun, 26 Aug 2018 04:20:16 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 26 Aug 2018 04:20:01 +0200 Message-Id: <20180826022002.7878-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.18.0 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/indeo4: Check dimensions in decode_pic_hdr() 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: 9654/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO4_fuzzer-6289863463665664 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/indeo4.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavcodec/indeo4.c b/libavcodec/indeo4.c index 15ad6f8afc..4bfc6cdd74 100644 --- a/libavcodec/indeo4.c +++ b/libavcodec/indeo4.c @@ -30,6 +30,7 @@ #define BITSTREAM_READER_LE #include "avcodec.h" #include "get_bits.h" +#include "libavutil/imgutils.h" #include "indeo4data.h" #include "internal.h" #include "ivi.h" @@ -178,6 +179,13 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx) pic_conf.chroma_bands = 0; if (pic_conf.luma_bands) pic_conf.chroma_bands = decode_plane_subdivision(&ctx->gb); + + if (av_image_check_size2(pic_conf.pic_width, pic_conf.pic_height, avctx->max_pixels, AV_PIX_FMT_YUV410P, 0, avctx) < 0) { + av_log(avctx, AV_LOG_ERROR, "picture dimensions %d %d cannot be decoded\n", + pic_conf.pic_width, pic_conf.pic_height); + return AVERROR_INVALIDDATA; + } + ctx->is_scalable = pic_conf.luma_bands != 1 || pic_conf.chroma_bands != 1; if (ctx->is_scalable && (pic_conf.luma_bands != 4 || pic_conf.chroma_bands != 1)) { av_log(avctx, AV_LOG_ERROR, "Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d\n",