Fixes a null ptr deref
Unified · Split
| @@ -270,6 +270,8 @@ static AVFilterBufferRef *copy_buffer_ref(AVFilterContext *ctx, · 269 unmodified lines | |||
| 270 | case AVMEDIA_TYPE_VIDEO: | 270 | case AVMEDIA_TYPE_VIDEO: |
| 271 | buf = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, | 271 | buf = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, |
| 272 | ref->video->w, ref->video->h); | 272 | ref->video->w, ref->video->h); |
| 273 | if(!buf) | ||
| 274 | return NULL; | ||
| 273 | av_image_copy(buf->data, buf->linesize, | 275 | av_image_copy(buf->data, buf->linesize, |
| 274 | (void*)ref->data, ref->linesize, | 276 | (void*)ref->data, ref->linesize, |
| 275 | ref->format, ref->video->w, ref->video->h); | 277 | ref->format, ref->video->w, ref->video->h); |
| @@ -278,6 +280,8 @@ static AVFilterBufferRef *copy_buffer_ref(AVFilterContext *ctx, · 2 unmodified lines | |||
| 278 | case AVMEDIA_TYPE_AUDIO: | 280 | case AVMEDIA_TYPE_AUDIO: |
| 279 | buf = ff_get_audio_buffer(outlink, AV_PERM_WRITE, | 281 | buf = ff_get_audio_buffer(outlink, AV_PERM_WRITE, |
| 280 | ref->audio->nb_samples); | 282 | ref->audio->nb_samples); |
| 283 | if(!buf) | ||
| 284 | return NULL; | ||
| 281 | channels = av_get_channel_layout_nb_channels(ref->audio->channel_layout); | 285 | channels = av_get_channel_layout_nb_channels(ref->audio->channel_layout); |
| 282 | av_samples_copy(buf->extended_data, ref->buf->extended_data, | 286 | av_samples_copy(buf->extended_data, ref->buf->extended_data, |
| 283 | 0, 0, ref->audio->nb_samples, | 287 | 0, 0, ref->audio->nb_samples, |
| @@ -319,6 +323,8 @@ int av_buffersrc_add_ref(AVFilterContext *buffer_filter, · 35 unmodified lines | |||
| 319 | buf = picref; | 323 | buf = picref; |
| 320 | else | 324 | else |
| 321 | buf = copy_buffer_ref(buffer_filter, picref); | 325 | buf = copy_buffer_ref(buffer_filter, picref); |
| 326 | if(!buf) | ||
| 327 | return -1; | ||
| 322 | 328 | ||
| 323 | if ((ret = av_fifo_generic_write(c->fifo, &buf, sizeof(buf), NULL)) < 0) { | 329 | if ((ret = av_fifo_generic_write(c->fifo, &buf, sizeof(buf), NULL)) < 0) { |
| 324 | if (buf != picref) | 330 | if (buf != picref) |