diff options
author | Martin Storsjö <martin@martin.st> | 2021-10-18 12:31:38 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2021-10-18 14:34:30 +0300 |
commit | ab792634197e364ca1bb194f9abe36836e42f12d (patch) | |
tree | 8e3c793852db8d197e90cb0b4552517e7a297183 /libavcodec/avdct.h | |
parent | fd3bd5c492834bd100bb2462d1e1dc25a66f28f8 (diff) | |
download | ffmpeg-ab792634197e364ca1bb194f9abe36836e42f12d.tar.gz |
seek: Fix crashes in ff_seek_frame_binary if built with latest Clang 14
Passing an uninitialized variable as argument to a function is
undefined behaviour (UB). The compiler can assume that UB does not
happen.
Hence, the compiler can assume that the variables are never
uninitialized when passed as argument, which means that the codepaths
that initializes them must be taken.
In ff_seek_frame_binary, this means that the compiler can assume
that the codepaths that initialize pos_min and pos_max are taken,
which means that the conditions "if (sti->index_entries)" and
"if (index >= 0)" can be optimized out.
Current Clang git versions (upcoming Clang 14) enabled an optimization
that does this, which broke the current version of this function
(which intentionally left the variables uninitialized, but silencing
warnings about being uninitialized). See [1] for discussion on
the matter.
[1] https://reviews.llvm.org/D105169#3069555
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavcodec/avdct.h')
0 files changed, 0 insertions, 0 deletions