[FFmpeg-cvslog] src_buffer: propagate errors from copy_buffer_ref()

Michael Niedermayer git at videolan.org
Thu May 17 04:50:48 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu May 17 04:46:27 2012 +0200| [ac87c273a646eb8feba8e47f15da4934d119f650] | committer: Michael Niedermayer

src_buffer: propagate errors from copy_buffer_ref()

Fixes a null ptr deref

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

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ac87c273a646eb8feba8e47f15da4934d119f650
---

 libavfilter/src_buffer.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavfilter/src_buffer.c b/libavfilter/src_buffer.c
index b249a83..5bf629c 100644
--- a/libavfilter/src_buffer.c
+++ b/libavfilter/src_buffer.c
@@ -270,6 +270,8 @@ static AVFilterBufferRef *copy_buffer_ref(AVFilterContext *ctx,
     case AVMEDIA_TYPE_VIDEO:
         buf = avfilter_get_video_buffer(outlink, AV_PERM_WRITE,
                                         ref->video->w, ref->video->h);
+        if(!buf)
+            return NULL;
         av_image_copy(buf->data, buf->linesize,
                       (void*)ref->data, ref->linesize,
                       ref->format, ref->video->w, ref->video->h);
@@ -278,6 +280,8 @@ static AVFilterBufferRef *copy_buffer_ref(AVFilterContext *ctx,
     case AVMEDIA_TYPE_AUDIO:
         buf = ff_get_audio_buffer(outlink, AV_PERM_WRITE,
                                         ref->audio->nb_samples);
+        if(!buf)
+            return NULL;
         channels = av_get_channel_layout_nb_channels(ref->audio->channel_layout);
         av_samples_copy(buf->extended_data, ref->buf->extended_data,
                         0, 0, ref->audio->nb_samples,
@@ -319,6 +323,8 @@ int av_buffersrc_add_ref(AVFilterContext *buffer_filter,
         buf = picref;
     else
         buf = copy_buffer_ref(buffer_filter, picref);
+    if(!buf)
+        return -1;
 
     if ((ret = av_fifo_generic_write(c->fifo, &buf, sizeof(buf), NULL)) < 0) {
         if (buf != picref)



More information about the ffmpeg-cvslog mailing list