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 779333 - tsdemux: Probably broken code, compiler warning with gcc 7
tsdemux: Probably broken code, compiler warning with gcc 7
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 1.11.90
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-02-27 19:15 UTC by Sebastian Dröge (slomo)
Modified: 2017-02-28 08:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
mpegtsdemux: Fix wrong usage of '<<' operator (1.41 KB, patch)
2017-02-28 08:27 UTC, Edward Hervey
committed Details | Review

Description Sebastian Dröge (slomo) 2017-02-27 19:15:34 UTC
pesparse.c: In function ‘mpegts_parse_pes_header’:
pesparse.c:324:46: error: ‘<<’ in boolean context, did you mean ‘<’ ? [-Werror=int-in-bool-context]
         (GST_READ_UINT16_BE (data) & 0x1fff) << (val8 & 0x20) ? 10 : 7;
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~

I'm not sure what this code is trying to do, but it seems to make no sense in any way. It would either shift by 0 or by 0x20 there. If it shifts by 0x20, it will be 0 and evaluate to 7... otherwise it will be 7 if those 2 bytes are 0, or 10 otherwise.

This does not seem to make any sense and I can't find the spec currently :)
Comment 1 Edward Hervey 2017-02-28 08:27:46 UTC
Created attachment 346889 [details] [review]
mpegtsdemux: Fix wrong usage of '<<' operator

Detected by GCC 7.

Add comments for clarity
Comment 2 Edward Hervey 2017-02-28 08:38:48 UTC
commit fcf87ef2bf1967512e9e44f46f6a20eb542b6cc4
Author: Edward Hervey <edward@centricular.com>
Date:   Tue Feb 28 09:26:25 2017 +0100

    mpegtsdemux: Fix wrong usage of '<<' operator
    
    Detected by GCC 7.
    
    Add comments for clarity
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779333