GNOME Bugzilla – Bug 706369
videoparser/mpegvideoparse: bad switch statements
Last modified: 2013-08-28 22:15:52 UTC
I just ran the static analysis checker "cppcheck" over the source code of gstreamer-plugins-bad-free-0.10.23 It said 1. [gstvc1parser.c:923] -> [gstvc1parser.c:926]: (warning) Variable 'ptype' is reas signed a value before the old one has been used. 'break;' missing? switch (pic->fptype) { case 0x00: case 0x02: framehdr->ptype = GST_VC1_PICTURE_TYPE_I; case 0x01: case 0x03: framehdr->ptype = GST_VC1_PICTURE_TYPE_P; case 0x04: case 0x06: framehdr->ptype = GST_VC1_PICTURE_TYPE_B; case 0x05: case 0x07: framehdr->ptype = GST_VC1_PICTURE_TYPE_BI; } Suggest add break statements after each assignment. Same problem a few lines lines further down. 2. [gstmpegvideoparse.c:644] -> [gstmpegvideoparse.c:646]: (warning) Variable 'leve l' is reassigned a value before the old one has been used. 'break;' missing? switch (level_c) { case 2: level = levels[0]; case 5: level = levels[2]; profile = "4:2:2"; break; case 10: level = levels[0]; case 11: level = levels[1]; case 13: level = levels[2]; case 14: level = levels[3]; profile = "multiview"; break; default: break; }
The vc1 part is Already fixed in 1.0. http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/gst-libs/gst/codecparsers/gstvc1parser.c#n926 The gstmpegvideoparse one is still valid (in the videoparse plugin)
commit 32a65dc5f3e3fec36d542d773092fe336f8d4398 Author: Sebastian Dröge <slomo@circular-chaos.org> Date: Tue Aug 20 13:29:14 2013 +0200 mpegvideoparse: Fix switch statement in level detection code Properly fall through the cases without re-assigning the level to the wrong value. https://bugzilla.gnome.org/show_bug.cgi?id=706369
Cherry-picked into 1.0 branch for 1.0.10 as well.