1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +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
bayer_template.c swscale: do not drop half of bits from 16bit bayer formats 2020-08-08 12:03:42 +02:00
gamma.c
hscale_fast_bilinear.c
hscale.c
input.c avutil/internal, swresample/audioconvert: Remove cpu.h inclusions 2021-07-22 14:33:45 +02:00
libswscale.v
log2_tab.c
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
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