GNOME Bugzilla – Bug 728987
qtdemux: 'caps' may be used uninitialized in this function.
Last modified: 2014-05-01 20:19:39 UTC
When building with -Werror=maybe-uninitialized we get: qtdemux.c: In function 'qtdemux_parse_tree': qtdemux.c:7480:18: error: 'caps' may be used uninitialized in this function [-Werror=maybe-uninitialized] stream->caps = ^ qtdemux.c:10459:12: note: 'caps' was declared here GstCaps *caps; ^ Because in qtdemux_video_caps not all cases set the caps pointer to a value and the pointer isn't initialized at declaration. Please confirm so I can push.
Created attachment 275174 [details] [review] fix Please confirm
A similar thing happens in qtdemux_audio_caps () and qtdemux_sub_caps () but in those functions all cases initialize the caps pointer.
Review of attachment 275174 [details] [review]: If the video fourcc is 'raw ' and the bpp is not one of the expected values it will indeed end up with an uninitialized caps pointer. Nice catch!
Created attachment 275176 [details] [review] alternative fix The alternative is to initalize the caps in the only case that doesn't already do it.
Review of attachment 275176 [details] [review]: I still prefer the first patch as this one will create a video/x-raw stream without a specification about its format. ::: gst/isomp4/qtdemux.c @@ +10524,3 @@ break; } + caps = gst_caps_new_empty_simple ("video/x-raw"); You actually want to have this right after the /* unknown */ comment.
True! About the position of the gst_caps_new_empty_simple() but not important because I also prefer the first one. Pushing. Thanks for the review :)
Reopening so we get another patch to check for a NULL return from the qtdemux_video_caps function.
Will have a patch tomorrow :)
Pushed check for return of qtdemux_video_caps (). http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=5dc2e6bef1cb35e9473dcb785d3711e0892c7e38 I will let you confirm and set to fixed/resolved.