Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 600892

Summary: media-libs/libmp4v2 failed to build : ISO C++ forbids comparison between pointer and integer [-fpermissive]
Product: Gentoo Linux Reporter: Roman <roman.morokutti>
Component: Current packagesAssignee: Gentoo Sound Team <sound>
Status: RESOLVED FIXED    
Severity: normal CC: ab4bd, anton.kochkov, carlphilippreh, const, martin, orodruinlair, security-audit
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 617524    
Attachments: Build log
emerge --info
Fix of the missing *
Patch to fix pointer comparison

Description Roman 2016-11-26 09:46:15 UTC
Hello,
media-libs/libmp4v2-2.0.0 crashes with the following build error:


src/rtphint.cpp: In member function ‘void mp4v2::impl::MP4RtpHintTrack::GetPayload(char**, uint8_t*, uint16_t*, char**)’:
src/rtphint.cpp:342:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
                     if (pSlash != '\0') {

I rebuilt the packages with

revdep-rebuild --library 'libstdc\+\+.so.6' -- --exclude gcc

Please fix this build error.

Thank you in advance.

Best regards,
Roman
Comment 1 Michael Palimaka (kensington) gentoo-dev 2016-11-27 11:44:16 UTC
Please add emerge --info and attach the failing build log.
Comment 2 Roman 2016-11-27 18:52:05 UTC
Created attachment 454542 [details]
Build log
Comment 3 Roman 2016-11-27 18:53:42 UTC
Created attachment 454544 [details]
emerge --info
Comment 4 Roman 2016-11-27 18:54:39 UTC
Hello,

I've uploaded these two infos as files.

Best regards,
Roman
Comment 5 Martin Väth 2017-05-08 04:10:21 UTC
Created attachment 471938 [details, diff]
Fix of the missing *

The bug becomes only visible with gcc-7, but actually it looks like a real bug:

It seems that not the pointer should be compared against 0 (this happened already 2 lines before) but instead the char the pointer points to should be compared against '\0'.

Previous versions of gcc have accepted this code but actually misinterpreted it.

I have not audited the code, but the actual missing check for '\0' with previous compiler versions might even be a security issue (buffer overrun).
Comment 6 Thomas Deutschmann (RETIRED) gentoo-dev 2017-05-08 19:49:51 UTC
CC'ing security audit project. Please see comment #5
Comment 7 Ivan 2017-05-10 05:07:34 UTC
Proposed patch in comment #5 fixes the issue for me.

[ebuild   R    ] media-libs/libmp4v2-2.0.0::gentoo  USE="-static-libs {-test} -utils" 0 KiB

emerge --info
Portage 2.3.5 (python 3.4.6-final-0, default/linux/amd64/13.0/desktop/plasma, gcc-7.1.0, glibc-2.24-r1, 4.4.67 x86_64)
=================================================================
System uname: Linux-4.4.67-x86_64-Intel-R-_Core-TM-_i5-2500K_CPU_@_3.30GHz-with-gentoo-2.3
KiB Mem:    16358300 total,  10753428 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Tue, 09 May 2017 10:30:01 +0000
sh bash 4.4_p12
ld GNU ld (Gentoo 2.27 p1.0) 2.27
app-shells/bash:          4.4_p12::gentoo
dev-lang/perl:            5.24.1-r1::gentoo
dev-lang/python:          2.7.13::gentoo, 3.4.6::gentoo
dev-util/cmake:           3.8.1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.25::gentoo
sys-apps/sandbox:         2.10-r4::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r3::gentoo
sys-devel/automake:       1.13.4-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.27::gentoo
sys-devel/gcc:            5.4.0-r3::gentoo, 6.3.0::gentoo, 7.1.0-r1::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r1::gentoo
sys-kernel/linux-headers: 4.10::gentoo (virtual/os-headers)
sys-libs/glibc:           2.24-r1::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

my
    location: /usr/local/my
    masters: gentoo
    priority: 0

deadbeef-overlay
    location: /var/lib/layman/deadbeef-overlay
    masters: gentoo
    priority: 50

mozilla
    location: /var/lib/layman/mozilla
    masters: gentoo
    priority: 50

scrill
    location: /var/lib/layman/scrill
    masters: gentoo
    priority: 50

steam-overlay
    location: /var/lib/layman/steam-overlay
    masters: gentoo
    priority: 50

vortex
    location: /var/lib/layman/vortex
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -mtune=native -O2 -pipe -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -mtune=native -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y --quiet-build=n"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync metadata-transfer news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="ru_RU.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/tmp"
USE="X a52 aac acl acpi aes aften alsa amd64 amr ass audio avx bash-completion branding bzip2 cairo cdda cdr cleartype consolekit cracklib crypt css cups cxx dbus declarative device-mapper djvu dri dts dv dvd dvdr encode exif faac faad fam fat ffmpeg firefox firmware-loader flac fontconfig gd gif glamor gpm gzip iconv icu id3tag ieee1394 imagemagick ipv6 jit jpeg kde keymap ladspa lame lash lcms libass libnotify lm_sensors lzma lzo mad matroska midi mmx mmxext mng modules mp3 mp4 mpeg mplayer mtp mudflap multilib ncurses nls nptl ntfs nvidia ogg opengl openmp opus pam pango pcre pdf phonon pie plasma png policykit popcnt ppds pppd pulseaudio qml qt3support qt4 qt5 quicktime rar raw readline scanner sdl seccomp session sse sse2 sse3 sse4_1 sse4_2 ssl ssp ssse3 startup-notification svc svg sysfs tcpd theora threads tiff toolame truetype twolame udev udisks unicode upower usb vaapi vdpau vorbis vpx wav wavpack widgets win32codecs wxwidgets x264 x265 xattr xcb xcomposite xml xorg xscreensaver xulrunner xv xvfb xvid xvmc zip zlib" ABI_X86="64" ALSA_CARDS="emu10k1" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev" KERNEL="linux" L10N="ru en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="ru en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby21 ruby22" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
USE_PYTHON="2.7 3.4"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 8 Collin Day 2017-05-16 16:43:46 UTC
Created attachment 472800 [details, diff]
Patch to fix pointer comparison

This worked as a quick fix.
Comment 9 George L. Emigh 2017-06-02 23:23:47 UTC
(In reply to Collin Day from comment #8)
> Created attachment 472800 [details, diff] [details, diff]
> Patch to fix pointer comparison
> 
> This worked as a quick fix.

I must be missing something, the ebuild seems to ignore user patches in /etc/portage/patches/media-libs/libmp4v2-2.0.0

How did you apply the patch?
Comment 10 George L. Emigh 2017-06-02 23:33:26 UTC
Guess I figured it out, copied it to a local overlay, changed eapi to 6 to expose eapply_user, build the digest, emerged and done.

Sorry for the interruption.
Comment 11 Alexis Ballier gentoo-dev 2017-06-19 16:17:29 UTC
commit 8c6cbd5792afee41a77f740ec53459de27bd6650 (HEAD -> master, origin/master, origin/HEAD)
Author: Alexis Ballier <aballier@gentoo.org>
Date:   Mon Jun 19 18:15:50 2017 +0200

    media-libs/libmp4v2: Fix build with gcc7, patch by Collin Day in bug #600892


thanks
Comment 12 Martin Väth 2017-06-19 16:59:44 UTC
Sorry, usually I don't care about these things, but anyway:
I posted here exactly the same patch one week earlier ("Fix of the the missing *", attachment 471938 [details, diff]). It is strange to see only the author of the "copy" being mentioned.
Comment 13 Alexis Ballier gentoo-dev 2017-06-19 18:15:48 UTC
(In reply to Martin Väth from comment #12)
> Sorry, usually I don't care about these things, but anyway:
> I posted here exactly the same patch one week earlier ("Fix of the the
> missing *", attachment 471938 [details, diff] [details, diff]). It is strange to see only
> the author of the "copy" being mentioned.

Ooops, I'm really sorry, it's a bit too late for git log

I read bottom to top and stopped when I found the proper patch...