Fixed potential use of non initialized fourcc in rawvideo demuxer.
authorLaurent Aimar <fenrir@videolan.org>
Tue, 2 Nov 2010 20:12:44 +0000 (21:12 +0100)
committerLaurent Aimar <fenrir@videolan.org>
Tue, 2 Nov 2010 20:18:13 +0000 (21:18 +0100)
It could happen when the demuxer was forced.

modules/demux/rawvid.c

index b1558c9..82e4daa 100644 (file)
@@ -130,7 +130,7 @@ static int Open( vlc_object_t * p_this )
     demux_sys_t *p_sys;
     int i_width=-1, i_height=-1;
     unsigned u_fps_num=0, u_fps_den=1;
-    vlc_fourcc_t i_chroma;
+    vlc_fourcc_t i_chroma = 0;
     unsigned int i_sar_num = 0;
     unsigned int i_sar_den = 0;
     const struct preset_t *p_preset = NULL;
@@ -352,6 +352,12 @@ valid:
         goto error;
     }
 
+    if( i_chroma == 0 )
+    {
+        msg_Err( p_demux, "invalid or no chroma specified." );
+        goto error;
+    }
+
     /* fixup anything missing with sensible assumptions */
     if( i_sar_num <= 0 || i_sar_den <= 0 )
     {