Commit 3fa8f263 authored by hexpointer's avatar hexpointer Committed by Michael Niedermayer

libswresample: check input to swr_convert_frame for NULL

When 'out' is an AVFrame that does not have buffers preallocated,
swr_convert_frame tries to allocate buffers of the right size. However
in calculating this size it failed to check for whether 'in' is NULL
(requesting that swr's internal buffers are to be flushed).
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 01e545d0
...@@ -139,9 +139,10 @@ int swr_convert_frame(SwrContext *s, ...@@ -139,9 +139,10 @@ int swr_convert_frame(SwrContext *s,
if (out) { if (out) {
if (!out->linesize[0]) { if (!out->linesize[0]) {
out->nb_samples = swr_get_delay(s, s->out_sample_rate) out->nb_samples = swr_get_delay(s, s->out_sample_rate) + 3;
+ in->nb_samples*(int64_t)s->out_sample_rate / s->in_sample_rate if (in) {
+ 3; out->nb_samples += in->nb_samples*(int64_t)s->out_sample_rate / s->in_sample_rate;
}
if ((ret = av_frame_get_buffer(out, 0)) < 0) { if ((ret = av_frame_get_buffer(out, 0)) < 0) {
if (setup) if (setup)
swr_close(s); swr_close(s);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment