From patchwork Thu Mar 30 20:12:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 3201 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.44.195 with SMTP id s186csp1723107vss; Thu, 30 Mar 2017 13:12:43 -0700 (PDT) X-Received: by 10.223.178.182 with SMTP id g51mr1363429wrd.12.1490904763153; Thu, 30 Mar 2017 13:12:43 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 136si228109wmw.28.2017.03.30.13.12.42; Thu, 30 Mar 2017 13:12:43 -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 CDA476898B0; Thu, 30 Mar 2017 23:12:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe03-3.mx.upcmail.net (vie01a-dmta-pe03-3.mx.upcmail.net [62.179.121.162]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6D5B46897ED for ; Thu, 30 Mar 2017 23:12:24 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1ctgQi-0006tm-BU for ffmpeg-devel@ffmpeg.org; Thu, 30 Mar 2017 22:12:24 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 2LCE1v00h0S5wYM01LCFg2; Thu, 30 Mar 2017 22:12:15 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 30 Mar 2017 22:12:12 +0200 Message-Id: <20170330201213.15861-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.11.0 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/clearvideo: Do not loose the return code of decode_mb() 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 CID1401671 Signed-off-by: Michael Niedermayer --- libavcodec/clearvideo.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c index e2644e3090..437c459aa5 100644 --- a/libavcodec/clearvideo.c +++ b/libavcodec/clearvideo.c @@ -281,6 +281,7 @@ static int clv_decode_frame(AVCodecContext *avctx, void *data, uint32_t frame_type; int i, j; int ret; + int mb_ret = 0; bytestream2_init(&gb, buf, buf_size); if (avctx->codec_tag == MKTAG('C','L','V','1')) { @@ -312,7 +313,9 @@ static int clv_decode_frame(AVCodecContext *avctx, void *data, for (j = 0; j < c->mb_height; j++) { for (i = 0; i < c->mb_width; i++) { - ret |= decode_mb(c, i, j); + ret = decode_mb(c, i, j); + if (ret < 0) + mb_ret = ret; } } } else { @@ -323,7 +326,7 @@ static int clv_decode_frame(AVCodecContext *avctx, void *data, *got_frame = 1; - return ret < 0 ? ret : buf_size; + return mb_ret < 0 ? mb_ret : buf_size; } static av_cold int clv_decode_init(AVCodecContext *avctx)