History

src_buffer: propagate errors from copy_buffer_ref()

Fixes a null ptr deref

Michael Niedermayer committed 14 years ago

Commit ac87c271 parent 3c001321 file · +6 −0Browse files

Unified · Split

libavfilter/src_buffer.c+6−0
@@ -270,6 +270,8 @@ static AVFilterBufferRef *copy_buffer_ref(AVFilterContext *ctx, · 269 unmodified lines
270270 case AVMEDIA_TYPE_VIDEO:
271271 buf = avfilter_get_video_buffer(outlink, AV_PERM_WRITE,
272272 ref->video->w, ref->video->h);
273+ if(!buf)
274+ return NULL;
273275 av_image_copy(buf->data, buf->linesize,
274276 (void*)ref->data, ref->linesize,
275277 ref->format, ref->video->w, ref->video->h);
@@ -278,6 +280,8 @@ static AVFilterBufferRef *copy_buffer_ref(AVFilterContext *ctx, · 2 unmodified lines
278280 case AVMEDIA_TYPE_AUDIO:
279281 buf = ff_get_audio_buffer(outlink, AV_PERM_WRITE,
280282 ref->audio->nb_samples);
283+ if(!buf)
284+ return NULL;
281285 channels = av_get_channel_layout_nb_channels(ref->audio->channel_layout);
282286 av_samples_copy(buf->extended_data, ref->buf->extended_data,
283287 0, 0, ref->audio->nb_samples,
@@ -319,6 +323,8 @@ int av_buffersrc_add_ref(AVFilterContext *buffer_filter, · 35 unmodified lines
319323 buf = picref;
320324 else
321325 buf = copy_buffer_ref(buffer_filter, picref);
326+ if(!buf)
327+ return -1;
322328
323329 if ((ret = av_fifo_generic_write(c->fifo, &buf, sizeof(buf), NULL)) < 0) {
324330 if (buf != picref)

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