[FFmpeg-devel] [PATCH 5/8] avformat/matroskaenc: Use av_fast_realloc_array for index entries

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


tis 2022-07-05 klockan 22:26 +0200 skrev Andreas Rheinhardt:
> 
> -    entries = av_realloc_array(entries, cues->num_entries + 1,
> sizeof(mkv_cuepoint));
> -    if (!entries)
> -        return AVERROR(ENOMEM);
> -    cues->entries = entries;
> +    ret = av_fast_realloc_array(&cues->entries, &cues-
> >allocated_entries,
> +                                cues->num_entries + 1,
> +                                MAX_SUPPORTED_EBML_LENGTH /
> MIN_CUETRACKPOS_SIZE,

Looks fine since MAX_SUPPORTED_EBML_LENGTH <= INT_MAX. Even SIZE_MAX /
MIN_CUETRACKPOS_SIZE would work. Maybe we can could switch
MAX_SUPPORTED_EBML_LENGTH to

 #define MAX_SUPPORTED_EBML_LENGTH FFMIN(MAX_EBML_LENGTH, SIZE_MAX)

?

/Tomas



More information about the ffmpeg-devel mailing list