Files
test2/source
Sergey Sharybin 58e0ca99a9 Fix: Non-thread-safe access to image in Compositor
Image operation's get_im_buf() function was not thread-safe:
- It had TOCTOU issue around calculating multi-layer indices and
  requesting to load the image buffer.
- It accessed render result, render layer and pass pointers without
  any thread guards.

This change moves all the logic needed to access the image buffer
into a single function with proper guards around the access. The
result is user-counted, so it is usable in a thread even if another
thread modifies the image.

The is still potential TOCTOU in the compositor since the image is
acquired twice: once from init_execution(), and once from the
determine_canvas(). It could cause issues if image resolution is
changed between these calls. It is still to be looked into.

Ref #118337, #121761
2024-05-21 17:29:51 +02:00
..