• Zhiyi Zhang's avatar
    win32u: Find the correct DIB driver in windrv_CreateDC(). · 36366f12
    Zhiyi Zhang authored
    push_dc_driver() places drivers based on their priorities, so the newly created driver is not
    necessarily on top. Thus in windrv_CreateDC(), find_dc_driver() should be used to find the DIB
    driver instead of assuming the DIB driver is the top driver, which could be the path driver because
    it has a higher priority.
    
    The exact wrong code path was:
    1. A path driver with priority 400 is created for a DC.
    2. windrv_CreateDC() is called to create a window driver for the DC.
    3. Then in dibdrv_CreateDC(), push_dc_driver() is called with 'dev' pointing to the top driver, which is the path driver.
    4. push_dc_driver() updates 'dev' to point to the address of the next driver because DIB driver has a lower 300 priority.
    5. The DIB driver is assigned to 'dev', which is not the original parameter passed into push_dc_driver().
    6. In windrv_CreateDC(), get_dibdrv_pdev(*dev) is called, assuming the top driver is the DIB driver. But actually the top
       driver that '*dev' points to is still the path driver.
    
    The added tests can demonstrate the memory corruption before this fix is applied.
    36366f12
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...