• Jinoh Kang's avatar
    gdiplus: Avoid copying GpImage's busy flag in select_frame_wic(). · 7abca974
    Jinoh Kang authored
    The 'busy' field in GpImage is used as an atomic variable.  The C11
    standard (§5.1.2.4, paragraph 25) states that two conflicting actions to
    a memory location shall be both atomic operations, or otherwise properly
    synchronized; otherwise, it constitutes a data race.
    
    However, select_frame_wic() performs a non-atomic access to the 'busy'
    field on a GpImage that is potentially accessible by other threads.
    This happens when select_frame_wic() copies new_image to the old image
    object.  Although it does attempt to preserve the value of the 'busy'
    field by setting new_image->busy = image->busy first, thereby
    effectively assigning an identical value to the field, it is unclear
    that this does not actually constitute a theoretical, if not practical,
    data race.  This also prevents replacing the busy flag with a mutex or
    other synchronization primitives.
    
    Therefore, skip the 'busy' field when copying fields from the new image
    to the original image object.
    7abca974
Name
Last commit
Last update
dlls Loading commit data...
documentation Loading commit data...
fonts Loading commit data...
include Loading commit data...
libs Loading commit data...
loader Loading commit data...
nls Loading commit data...
po Loading commit data...
programs Loading commit data...
server Loading commit data...
tools Loading commit data...
.editorconfig Loading commit data...
.gitlab-ci.yml Loading commit data...
.mailmap Loading commit data...
ANNOUNCE Loading commit data...
AUTHORS Loading commit data...
COPYING.LIB Loading commit data...
LICENSE Loading commit data...
LICENSE.OLD Loading commit data...
MAINTAINERS Loading commit data...
README Loading commit data...
VERSION Loading commit data...
aclocal.m4 Loading commit data...
configure Loading commit data...
configure.ac Loading commit data...