Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 924743 - media-video/ffmpeg[soc]: broken av_packet_get_side_data handling
Summary: media-video/ffmpeg[soc]: broken av_packet_get_side_data handling
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Media-video project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: c99-porting
  Show dependency tree
 
Reported: 2024-02-17 01:47 UTC by Sam James
Modified: 2024-02-17 14:53 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (file_924743.txt,193.16 KB, text/plain)
2024-02-17 01:47 UTC, Sam James
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-02-17 01:47:35 UTC
Created attachment 885173 [details]
build.log

Note that ::local in the log is just me copying ::gentoo->local repo to drop the -mcpu=native stuff as it breaks on arm64 sometimes (see bug 830165).

--

aarch64-unknown-linux-gnu-gcc -I. -Isrc/ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -DZLIB_CONST -DHAVE_AV_CONFIG_H -DBUILDING_avformat -O3   -std=c11 -fPIC      -pthread  -I/usr/include/p11-kit-1  -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include  -I/usr/include/libdrm -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/opus -I/usr/include/opus -D_REENTRANT -I/usr/include/librsvg-2.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/lib64/libffi/include -I/usr/include/libmount -I/usr/include/blkid -pthread -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/pixman-1    -DX264_API_IMPORTS -I/usr/include/libxml2      -I/usr/include/libdrm  -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -Wno-unused-const-variable -Wno-bool-operation -Wno-char-subscripts -O3 -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=format-security -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=vla -Wformat -Wno-maybe-uninitialized -I/usr/include/SDL2 -D_REENTRANT   -MMD -MF libavformat/rtpenc.d -MT libavformat/rtpenc.o -c -o libavformat/rtpenc.o src/libavformat/rtpenc.c
src/libavformat/rtpenc.c: In function ‘rtp_write_packet’:
src/libavformat/rtpenc.c:594:45: error: passing argument 3 of ‘av_packet_get_side_data’ from incompatible pointer type [-Wincompatible-pointer-types]
  594 |                                             &side_data_size);
      |                                             ^~~~~~~~~~~~~~~
      |                                             |
      |                                             int *
In file included from src/libavcodec/codec_par.h:33,
                 from src/libavformat/avformat.h:312,
                 from src/libavformat/rtpenc.c:23:
src/libavcodec/packet.h:721:42: note: expected ‘size_t *’ {aka ‘long unsigned int *’} but argument is of type ‘int *’
  721 |                                  size_t *size);
      |                                  ~~~~~~~~^~~~
make: *** [/var/tmp/portage/media-video/ffmpeg-6.1.1-r3/work/ffmpeg-6.1.1/ffbuild/common.mak:81: libavformat/rtpenc.o] Error 1
make: *** Waiting for unfinished jobs....

---

# emerge --info
Portage 3.0.61 (python 3.11.8-final-0, default/linux/arm64/17.0/hardened, gcc-14, glibc-2.38-r10, 5.15.148-gentoo-dist aarch64)
=================================================================
System uname: Linux-5.15.148-gentoo-dist-aarch64-with-glibc2.38
KiB Mem:   262954136 total,  97314536 free
KiB Swap:    9767620 total,   9610180 free
Timestamp of repository gentoo: Sat, 17 Feb 2024 01:18:53 +0000
sh dash 0.5.12
ld GNU ld (Gentoo 2.41 p5) 2.41.0
ccache version 4.9.1 [disabled]
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p26::gentoo
dev-build/autoconf:        2.13-r8::gentoo, 2.69-r9::gentoo, 2.71-r7::gentoo, 2.72-r1::gentoo
dev-build/automake:        1.16.5-r2::gentoo
dev-build/cmake:           3.28.3::gentoo
dev-build/libtool:         2.4.7-r2::gentoo
dev-build/make:            4.4.1-r1::gentoo
dev-build/meson:           1.3.2::gentoo
dev-java/java-config:      2.3.3-r1::gentoo
dev-lang/perl:             5.38.2-r1::gentoo
dev-lang/python:           3.10.13_p3::gentoo, 3.11.8_p1::gentoo, 3.12.2_p1::gentoo
dev-lang/rust-bin:         1.75.0::gentoo
dev-util/ccache:           4.9.1::gentoo
sys-apps/baselayout:       2.14-r2::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-apps/systemd:          255.3::gentoo
sys-devel/binutils:        2.41-r5::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           15.0.7-r3::gentoo, 16.0.6::gentoo, 17.0.6::gentoo
sys-devel/gcc:             11.4.1_p20240208::gentoo, 12.3.1_p20240209::gentoo, 13.2.1_p20240210::gentoo, 14.0.9999::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/lld:             15.0.7::gentoo, 16.0.6::gentoo, 17.0.6::gentoo
sys-devel/llvm:            15.0.7-r3::gentoo, 16.0.6::gentoo, 17.0.6::gentoo
sys-kernel/linux-headers:  6.7::gentoo (virtual/os-headers)
sys-libs/glibc:            2.38-r10::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    volatile: False
    sync-rsync-extra-opts: 
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-jobs: 1

local
    location: /var/db/repos/local
    masters: gentoo
    volatile: False

Installed sets: @sam
ACCEPT_KEYWORDS="arm64 ~arm64"
ACCEPT_LICENSE="*"
CBUILD="aarch64-unknown-linux-gnu"
CFLAGS="-O2 -pipe -mcpu=native -fdiagnostics-color=always -ggdb3 -fpermissive"
CHOST="aarch64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /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/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -mcpu=native -fdiagnostics-color=always -ggdb3"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--keep-going=y --complete-graph"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -pipe -mcpu=native -fdiagnostics-color=always -ggdb3"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live clean-logs compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles multilib-strict news parallel-fetch pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms split-elog split-log splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -mcpu=native -fdiagnostics-color=always -ggdb3"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="C.UTF8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0"
LEX="flex"
PKGDIR="/var/cache/binpkgs"
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="/var/tmp"
USE="X a52 aac accessibility acl acpi activities alsa arm64 bluetooth branding brotli bzip2 cairo cdda cdr cli colord crypt cups dbus declarative dot dri dts dvdr encode exif flac fortran gdbm gif gpm gtk gui hardened http http2 iconv icu ipv6 jadetex jpeg kde kwallet lcms libnotify libtirpc libxml2 lua lz4 lzma mad mng mp3 mp4 mpeg ncurses networkmanager nls ogg opengl openmp opus pam pango pcre pcre32 pdf perl pic pie pim pipewire plasma png policykit ppds pulseaudio python qml qt5 readline ruby screencast sdk sdl seccomp semantic-desktop snappy sound spell sql sqlite ssh ssl ssp startup-notification svg systemd test-rust tiff truetype udev udisks unicode upower usb vorbis vulkan wayland webchannel webengine webkit widgets wifi wireless wxwidgets x264 xattr xcb xft xml xtpax xv xvid zlib zstd" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_ARM="edsp vfp vfpv3 vfpv4 vfp-d32 aes sha1 sha2 crc32 v8" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 ntrip navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11 python3_10" RUBY_TARGETS="ruby31 ruby32" VIDEO_CARDS="fbdev dummy" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, MAKEOPTS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SHELL, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-02-17 01:48:22 UTC
The upstream commit https://github.com/FFmpeg/FFmpeg/commit/ef6a9e5e311f09fa8032974fa4d0c1e166a959bb changes the required size to a size_t*, but the RPi patch is using int*:

```
[...]
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */

+#include "avc.h"
 #include "avformat.h"
 #include "mpegts.h"
 #include "internal.h"
@@ -585,8 +586,25 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
         ff_rtp_send_vc2hq(s1, pkt->data, size, st->codecpar->field_order != AV_FIELD_PROGRESSIVE ? 1 : 0);
         break;
     case AV_CODEC_ID_H264:
+    {
+        uint8_t *side_data;
+        int side_data_size = 0;
+
+        side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
+                                            &side_data_size);
+
+        if (side_data_size != 0) {
+            int ps_size = side_data_size;
+            uint8_t * ps_buf = NULL;
+
+            ff_avc_write_annexb_extradata(side_data, &ps_buf, &ps_size);
+            av_log(s1, AV_LOG_TRACE, "H264: write side data=%d\n", ps_size);
+            ff_rtp_send_h264_hevc(s1, ps_buf ? ps_buf : side_data, ps_size);
+            av_free(ps_buf);
+        }
[...]
```
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-02-17 01:49:07 UTC
Please keep an eye out for these warnings which become fatal with GCC 14 (see https://wiki.gentoo.org/wiki/Modern_C_porting#What_changed.3F).

Thanks to parona for spotting, as I was curious at first how this hadn't come up earlier...
Comment 3 James Le Cuirot gentoo-dev 2024-02-17 14:22:08 UTC
It also fails to build with USE=vaapi under GCC 14 for a different reason. It's a one line fix, so I'll tackle that too.
Comment 4 Larry the Git Cow gentoo-dev 2024-02-17 14:53:15 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ebf0a62268c4b27ffd37234cc8ed9e6054e0053c

commit ebf0a62268c4b27ffd37234cc8ed9e6054e0053c
Author:     James Le Cuirot <chewi@gentoo.org>
AuthorDate: 2024-02-17 14:51:49 +0000
Commit:     James Le Cuirot <chewi@gentoo.org>
CommitDate: 2024-02-17 14:52:56 +0000

    media-video/ffmpeg: Fix Clang and GCC 14 issues with new RPi patch
    
    Closes: https://bugs.gentoo.org/924558
    Closes: https://bugs.gentoo.org/924743
    Signed-off-by: James Le Cuirot <chewi@gentoo.org>

 media-video/ffmpeg/Manifest                      |  2 +-
 media-video/ffmpeg/ffmpeg-6.1.1-r3.ebuild        |  3 ++-
 media-video/ffmpeg/ffmpeg-9999.ebuild            |  2 +-
 media-video/ffmpeg/files/ffmpeg-6.1-gcc-14.patch | 13 +++++++++++++
 4 files changed, 17 insertions(+), 3 deletions(-)