Bug#958427: libsrtp2: FTBFS on x32: bogus printf with time_t, then segfaults [regression]

Thorsten Glaser tg at mirbsd.de
Tue Apr 21 22:19:59 BST 2020


Source: libsrtp2
Version: 2.3.0-3
Severity: important
Tags: ftbfs
Justification: fails to build from source (but built successfully in the past)

2.3.0-4 FTBFS:
https://buildd.debian.org/status/fetch.php?pkg=libsrtp2&arch=x32&ver=2.3.0-4&stamp=1586231427&raw=0

First a warning shows bad code:

[…]
test/rtp_decoder.c: In function 'rtp_decoder_handle_pkt':
test/rtp_decoder.c:768:26: warning: format '%ld' expects argument of type 'long int', but argument 3 has type '__time_t' {aka 'long long int'} [-Wformat=]
  768 |     fprintf(stdout, "%02ld:%02ld.%06ld\n", delta.tv_sec / 60, delta.tv_sec % 60,
      |                      ~~~~^                 ~~~~~~~~~~~~~~~~~
      |                          |                              |
      |                          long int                       __time_t {aka long long int}
      |                      %02lld
test/rtp_decoder.c:768:32: warning: format '%ld' expects argument of type 'long int', but argument 4 has type '__time_t' {aka 'long long int'} [-Wformat=]
  768 |     fprintf(stdout, "%02ld:%02ld.%06ld\n", delta.tv_sec / 60, delta.tv_sec % 60,
      |                            ~~~~^                              ~~~~~~~~~~~~~~~~~
      |                                |                                           |
      |                                long int                                    __time_t {aka long long int}
      |                            %02lld
[…]

The code in question must be fixed like this:

-     fprintf(stdout, "%02ld:%02ld.%06ld\n", delta.tv_sec / 60, delta.tv_sec % 60,
+     fprintf(stdout, "%02ld:%02d.%06ld\n", (long)(delta.tv_sec / 60), (int)(delta.tv_sec % 60),

Then, it segfaults:

[…]
Build done. Please run '/usr/bin/make runtest' to run self tests.
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
touch debian/stamp-makefile-build
/usr/bin/make -C . runtest LD_LIBRARY_PATH=":/<<PKGBUILDDIR>>"
make[1]: Entering directory '/<<PKGBUILDDIR>>'
Build done. Please run '/usr/bin/make runtest' to run self tests.
running libsrtp2 test applications...
crypto/test/cipher_driver -v
make[1]: *** [Makefile:47: runtest] Segmentation fault
[…]


2.3.0-3 built fine, so this is a recent regression.

-- System Information:
Debian Release: bullseye/sid
  APT prefers unreleased
  APT policy: (500, 'unreleased'), (500, 'buildd-unstable'), (500, 'unstable'), (100, 'experimental')
Architecture: x32 (x86_64)
Foreign Architectures: i386, amd64

Kernel: Linux 5.4.0-4-amd64 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_FIRMWARE_WORKAROUND
Locale: LANG=C, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=C (charmap=UTF-8)
Shell: /bin/sh linked to /bin/lksh
Init: sysvinit (via /sbin/init)


More information about the Pkg-voip-maintainers mailing list