]> git.sesse.net Git - ffmpeg/commitdiff
lavfi: check all ff_get_video_buffer() calls for errors.
authorAnton Khirnov <anton@khirnov.net>
Sun, 15 Jul 2012 09:16:53 +0000 (11:16 +0200)
committerAnton Khirnov <anton@khirnov.net>
Sun, 22 Jul 2012 07:14:05 +0000 (09:14 +0200)
libavfilter/buffersrc.c
libavfilter/vf_frei0r.c
libavfilter/vf_pad.c
libavfilter/vf_vflip.c
libavfilter/vf_yadif.c
libavfilter/vsrc_color.c
libavfilter/vsrc_testsrc.c

index 16a38a655e9be03b5c4916ed8f7e90a275fa41b2..c0cc3a3ffff14c897732076083c6b5b8ba886100 100644 (file)
@@ -92,6 +92,9 @@ int av_buffersrc_write_frame(AVFilterContext *buffer_filter, AVFrame *frame)
                                  frame->format);
         buf = ff_get_video_buffer(buffer_filter->outputs[0], AV_PERM_WRITE,
                                   c->w, c->h);
+        if (!buf)
+            return AVERROR(ENOMEM);
+
         av_image_copy(buf->data, buf->linesize, frame->data, frame->linesize,
                       c->pix_fmt, c->w, c->h);
         break;
index 152795f5b64feb81fb13fca5ebbd04de9d1f88fa..606c5e2d327eed21d3c6c967badcf0570cb6edf3 100644 (file)
@@ -441,6 +441,9 @@ static int source_request_frame(AVFilterLink *outlink)
     AVFilterBufferRef *buf_out;
     int ret;
 
+    if (!picref)
+        return AVERROR(ENOMEM);
+
     picref->video->pixel_aspect = (AVRational) {1, 1};
     picref->pts = frei0r->pts++;
     picref->pos = -1;
index 262a41648830c2f59113abc64a076c80570f8665..ed2e2e0891ec28183d3d8e3d6749670485e8bc0a 100644 (file)
@@ -262,6 +262,9 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *inlink, int perms, int
                                                     h + (pad->h - pad->in_h));
     int plane;
 
+    if (!picref)
+        return NULL;
+
     picref->video->w = w;
     picref->video->h = h;
 
index b3143229b1e25e5dd04a2077a1c9e31ec1aaff9a..f0fb32aadcf57f9e17da3df3390cf06ff0b5c852 100644 (file)
@@ -52,6 +52,9 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms,
         return ff_default_get_video_buffer(link, perms, w, h);
 
     picref = ff_get_video_buffer(link->dst->outputs[0], perms, w, h);
+    if (!picref)
+        return NULL;
+
     for (i = 0; i < 4; i ++) {
         int vsub = i == 1 || i == 2 ? flip->vsub : 0;
 
index db4956c2ccf7dd9cb3e9eeb651934d47f1ee8d06..c6d78a5ae9a4663a7c21f7a41b846f128d3b107b 100644 (file)
@@ -173,6 +173,9 @@ static int return_frame(AVFilterContext *ctx, int is_second)
     if (is_second) {
         yadif->out = ff_get_video_buffer(link, AV_PERM_WRITE | AV_PERM_PRESERVE |
                                          AV_PERM_REUSE, link->w, link->h);
+        if (!yadif->out)
+            return AVERROR(ENOMEM);
+
         avfilter_copy_buffer_ref_props(yadif->out, yadif->cur);
         yadif->out->video->interlaced = 0;
     }
@@ -239,6 +242,8 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
 
     yadif->out = ff_get_video_buffer(ctx->outputs[0], AV_PERM_WRITE | AV_PERM_PRESERVE |
                                      AV_PERM_REUSE, link->w, link->h);
+    if (!yadif->out)
+        return AVERROR(ENOMEM);
 
     avfilter_copy_buffer_ref_props(yadif->out, yadif->cur);
     yadif->out->video->interlaced = 0;
index 0fa6853189410da746c5c77f64640b865d1d920e..ec83f03c5cf15fcca297c2ce0e89b3c5e9e4e61c 100644 (file)
@@ -145,6 +145,9 @@ static int color_request_frame(AVFilterLink *link)
     AVFilterBufferRef *buf_out;
     int ret;
 
+    if (!picref)
+        return AVERROR(ENOMEM);
+
     picref->video->pixel_aspect = (AVRational) {1, 1};
     picref->pts                 = color->pts++;
     picref->pos                 = -1;
index 22528b4650d53c4274a257ef23a4d433ef074d3a..42cd58ed895ea28cd5d5defb99443232d5c46ac8 100644 (file)
@@ -135,6 +135,9 @@ static int request_frame(AVFilterLink *outlink)
     if (test->max_pts >= 0 && test->pts > test->max_pts)
         return AVERROR_EOF;
     picref = ff_get_video_buffer(outlink, AV_PERM_WRITE, test->w, test->h);
+    if (!picref)
+        return AVERROR(ENOMEM);
+
     picref->pts = test->pts++;
     picref->pos = -1;
     picref->video->key_frame = 1;