1
mirror of https://github.com/mpv-player/mpv synced 2024-11-14 22:48:35 +01:00
mpv/test
nanahi 9a861c930b image_writer: fix TOCTOU in screenshot filename generation
The screenshot command is documented to not overwrite existing files.
However, there is a race window between the filename is generated with
gen_fname and when the file is open to write. Specifically, the
convert_image function in this window can be very time consuming
depending on video and screenshot image format and size. This results
in existing file being overwritten because the file writing functions
don't check for the existance of file.

Fix this be opening the file in exclusive mode. Add overwrite parameter to
write_image for other operations that are documented to overwrite existing
files, like screenshot-to-file. Note that for write_avif, checking
existance is used instead because avio_open does not support exclusive
open mode.
2024-03-19 19:30:27 +01:00
..
ref test: update ffmpeg format refs 2023-11-18 20:46:11 +00:00
chmap.c test: integrate unittests with meson 2023-03-02 15:45:27 +00:00
gl_video.c test: integrate unittests with meson 2023-03-02 15:45:27 +00:00
img_format.c csputils: replace mp_colorspace with pl_color_space 2024-01-22 14:54:55 +00:00
img_utils.c test: integrate unittests with meson 2023-03-02 15:45:27 +00:00
img_utils.h test: integrate unittests with meson 2023-03-02 15:45:27 +00:00
json.c json: unify json_parse depth to MAX_JSON_DEPTH=50 2023-07-08 11:36:15 +02:00
libmpv_test.c test: indicate test function ran in log 2023-08-06 18:49:54 +02:00
linked_list.c test: integrate unittests with meson 2023-03-02 15:45:27 +00:00
meson.build test: add missing libplacebo dependency 2024-02-24 20:04:16 +01:00
paths.c test: integrate unittests with meson 2023-03-02 15:45:27 +00:00
repack.c csputils: replace mp_colorspace with pl_color_space 2024-01-22 14:54:55 +00:00
scale_sws.c test: integrate unittests with meson 2023-03-02 15:45:27 +00:00
scale_test.c image_writer: fix TOCTOU in screenshot filename generation 2024-03-19 19:30:27 +01:00
scale_test.h test: integrate unittests with meson 2023-03-02 15:45:27 +00:00
scale_zimg.c test: integrate unittests with meson 2023-03-02 15:45:27 +00:00
test_utils.c test/test_utils: add mp_msg_set_max_level stub 2024-03-03 15:15:51 -06:00
test_utils.h test/test_utils: add mp_msg_set_max_level stub 2024-03-03 15:15:51 -06:00
timer.c osdep/timer: update documentation and test for mp_time_ns 2024-01-26 03:28:55 +00:00