Skip to content

Commit 08b9354

Browse files
committed
[WIN32K/USER] Fix callout object referencing in co_IntUpdateWindows
Move UserRefObjectCo, so that it covers co_IntSendMessage as well. This caused a use-after-free during testing.
1 parent 9eca7c5 commit 08b9354

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

win32ss/user/ntuser/painting.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ VOID FASTCALL
519519
co_IntUpdateWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
520520
{
521521
HWND hWnd = UserHMGetHandle(Wnd);
522+
USER_REFERENCE_ENTRY Ref;
522523

523524
if ( Wnd->hrgnUpdate != NULL || Wnd->state & WNDS_INTERNALPAINT )
524525
{
@@ -542,15 +543,15 @@ co_IntUpdateWindows(PWND Wnd, ULONG Flags, BOOL Recurse)
542543
Wnd->state &= ~WNDS_UPDATEDIRTY;
543544

544545
Wnd->state2 |= WNDS2_WMPAINTSENT;
546+
547+
UserRefObjectCo(Wnd, &Ref);
545548
co_IntSendMessage(hWnd, WM_PAINT, 0, 0);
546549

547550
if (Wnd->state & WNDS_PAINTNOTPROCESSED)
548551
{
549-
USER_REFERENCE_ENTRY Ref;
550-
UserRefObjectCo(Wnd, &Ref);
551552
co_IntPaintWindows(Wnd, RDW_NOCHILDREN, FALSE);
552-
UserDerefObjectCo(Wnd);
553553
}
554+
UserDerefObjectCo(Wnd);
554555
}
555556

556557
// Force flags as a toggle. Fixes msg:test_paint_messages:WmChildPaintNc.

0 commit comments

Comments
 (0)