[FFmpeg-devel] [PATCH 00/11] Fix undefined behaviour

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Fri Sep 20 01:16:55 EEST 2019


1. When one uses UBSan (Undefined behaviour sanitizer) compiled with the
-fsanitize-trap=undefined option (that makes the resulting binary trap
on undefined behaviour instead of simply emitting a warning), lots of
FATE tests (about 960 on an x64) fail. Over 200 of these are false positives
because of unaligned accesses inside #ifdef HAVE_FAST_UNALIGNED, but
even accounting for that, the number is impressive.

2. ubitux (who runs a FATE box that uses UBSan [1]) has therefore
proposed that the UBSan toolchain configure options be changed to trap
by default so that undefined behaviour doesn't go unnoticed. What does
the community think about this?

3. I have also fixed some of the occurences of undefined behaviour. With
the exception of the mpeg12dec patch all these patches are little
no-brainer.

- Andreas

[1]: http://fate.ffmpeg.org/report.cgi?slot=x86_64-archlinux-gcc-ubsan&time=20190919170122  

Andreas Rheinhardt (11):
  avformat/sdsdec: Fix undefined shifts
  avcodec/mpeg12dec: Sanitize start codes earlier
  avcodec/wavpackenc: Fix undefined shifts
  avcodec/tdsc: Fix undefined shifts
  avformat/nutenc: Don't pass NULL to memcmp
  avcodec/pcm: Fix undefined shifts
  avcodec/pcm: Cosmetics
  avformat/movenc: Fix undefined shift
  avcodec/g723_1dec: Fix invalid shift
  avcodec/truespeech: Fix invalid shifts
  avcodec/ac3enc: Fix invalid shift

 libavcodec/ac3enc.c     |  2 +-
 libavcodec/g723_1dec.c  |  2 +-
 libavcodec/mpeg12dec.c  |  4 +++-
 libavcodec/pcm.c        | 30 +++++++++++++++---------------
 libavcodec/tdsc.c       |  6 +++---
 libavcodec/truespeech.c |  8 ++++----
 libavcodec/wavpackenc.c |  6 +++---
 libavformat/movenc.c    |  4 +++-
 libavformat/nutenc.c    |  5 +++--
 libavformat/sdsdec.c    |  6 +++---
 10 files changed, 39 insertions(+), 34 deletions(-)

-- 
2.20.1



More information about the ffmpeg-devel mailing list