[FFmpeg-devel] [PATCH 6/8] avcodec/movtextenc: Use av_fast_realloc_array

Tomas Härdin tjoppen at acc.umu.se
Wed Jul 6 18:06:42 EEST 2022


tis 2022-07-05 klockan 22:26 +0200 skrev Andreas Rheinhardt:
> 
> -        if (s->count + 1 > FFMIN(SIZE_MAX / sizeof(*s-
> >style_attributes), UINT16_MAX) ||
> -            !(tmp = av_fast_realloc(s->style_attributes,
> -                                    &s-
> >style_attributes_bytes_allocated,
> -                                    (s->count + 1) * sizeof(*s-
> >style_attributes)))) {
> +        ret = av_fast_realloc_array(&s->style_attributes, &s-
> >style_attributes_allocated,
> +                                    s->count + 1, UINT16_MAX,
> sizeof(*s->style_attributes));

Looks simple enough. Should ever s->count == UINT16_MAX then this will
fail, as it should

/Tomas



More information about the ffmpeg-devel mailing list