decoder/ffmpeg: check for av_samples_get_buffer_size() errors
Fixes potential nullptr dereference.
This commit is contained in:
parent
fe7cda57e4
commit
f1ca17f6a1
|
@ -222,6 +222,9 @@ copy_interleave_frame(const AVCodecContext *codec_context,
|
||||||
codec_context->channels,
|
codec_context->channels,
|
||||||
frame->nb_samples,
|
frame->nb_samples,
|
||||||
codec_context->sample_fmt, 1);
|
codec_context->sample_fmt, 1);
|
||||||
|
if (data_size <= 0)
|
||||||
|
return data_size;
|
||||||
|
|
||||||
if (av_sample_fmt_is_planar(codec_context->sample_fmt) &&
|
if (av_sample_fmt_is_planar(codec_context->sample_fmt) &&
|
||||||
codec_context->channels > 1) {
|
codec_context->channels > 1) {
|
||||||
if(*global_buffer_size < data_size) {
|
if(*global_buffer_size < data_size) {
|
||||||
|
|
Loading…
Reference in New Issue