diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-05-17 06:46:27 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-05-17 06:48:05 +0400 |
commit | ac87c273a646eb8feba8e47f15da4934d119f650 (patch) | |
tree | 502b8a1d4f04473772714333e1c63df43d85a09d /libavfilter/src_buffer.c | |
parent | 3c0013213e348541195a0c5e2ce43fc0cf6812ac (diff) |
src_buffer: propagate errors from copy_buffer_ref()
Fixes a null ptr deref
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/src_buffer.c')
-rw-r--r-- | libavfilter/src_buffer.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavfilter/src_buffer.c b/libavfilter/src_buffer.c index b249a8368f..5bf629ce6b 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) |