diff mbox

[FFmpeg-devel,3/3] avfilter/vf_geq: fix multiple assignments of ptr in slice_geq_filter

Message ID 20191228144625.28804-3-cus@passwd.hu
State Accepted
Headers show

Commit Message

Marton Balint Dec. 28, 2019, 2:46 p.m. UTC
Fixes Coverity CID 1427183.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavfilter/vf_geq.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Michael Niedermayer Dec. 29, 2019, 3:18 p.m. UTC | #1
On Sat, Dec 28, 2019 at 03:46:25PM +0100, Marton Balint wrote:
> Fixes Coverity CID 1427183.
> 
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>  libavfilter/vf_geq.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)

LGTM

thx

[...]
Marton Balint Jan. 29, 2020, 7:20 p.m. UTC | #2
On Sun, 29 Dec 2019, Michael Niedermayer wrote:

> On Sat, Dec 28, 2019 at 03:46:25PM +0100, Marton Balint wrote:
>> Fixes Coverity CID 1427183.
>>
>> Signed-off-by: Marton Balint <cus@passwd.hu>
>> ---
>>  libavfilter/vf_geq.c | 10 ++++------
>>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> LGTM
>

I forgot about this, now pushed.

Thanks,
Marton
diff mbox

Patch

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);