Browse code

avfilter/vf_detelecine: Fix uninitialized array index error

Fixes the defect CID 1292301

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Himangi Saraogi authored on 2015/03/31 16:13:46
Showing 1 changed files
... ...
@@ -265,12 +265,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
265 265
                 out = 1;
266 266
             } else if (len == 1) {
267 267
                 // fill in the EARLIER field from the new pic
268
-                av_image_copy_plane(s->frame->data[i] + s->frame->linesize[i] * s->first_field,
269
-                                    s->frame->linesize[i] * 2,
270
-                                    inpicref->data[i] + inpicref->linesize[i] * s->first_field,
271
-                                    inpicref->linesize[i] * 2,
272
-                                    s->stride[i],
273
-                                    (s->planeheight[i] - s->first_field + 1) / 2);
268
+                for (i = 0; i < s->nb_planes; i++) {
269
+                    av_image_copy_plane(s->frame->data[i] +
270
+                                        s->frame->linesize[i] * s->first_field,
271
+                                        s->frame->linesize[i] * 2,
272
+                                        inpicref->data[i] +
273
+                                        inpicref->linesize[i] * s->first_field,
274
+                                        inpicref->linesize[i] * 2, s->stride[i],
275
+                                        (s->planeheight[i] - s->first_field + 1) / 2);
276
+                 }
277
+
274 278
                 // TODO: not sure about the other field
275 279
 
276 280
                 len--;