]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/vf_geq: fix multiple assignments of ptr in slice_geq_filter
authorMarton Balint <cus@passwd.hu>
Sat, 28 Dec 2019 14:05:43 +0000 (15:05 +0100)
committerMarton Balint <cus@passwd.hu>
Wed, 29 Jan 2020 18:53:43 +0000 (19:53 +0100)
Fixes Coverity CID 1427183.

Signed-off-by: Marton Balint <cus@passwd.hu>
libavfilter/vf_geq.c

index 2905efae249b56ea2913b161b48dce14bd0d6a49..23c989b2486773edb9a1c11b7c84c137c4e5270f 100644 (file)
@@ -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;
 
     double values[VAR_VARS_NB];
     values[VAR_W] = geq->values[VAR_W];
@@ -387,8 +385,8 @@ static int slice_geq_filter(AVFilterContext *ctx, void *arg, int jobnr, int nb_j
     values[VAR_T] = geq->values[VAR_T];
 
     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++) {
@@ -397,15 +395,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_eval(geq->e[plane], values, geq);
             }
+            ptr16 += linesize/2;
         }
     }