From patchwork Sat Dec 28 14:46:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 17025 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 4774944AF3C for ; Sat, 28 Dec 2019 16:47:04 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3213668AC62; Sat, 28 Dec 2019 16:47:04 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7412E68AC3B for ; Sat, 28 Dec 2019 16:46:58 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 485BAE3E8F; Sat, 28 Dec 2019 15:46:58 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Fzb87S3j0j7N; Sat, 28 Dec 2019 15:46:55 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 607FFE3EA9; Sat, 28 Dec 2019 15:46:55 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sat, 28 Dec 2019 15:46:25 +0100 Message-Id: <20191228144625.28804-3-cus@passwd.hu> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20191228144625.28804-1-cus@passwd.hu> References: <20191228144625.28804-1-cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH 3/3] avfilter/vf_geq: fix multiple assignments of ptr in slice_geq_filter 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 Cc: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes Coverity CID 1427183. Signed-off-by: Marton Balint --- libavfilter/vf_geq.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libavfilter/vf_geq.c b/libavfilter/vf_geq.c index 417b92222d..00f02b6ebf 100644 --- a/libavfilter/vf_geq.c +++ b/libavfilter/vf_geq.c @@ -375,8 +375,6 @@ static int slice_geq_filter(AVFilterContext *ctx, void *arg, int jobnr, int nb_j const int slice_start = (height * jobnr) / nb_jobs; const int slice_end = (height * (jobnr+1)) / nb_jobs; int x, y; - uint8_t *ptr; - uint16_t *ptr16; AVExprState *state = av_expr_state_alloc(); double values[VAR_VARS_NB]; @@ -391,8 +389,8 @@ static int slice_geq_filter(AVFilterContext *ctx, void *arg, int jobnr, int nb_j return AVERROR(ENOMEM); if (geq->bps == 8) { + uint8_t *ptr = geq->dst + linesize * slice_start; for (y = slice_start; y < slice_end; y++) { - ptr = geq->dst + linesize * y; values[VAR_Y] = y; for (x = 0; x < width; x++) { @@ -401,15 +399,15 @@ static int slice_geq_filter(AVFilterContext *ctx, void *arg, int jobnr, int nb_j } ptr += linesize; } - } - else { + } else { + uint16_t *ptr16 = geq->dst16 + (linesize/2) * slice_start; for (y = slice_start; y < slice_end; y++) { - ptr16 = geq->dst16 + (linesize/2) * y; values[VAR_Y] = y; for (x = 0; x < width; x++) { values[VAR_X] = x; ptr16[x] = av_expr_eval2(geq->e[plane], state, values, geq); } + ptr16 += linesize/2; } } av_expr_state_free(&state);