diff options
author | Paul B Mahol <onemda@gmail.com> | 2013-04-08 18:48:16 +0000 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2013-04-08 19:24:09 +0000 |
commit | ed8373e7db14e608641f4db4f2dc3047048013f3 (patch) | |
tree | e2e967e830c06bec013599a55f5aa4f14f3082a4 /libavfilter | |
parent | e82f562fa5ef7de4764ccd699c1fc8430454f17a (diff) | |
download | ffmpeg-streaming-ed8373e7db14e608641f4db4f2dc3047048013f3.zip ffmpeg-streaming-ed8373e7db14e608641f4db4f2dc3047048013f3.tar.gz |
lavfi: always check return value of ff_get_{audio,video}_buffer()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/af_aconvert.c | 2 | ||||
-rw-r--r-- | libavfilter/af_amerge.c | 2 | ||||
-rw-r--r-- | libavfilter/af_asetnsamples.c | 3 | ||||
-rw-r--r-- | libavfilter/af_atempo.c | 4 | ||||
-rw-r--r-- | libavfilter/af_pan.c | 2 | ||||
-rw-r--r-- | libavfilter/asrc_aevalsrc.c | 2 | ||||
-rw-r--r-- | libavfilter/vf_tinterlace.c | 2 | ||||
-rw-r--r-- | libavfilter/vsrc_cellauto.c | 2 | ||||
-rw-r--r-- | libavfilter/vsrc_life.c | 2 | ||||
-rw-r--r-- | libavfilter/vsrc_mandelbrot.c | 3 | ||||
-rw-r--r-- | libavfilter/vsrc_mptestsrc.c | 2 |
11 files changed, 25 insertions, 1 deletions
diff --git a/libavfilter/af_aconvert.c b/libavfilter/af_aconvert.c index c05e571..1fc06f2 100644 --- a/libavfilter/af_aconvert.c +++ b/libavfilter/af_aconvert.c @@ -143,6 +143,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamplesref) AVFrame *outsamplesref = ff_get_audio_buffer(outlink, n); int ret; + if (!outsamplesref) + return AVERROR(ENOMEM); swr_convert(aconvert->swr, outsamplesref->extended_data, n, (void *)insamplesref->extended_data, n); diff --git a/libavfilter/af_amerge.c b/libavfilter/af_amerge.c index 6e83aeb..e9a7fc9 100644 --- a/libavfilter/af_amerge.c +++ b/libavfilter/af_amerge.c @@ -248,6 +248,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) return 0; outbuf = ff_get_audio_buffer(ctx->outputs[0], nb_samples); + if (!outbuf) + return AVERROR(ENOMEM); outs = outbuf->data[0]; for (i = 0; i < am->nb_inputs; i++) { inbuf[i] = ff_bufqueue_peek(&am->in[i].queue, 0); diff --git a/libavfilter/af_asetnsamples.c b/libavfilter/af_asetnsamples.c index 9a10baa..6ecf5cb 100644 --- a/libavfilter/af_asetnsamples.c +++ b/libavfilter/af_asetnsamples.c @@ -108,7 +108,8 @@ static int push_samples(AVFilterLink *outlink) return 0; outsamples = ff_get_audio_buffer(outlink, nb_out_samples); - av_assert0(outsamples); + if (!outsamples) + return AVERROR(ENOMEM); av_audio_fifo_read(asns->fifo, (void **)outsamples->extended_data, nb_out_samples); diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c index af49b0b..6fe8b2c 100644 --- a/libavfilter/af_atempo.c +++ b/libavfilter/af_atempo.c @@ -1062,6 +1062,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *src_buffer) while (src < src_end) { if (!atempo->dst_buffer) { atempo->dst_buffer = ff_get_audio_buffer(outlink, n_out); + if (!atempo->dst_buffer) + return AVERROR(ENOMEM); av_frame_copy_props(atempo->dst_buffer, src_buffer); atempo->dst = atempo->dst_buffer->data[0]; @@ -1100,6 +1102,8 @@ static int request_frame(AVFilterLink *outlink) while (err == AVERROR(EAGAIN)) { if (!atempo->dst_buffer) { atempo->dst_buffer = ff_get_audio_buffer(outlink, n_max); + if (!atempo->dst_buffer) + return AVERROR(ENOMEM); atempo->dst = atempo->dst_buffer->data[0]; atempo->dst_end = atempo->dst + n_max * atempo->stride; diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c index ae2e0aa..038a8a1 100644 --- a/libavfilter/af_pan.c +++ b/libavfilter/af_pan.c @@ -361,6 +361,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) AVFrame *outsamples = ff_get_audio_buffer(outlink, n); PanContext *pan = inlink->dst->priv; + if (!outsamples) + return AVERROR(ENOMEM); swr_convert(pan->swr, outsamples->data, n, (void *)insamples->data, n); av_frame_copy_props(outsamples, insamples); outsamples->channel_layout = outlink->channel_layout; diff --git a/libavfilter/asrc_aevalsrc.c b/libavfilter/asrc_aevalsrc.c index 409399f..0dbfdd2 100644 --- a/libavfilter/asrc_aevalsrc.c +++ b/libavfilter/asrc_aevalsrc.c @@ -220,6 +220,8 @@ static int request_frame(AVFilterLink *outlink) return AVERROR_EOF; samplesref = ff_get_audio_buffer(outlink, eval->nb_samples); + if (!samplesref) + return AVERROR(ENOMEM); /* evaluate expression for each single sample and for each channel */ for (i = 0; i < eval->nb_samples; i++, eval->n++) { diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c index 5caca2f..6ff2140 100644 --- a/libavfilter/vf_tinterlace.c +++ b/libavfilter/vf_tinterlace.c @@ -266,6 +266,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref) case MODE_PAD: /* expand each frame to double height, but pad alternate * lines with black; framerate unchanged */ out = ff_get_video_buffer(outlink, outlink->w, outlink->h); + if (!out) + return AVERROR(ENOMEM); av_frame_copy_props(out, cur); out->height = outlink->h; diff --git a/libavfilter/vsrc_cellauto.c b/libavfilter/vsrc_cellauto.c index 110f6ae..a48f04c 100644 --- a/libavfilter/vsrc_cellauto.c +++ b/libavfilter/vsrc_cellauto.c @@ -294,6 +294,8 @@ static int request_frame(AVFilterLink *outlink) { CellAutoContext *cellauto = outlink->src->priv; AVFrame *picref = ff_get_video_buffer(outlink, cellauto->w, cellauto->h); + if (!picref) + return AVERROR(ENOMEM); picref->sample_aspect_ratio = (AVRational) {1, 1}; if (cellauto->generation == 0 && cellauto->start_full) { int i; diff --git a/libavfilter/vsrc_life.c b/libavfilter/vsrc_life.c index 0474ef2..d7ed40b 100644 --- a/libavfilter/vsrc_life.c +++ b/libavfilter/vsrc_life.c @@ -420,6 +420,8 @@ static int request_frame(AVFilterLink *outlink) { LifeContext *life = outlink->src->priv; AVFrame *picref = ff_get_video_buffer(outlink, life->w, life->h); + if (!picref) + return AVERROR(ENOMEM); picref->sample_aspect_ratio = (AVRational) {1, 1}; picref->pts = life->pts++; diff --git a/libavfilter/vsrc_mandelbrot.c b/libavfilter/vsrc_mandelbrot.c index 7bbdf95..c91494b 100644 --- a/libavfilter/vsrc_mandelbrot.c +++ b/libavfilter/vsrc_mandelbrot.c @@ -403,6 +403,9 @@ static int request_frame(AVFilterLink *link) { MBContext *mb = link->src->priv; AVFrame *picref = ff_get_video_buffer(link, mb->w, mb->h); + if (!picref) + return AVERROR(ENOMEM); + picref->sample_aspect_ratio = (AVRational) {1, 1}; picref->pts = mb->pts++; diff --git a/libavfilter/vsrc_mptestsrc.c b/libavfilter/vsrc_mptestsrc.c index 856c3e4..9f1c46f 100644 --- a/libavfilter/vsrc_mptestsrc.c +++ b/libavfilter/vsrc_mptestsrc.c @@ -323,6 +323,8 @@ 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, w, h); + if (!picref) + return AVERROR(ENOMEM); picref->pts = test->pts++; // clean image |