[FFmpeg-devel] [PATCH] avformat/mxfdec: fix pixel format extraction for cinema j2k

Tomas Härdin tjoppen at acc.umu.se
Mon Sep 14 12:40:02 EEST 2020


sön 2020-09-13 klockan 23:42 +0100 skrev Rémi Achard:
> 
> @@ -855,15 +857,19 @@ static int mxf_read_cryptographic_context(void *arg, AVIOContext *pb, int tag, i
>  
>  static int mxf_read_strong_ref_array(AVIOContext *pb, UID **refs, int *count)
>  {
> -    *count = avio_rb32(pb);
> -    av_free(*refs);
> -    *refs = av_calloc(*count, sizeof(UID));
> +    int local_count;
> +
> +    local_count = avio_rb32(pb);
> +    *refs = av_realloc_array(*refs, *count + local_count, sizeof(UID));
> +
>      if (!*refs) {
>          *count = 0;
>          return AVERROR(ENOMEM);
>      }
>      avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */
> -    avio_read(pb, (uint8_t *)*refs, *count * sizeof(UID));
> +    avio_read(pb, (uint8_t *)(*refs)[*count], local_count * sizeof(UID));
> +    *count += local_count;
> +
>      return 0;
>  }

Why this added hunk? Appending strong refs like this is likely to have
all sorts of unintended effects. The same MaterialPackages will appear
multiple times for example.

/Tomas



More information about the ffmpeg-devel mailing list