You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-11-23 21:54:53 +02:00
avcodec/mediacodecdec_common: Check that the input to mediacodec_wrap_sw_audio_buffer() contains channel * sample_size
Fixes: out of array access
no testcase
Found-by: Joshua Rogers <joshua@joshua.hu> with ZeroPath
Reviewed-by: Joshua Rogers <joshua@joshua.hu>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 41a9c6ec5f)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@@ -385,6 +385,12 @@ static int mediacodec_wrap_sw_audio_buffer(AVCodecContext *avctx,
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (info->size % (sample_size * avctx->ch_layout.nb_channels)) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "input is not a multiple of channels * sample_size\n");
|
||||||
|
ret = AVERROR(EINVAL);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
frame->format = avctx->sample_fmt;
|
frame->format = avctx->sample_fmt;
|
||||||
frame->sample_rate = avctx->sample_rate;
|
frame->sample_rate = avctx->sample_rate;
|
||||||
frame->nb_samples = info->size / (sample_size * avctx->ch_layout.nb_channels);
|
frame->nb_samples = info->size / (sample_size * avctx->ch_layout.nb_channels);
|
||||||
|
|||||||
Reference in New Issue
Block a user