Compare commits

..

2 Commits

Author SHA1 Message Date
Andreas Rheinhardt e293091d98 avcodec/prores_raw: Reuse permutation
The ProresDSPContext already contains the idct_permutation.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-11-14 14:27:53 +01:00
Michael Niedermayer 41a9c6ec5f 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>
2025-11-14 12:16:48 +00:00
2 changed files with 7 additions and 5 deletions

View File

@ -385,6 +385,12 @@ static int mediacodec_wrap_sw_audio_buffer(AVCodecContext *avctx,
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->sample_rate = avctx->sample_rate;
frame->nb_samples = info->size / (sample_size * avctx->ch_layout.nb_channels);

View File

@ -43,7 +43,6 @@
static av_cold int decode_init(AVCodecContext *avctx)
{
ProResRAWContext *s = avctx->priv_data;
uint8_t idct_permutation[64];
avctx->bits_per_raw_sample = 12;
avctx->color_primaries = AVCOL_PRI_UNSPECIFIED;
@ -55,10 +54,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
ff_blockdsp_init(&s->bdsp);
ff_proresdsp_init(&s->prodsp, avctx->bits_per_raw_sample);
ff_init_scantable_permutation(idct_permutation,
s->prodsp.idct_permutation_type);
ff_permute_scantable(s->scan, ff_prores_interlaced_scan, idct_permutation);
ff_permute_scantable(s->scan, ff_prores_interlaced_scan, s->prodsp.idct_permutation);
return 0;
}