1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
FFmpeg/libswscale
Andreas Rheinhardt f440c422b7 swscale/swscale: Fix races when using unaligned strides/data
In this case the current code tries to warn once; to do so, it uses
ordinary static ints to store whether the warning has already been
emitted. This is both a data race (and therefore undefined behaviour)
as well as a race condition, because it is really possible for multiple
threads to be the one thread to emit the warning. This is actually
common since the introduction of the new multithreaded scaling API.

This commit fixes this by using atomic integers for the state;
furthermore, these are not static anymore, but rather contained
in the user-facing SwsContext (i.e. the parent SwsContext in case
of slice-threading).

Given that these atomic variables are not intended for synchronization
at all (but only for atomicity, i.e. only to output the warning once),
the atomic operations use memory_order_relaxed.

This affected the nv12, nv21, yuv420, yuv420p10, yuv422, yuv422p10 and
yuv444 filter-overlay FATE-tests.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-19 23:52:37 +02:00
..
aarch64 sws: rename SwsContext.swscale to convert_unscaled 2021-07-03 15:57:53 +02:00
arm sws: rename SwsContext.swscale to convert_unscaled 2021-07-03 15:57:53 +02:00
ppc sws: rename SwsContext.swscale to convert_unscaled 2021-07-03 15:57:53 +02:00
tests libswscale/tests: add floatimg_cmp test 2020-10-02 14:59:52 +02:00
x86 Include attributes.h directly 2021-04-19 14:34:10 +02:00
alphablend.c avutil: Rename FF_CEIL_COMPAT to AV_CEIL_COMPAT 2016-01-27 16:36:46 +00:00
bayer_template.c swscale: do not drop half of bits from 16bit bayer formats 2020-08-08 12:03:42 +02:00
gamma.c swscale: re-enable gamma 2015-09-04 19:00:20 -03:00
hscale_fast_bilinear.c sws: Move fast bilinear C code into seperate file 2014-07-19 05:36:26 +02:00
hscale.c avutil: Rename FF_CEIL_COMPAT to AV_CEIL_COMPAT 2016-01-27 16:36:46 +00:00
input.c avutil/internal, swresample/audioconvert: Remove cpu.h inclusions 2021-07-22 14:33:45 +02:00
libswscale.v build: Change structure of the linker version script templates 2016-05-29 16:43:11 +02:00
log2_tab.c lsws: duplicate ff_log2_tab 2014-08-12 20:52:21 +02:00
Makefile libswscale/tests: add floatimg_cmp test 2020-10-02 14:59:52 +02:00
options.c libswscale/options: Add parent_log_context_offset to AVClass 2021-09-19 23:52:37 +02:00
output.c avutil/internal, swresample/audioconvert: Remove cpu.h inclusions 2021-07-22 14:33:45 +02:00
rgb2rgb_template.c swscale/rgb2rgb_template: use shuffle macro on big-endian arches 2020-12-12 23:07:22 -05:00
rgb2rgb.c swscale: aarch64: Add a NEON implementation of interleaveBytes 2020-05-15 23:38:17 +03:00
rgb2rgb.h swscale: aarch64: Add a NEON implementation of interleaveBytes 2020-05-15 23:38:17 +03:00
slice.c swscale/slice: Fix wrong return on error 2021-07-09 15:21:37 +02:00
swscale_internal.h swscale/swscale: Fix races when using unaligned strides/data 2021-09-19 23:52:37 +02:00
swscale_unscaled.c sws: add a new scaling API 2021-09-06 09:16:52 +02:00
swscale.c swscale/swscale: Fix races when using unaligned strides/data 2021-09-19 23:52:37 +02:00
swscale.h sws: add a new scaling API 2021-09-06 09:16:52 +02:00
swscaleres.rc Add Windows resource file support for shared libraries 2013-12-05 23:42:07 +01:00
utils.c swscale/swscale: Fix races when using unaligned strides/data 2021-09-19 23:52:37 +02:00
version.h sws: add a new scaling API 2021-09-06 09:16:52 +02:00
vscale.c swscale: make yuv2interleavedX more asm-friendly 2020-06-14 16:34:07 +01:00
yuv2rgb.c avutil/internal, swresample/audioconvert: Remove cpu.h inclusions 2021-07-22 14:33:45 +02:00