You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/magicyuvenc: Restrict number of slice-planes to 256
Every frame contains an array of uint8_t with values 0..(s->planes * s->nb_slices - 1), so this needs to fit into an uint8_t. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -206,6 +206,7 @@ static av_cold int magy_encode_init(AVCodecContext *avctx)
|
|||||||
s->nb_slices = FFMAX(1, s->nb_slices);
|
s->nb_slices = FFMAX(1, s->nb_slices);
|
||||||
s->slice_height = FFALIGN((avctx->height + s->nb_slices - 1) / s->nb_slices, 1 << s->vshift[1]);
|
s->slice_height = FFALIGN((avctx->height + s->nb_slices - 1) / s->nb_slices, 1 << s->vshift[1]);
|
||||||
s->nb_slices = (avctx->height + s->slice_height - 1) / s->slice_height;
|
s->nb_slices = (avctx->height + s->slice_height - 1) / s->slice_height;
|
||||||
|
s->nb_slices = FFMIN(256U / s->planes, s->nb_slices);
|
||||||
s->slices = av_calloc(s->nb_slices * s->planes, sizeof(*s->slices));
|
s->slices = av_calloc(s->nb_slices * s->planes, sizeof(*s->slices));
|
||||||
if (!s->slices)
|
if (!s->slices)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
Reference in New Issue
Block a user