]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/concatdec.c
frmdec: tag 2 is AV_PIX_FMT_RGB0
[ffmpeg] / libavformat / concatdec.c
index 29233e2c8cc3f14fdaaeb69d9f00f9b9744cdc5d..0514755e0a54e6b7266390b5109c0c2048c36238 100644 (file)
@@ -68,10 +68,12 @@ static int add_file(AVFormatContext *avf, char *filename, ConcatFile **rfile,
     av_free(filename);
 
     if (cat->nb_files >= *nb_files_alloc) {
-        unsigned n = FFMAX(*nb_files_alloc * 2, 16);
-        if (n <= cat->nb_files ||
-            !(cat->files = av_realloc_f(cat->files, n, sizeof(*cat->files))))
+        size_t n = FFMAX(*nb_files_alloc * 2, 16);
+        ConcatFile *new_files;
+        if (n <= cat->nb_files || n > SIZE_MAX / sizeof(*cat->files) ||
+            !(new_files = av_realloc(cat->files, n * sizeof(*cat->files))))
             return AVERROR(ENOMEM);
+        cat->files = new_files;
         *nb_files_alloc = n;
     }