mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
lavc: check channel count after decoder init
Ensures the decoder did not set channel count to an insanely high value during initialization, which could cause large memory usage when it tries to get a buffer during decoding.
This commit is contained in:
parent
bb6941af2a
commit
0366664ef9
@ -881,6 +881,11 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
|
||||
avctx->channel_layout = 0;
|
||||
}
|
||||
}
|
||||
if (avctx->channels && avctx->channels < 0 ||
|
||||
avctx->channels > FF_SANE_NB_CHANNELS) {
|
||||
ret = AVERROR(EINVAL);
|
||||
goto free_and_end;
|
||||
}
|
||||
}
|
||||
end:
|
||||
entangled_thread_counter--;
|
||||
|
Loading…
Reference in New Issue
Block a user