From patchwork Sun Aug 13 18:38:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 4701 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.46.211 with SMTP id u202csp3449696vsu; Sun, 13 Aug 2017 11:46:49 -0700 (PDT) X-Received: by 10.223.157.7 with SMTP id k7mr14005551wre.43.1502650009195; Sun, 13 Aug 2017 11:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502650009; cv=none; d=google.com; s=arc-20160816; b=fY2WdhqsyhlogTRsyBqNtHcjOBuL/eJPA0mCPDcpUqZyqPANNwiRv0u4zSL+bQZ8XX iyzrXEP9F2TplTTwb0lu5hEAbcikQPqdL1d4uinJ2VLgjt2RDlu0n2umaWwj+ZjPXInB MM+0uRJzjgEArQKCi9kl4NYs5MijhmSHM5FKDqeFBUAihN+2Qc9ev4r7Sq3MuOTAYh0f tB8ZHJlj6/Ni5Xe1RxG6f6ukrg5YDP87kLwqkGI/8BYoFZFP4o860fpRsnGHpnfoG/Kr ozXoMGz5MAzm0y621YejgFfw6/R3xXkTqjl5eXQQsFcVA0N1dGiZA4vsuOkbW9Xs9pSO AbMg== 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=znSLpZlQTVSH/AKKFwqLl9yeA3b2cIJAZv4K1eM7+so=; b=FR8mDYBKzsa5g6lU1dtI4/opbIJTpZuXI+kTUHm3PbRcx7ZSlQkbcKTseKwO+EajMH RwoVYHaOzkUuPHVpZePRkmHoQ7ssJfOVMnsptziDoJiSuo0U01GhMOC0jQANeSmQUo8d Ac1GC29QBLz+fWZ0YOrYHgWJtE+qLlVIYL4dzYnFe+X9V0JRmw5RDLTSgKZsuxv9Q0u/ naFYzCNuOubKNMp/PrQyRe3gnchEvCi4UUOieHilaVwVNpJE2ClVqfuxl6N8j5TGWGk2 u44ltgbtyzxiy90VUUShbqYCzzZthWs3aTlXzmywOBBTyW8MslYgMH/hdMDrhWiYmiuN G3xg== 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 w197si2721471wmf.226.2017.08.13.11.46.48; Sun, 13 Aug 2017 11:46:49 -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 A348C689D0F; Sun, 13 Aug 2017 21:46:42 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe01-3.mx.upcmail.net (vie01a-qmta-pe01-3.mx.upcmail.net [62.179.121.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 29E24689CFD for ; Sun, 13 Aug 2017 21:46:36 +0300 (EEST) Received: from [172.31.218.34] (helo=vie01a-dmta-pe02-1.mx.upcmail.net) by vie01a-pqmta-pe01.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1dgxuJ-0006zc-HJ for ffmpeg-devel@ffmpeg.org; Sun, 13 Aug 2017 20:46:39 +0200 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1dgxuE-0008Dk-1r for ffmpeg-devel@ffmpeg.org; Sun, 13 Aug 2017 20:46:34 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id wief1v0150S5wYM01iegMG; Sun, 13 Aug 2017 20:38:41 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 13 Aug 2017 20:38:38 +0200 Message-Id: <20170813183839.18269-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.13.0 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/cavsdec: Check I frame mb decode for errors 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: 2943/clusterfuzz-testcase-5430257156882432 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/cavsdec.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c index 7a5f795dab..02b3d213a9 100644 --- a/libavcodec/cavsdec.c +++ b/libavcodec/cavsdec.c @@ -1070,10 +1070,14 @@ static int decode_pic(AVSContext *h) } else { h->alpha_offset = h->beta_offset = 0; } + + ret = 0; if (h->cur.f->pict_type == AV_PICTURE_TYPE_I) { do { check_for_slice(h); - decode_mb_i(h, 0); + ret = decode_mb_i(h, 0); + if (ret < 0) + break; } while (ff_cavs_next_mb(h)); } else if (h->cur.f->pict_type == AV_PICTURE_TYPE_P) { do { @@ -1109,12 +1113,12 @@ static int decode_pic(AVSContext *h) } while (ff_cavs_next_mb(h)); } emms_c(); - if (h->cur.f->pict_type != AV_PICTURE_TYPE_B) { + if (ret >= 0 && h->cur.f->pict_type != AV_PICTURE_TYPE_B) { av_frame_unref(h->DPB[1].f); FFSWAP(AVSFrame, h->cur, h->DPB[1]); FFSWAP(AVSFrame, h->DPB[0], h->DPB[1]); } - return 0; + return ret; } /*****************************************************************************