DynamoRIO / DynamoRIO/drmemory
NtUserGetCursorInfo overwrites cb_size during syscall
- Dominant language
- C
- Stars
- 2.7k
- Forks
- 290
- PR merge metrics
- No merged PRs in 30d
Description
_From [rnk@google.com](https://code.google.com/u/rnk@google.com/) on August 28, 2012 13:37:38_
This occurs in Chrome's remote_unittests VideoFrameCapturerTest.Capture.
MSDN docs say the struct looks like:
typedef struct {
DWORD cbSize;
DWORD flags;
HCURSOR hCursor;
POINT ptScreenPos;
} CURSORINFO; http://msdn.microsoft.com/en-us/library/windows/desktop/ms648389(v=vs.85).aspx http://msdn.microsoft.com/en-us/library/windows/desktop/ms648381(v=vs.85).aspx cbSize has to be initialized to sizeof(CURSORINFO).
Here is the struct before and after the syscall:
NtUserGetCursorInfo pre
NtUserGetCursorInfo 0x0018fc0c: 0x00000014 # cbSize
NtUserGetCursorInfo 0x0018fc10: 0x042416a8 # uninits
NtUserGetCursorInfo 0x0018fc14: 0x042416b0
NtUserGetCursorInfo 0x0018fc18: 0x0018fc24
NtUserGetCursorInfo pre
NtUserGetCursorInfo 0x0018fc0c: 0x00000000 # cbSize set to 0
NtUserGetCursorInfo 0x0018fc10: 0x00000001
NtUserGetCursorInfo 0x0018fc14: 0x00010003
NtUserGetCursorInfo 0x0018fc18: 0x00000263
Currently our support for SYSARG_SIZE_IN_FIELD does not read and save the size across the syscall, it relies on it being untouched after the syscall. With a zero size, we don't consider this struct written, and have uninits later:
~~Dr.M~~ Error `#1`: UNINITIALIZED READ: reading 0x0018f55c-0x0018f560 4 byte(s) within 0x0018f55c-0x0018f560
~~Dr.M~~ # 0 system call NtUserGetIconInfo parameter value `#0`
~~Dr.M~~ # 1 remoting::`anonymous namespace'::VideoFrameCapturerWin::CaptureCursor [src\remoting\host\video_frame_capturer_win.cc:406]
\~~Dr.M~~ # 2 remoting::`anonymous namespace'::VideoFrameCapturerWin::CaptureInvalidRegion [src\remoting\host\video_frame_capturer_win.cc:179]
~~Dr.M~~ # 3 remoting::VideoFrameCapturerTest_Capture_Test::TestBody [src\remoting\host\video_frame_capturer_unittest.cc:58]
_Original issue: http://code.google.com/p/drmemory/issues/detail?id=992_
Contributor guide
Assessment
This issue has not been assessed yet.