After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 706369 - videoparser/mpegvideoparse: bad switch statements
videoparser/mpegvideoparse: bad switch statements
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 1.0.10
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-08-20 09:12 UTC by dcb
Modified: 2013-08-28 22:15 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description dcb 2013-08-20 09:12:34 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;
      }
Comment 1 Edward Hervey 2013-08-20 09:34:50 UTC
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)
Comment 2 Sebastian Dröge (slomo) 2013-08-20 11:30:34 UTC
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
Comment 3 Tim-Philipp Müller 2013-08-28 22:15:52 UTC
Cherry-picked into 1.0 branch for 1.0.10 as well.