79331348

Date: 2025-01-05 18:56:35
Score: 1.5
Natty:
Report link

The trouble here is a use-after-free, but a sneaky one. PostMessageW doesn't wait for the message to return, so it goes right through to the next instructions, eventually freeing the memory from the heap and returning 0. By the time handlePaint gets to the command vector, it's already gone, so dereferencing the pointer results in a segfault. Waiting for the message to be processed before continuing fixes the issue. Changing PostMessageW to SendMessageW fixes this.

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Single line (0.5):
  • Low reputation (1):
Posted by: Coarse Rosinflower