Module: wine Branch: master Commit: 72c0c88f2a5c9b52bb01f7981c0894a47efa55f3 URL: https://gitlab.winehq.org/wine/wine/-/commit/72c0c88f2a5c9b52bb01f7981c0894a...
Author: Jinoh Kang jinoh.kang.kr@gmail.com Date: Sat Oct 22 21:25:37 2022 +0900
gdiplus: Replace GpImage's busy flag with SRWLOCK.
Today, the image_unlock() helper function has a data race due to non-atomic write to GpImage's 'busy' flag which is accessible by other threads. Also, it lacks a release fence, which means that other threads can observe the unlocked (busy = 0) state too early when the current thread unlocks the image; specifically, the write to the 'busy' field of the GpImage can be reordered before the last read/write to any other fields of the same GpImage.
Fix this by replacing the 'busy' field of GpImage with SRWLOCK.
---
dlls/gdiplus/gdiplus_private.h | 13 ++++---- dlls/gdiplus/image.c | 67 +++++++++++++++++++----------------------- 2 files changed, 36 insertions(+), 44 deletions(-)