History

avfilter/vf_vif: Fix mismatch in number of array elements

The function definition used float *data_buf[14], although there are only 13 elements (and only 13 are used); the declaration used 13. Given that the type will be converted to float **data_buf anyway, this is not in violation of the C specs, but nevertheless a bug. GCC 11 has a new warning for this -Warray-parameter.

Andreas Rheinhardt committed 5 years ago

Commit 71eb8f81 parent 7dfdc151 file · +6 −4Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_vif.c+6−4
@@ -38,6 +38,8 @@ · 37 unmodified lines
38#include "vif.h"38#include "vif.h"
39#include "video.h"39#include "video.h"
40 40
41#define NUM_DATA_BUFS 13
42
41typedef struct VIFContext {43typedef struct VIFContext {
42 const AVClass *class;44 const AVClass *class;
43 FFFrameSync fs;45 FFFrameSync fs;
@@ -46,7 +48,7 @@ typedef struct VIFContext { · 2 unmodified lines
46 int height;48 int height;
47 int nb_threads;49 int nb_threads;
48 float factor;50 float factor;
49 float *data_buf[13];51 float *data_buf[NUM_DATA_BUFS];
50 float **temp;52 float **temp;
51 float *ref_data;53 float *ref_data;
52 float *main_data;54 float *main_data;
@@ -286,7 +288,7 @@ static int vif_filter1d(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) · 233 unmodified lines
286int ff_compute_vif2(AVFilterContext *ctx,288int ff_compute_vif2(AVFilterContext *ctx,
287 const float *ref, const float *main, int w, int h,289 const float *ref, const float *main, int w, int h,
288 int ref_stride, int main_stride, float *score,290 int ref_stride, int main_stride, float *score,
289 float *data_buf[14], float **temp,291 float *data_buf[NUM_DATA_BUFS], float **temp,
290 int gnb_threads)292 int gnb_threads)
291{293{
292 ThreadData td;294 ThreadData td;
@@ -515,7 +517,7 @@ static int config_input_ref(AVFilterLink *inlink) · 222 unmodified lines
515 s->vif_max[i] = -DBL_MAX;517 s->vif_max[i] = -DBL_MAX;
516 }518 }
517 519
518 for (int i = 0; i < 13; i++) {520 for (int i = 0; i < NUM_DATA_BUFS; i++) {
519 if (!(s->data_buf[i] = av_calloc(s->width, s->height * sizeof(float))))521 if (!(s->data_buf[i] = av_calloc(s->width, s->height * sizeof(float))))
520 return AVERROR(ENOMEM);522 return AVERROR(ENOMEM);
521 }523 }
@@ -608,7 +610,7 @@ static av_cold void uninit(AVFilterContext *ctx) · 86 unmodified lines
608 i, s->vif_sum[i] / s->nb_frames, s->vif_min[i], s->vif_max[i]);610 i, s->vif_sum[i] / s->nb_frames, s->vif_min[i], s->vif_max[i]);
609 }611 }
610 612
611 for (int i = 0; i < 13; i++)613 for (int i = 0; i < NUM_DATA_BUFS; i++)
612 av_freep(&s->data_buf[i]);614 av_freep(&s->data_buf[i]);
613 615
614 av_freep(&s->ref_data);616 av_freep(&s->ref_data);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t