]> git.sesse.net Git - ffmpeg/commitdiff
avformat/allformats: test pointer to be used
authorAlexisWilke <alexis@m2osw.com>
Mon, 4 Jan 2021 18:11:01 +0000 (10:11 -0800)
committerJames Almer <jamrial@gmail.com>
Tue, 12 Jan 2021 03:17:30 +0000 (00:17 -0300)
Two tests check the opposite pointer before using it. If only one of these
is set to a valid pointer, one of these functions will crash, the other will
ignore the pointer.

Signed-off-by: James Almer <jamrial@gmail.com>
libavformat/allformats.c

index 0e0caaad393362cfab8b070264ec6c47766ba755..6990af55f43addeee161b7b06b3a31fed13b4cfa 100644 (file)
@@ -541,7 +541,7 @@ const AVOutputFormat *av_muxer_iterate(void **opaque)
 
     if (i < size) {
         f = muxer_list[i];
-    } else if (indev_list) {
+    } else if (outdev_list) {
         f = outdev_list[i - size];
     }
 
@@ -558,7 +558,7 @@ const AVInputFormat *av_demuxer_iterate(void **opaque)
 
     if (i < size) {
         f = demuxer_list[i];
-    } else if (outdev_list) {
+    } else if (indev_list) {
         f = indev_list[i - size];
     }