af_aresample: allocate at least 1 sample buffer. Fix null ptr dereference.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
1b20877f34
commit
c44a028e19
@ -174,12 +174,11 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamplesref)
|
||||
{
|
||||
AResampleContext *aresample = inlink->dst->priv;
|
||||
const int n_in = insamplesref->audio->nb_samples;
|
||||
int n_out = n_in * aresample->ratio * 2 ;
|
||||
int n_out = FFMAX(n_in * aresample->ratio * 2, 1);
|
||||
AVFilterLink *const outlink = inlink->dst->outputs[0];
|
||||
AVFilterBufferRef *outsamplesref = ff_get_audio_buffer(outlink, AV_PERM_WRITE, n_out);
|
||||
int ret;
|
||||
|
||||
|
||||
avfilter_copy_buffer_ref_props(outsamplesref, insamplesref);
|
||||
outsamplesref->format = outlink->format;
|
||||
outsamplesref->audio->channel_layout = outlink->channel_layout;
|
||||
|
Loading…
x
Reference in New Issue
Block a user