Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive on Win API WS2_32 calls #2477

Open
DavidPerretSN opened this issue Dec 19, 2022 · 0 comments
Open

False positive on Win API WS2_32 calls #2477

DavidPerretSN opened this issue Dec 19, 2022 · 0 comments

Comments

@DavidPerretSN
Copy link

DavidPerretSN commented Dec 19, 2022

Describe the bug
Although I found here some past issues telling that these reports where "false positives" and fixed around 2015, it seems that simple programs using windows sockets and file API still reports "UNINITIALIZED READ"

To Reproduce
Create a new cmake project in MSVC 2022 17.4.3, using Win10 SDK and edit the cmakelists.txt to link on ws2_32 library

Compile the following program

#define WIN32_LEAN_AND_MEAN

#include <ws2tcpip.h>

int main()
{
	WSAData wsaData;
	WSAStartup(MAKEWORD(2, 2), &wsaData);
	WSACleanup();
	return 0;
}

Output is :

Error #1: UNINITIALIZED READ: reading register eax
# 0 WS2_32.dll!WSALookupServiceNextW   +0x23f1   (0x00007ff805ceded1 <WS2_32.dll+0xded1>)
# 1 WS2_32.dll!WSALookupServiceNextW   +0x2ffd   (0x00007ff805ceeade <WS2_32.dll+0xeade>)
# 2 WS2_32.dll!WSAStartup              +0x33c    (0x00007ff805ceee4d <WS2_32.dll+0xee4d>)
# 3 main                                [C:\Users\...\source\repos\WinSocketsCalls\WinSocketsCalls.cpp:17]
Note: @0:00:00.262 in thread 26452
Note: instruction: cmp    %eax %r12d

Error #2: UNINITIALIZED READ: reading register eflags
# 0 WS2_32.dll!WSALookupServiceNextW   +0x240f   (0x00007ff805cedeef <WS2_32.dll+0xdeef>)
# 1 WS2_32.dll!WSALookupServiceNextW   +0x2ffd   (0x00007ff805ceeade <WS2_32.dll+0xeade>)
# 2 WS2_32.dll!WSAStartup              +0x33c    (0x00007ff805ceee4d <WS2_32.dll+0xee4d>)
# 3 main                                [C:\Users\...\source\repos\WinSocketsCalls\WinSocketsCalls.cpp:17]
Note: @0:00:00.263 in thread 26452
Note: instruction: cmovo  %r13 -> %rax

Error #3: UNINITIALIZED READ: reading 0x000000ef7b5af940-0x000000ef7b5af944 4 byte(s) within 0x000000ef7b5af940-0x000000ef7b5af948
# 0 replace_memset                      [D:\a\drmemory\drmemory\drmemory\replace.c:194]
# 1 WS2_32.dll!WSALookupServiceNextW   +0x2448   (0x00007ff805cedf29 <WS2_32.dll+0xdf29>)
# 2 WS2_32.dll!WSALookupServiceNextW   +0x2ffd   (0x00007ff805ceeade <WS2_32.dll+0xeade>)
# 3 WS2_32.dll!WSAStartup              +0x33c    (0x00007ff805ceee4d <WS2_32.dll+0xee4d>)
# 4 main                                [C:\Users\...\source\repos\WinSocketsCalls\WinSocketsCalls.cpp:17]
Note: @0:00:00.277 in thread 26452
Note: instruction: cmp    0x30(%rsp) $0x0000000000000003

Expected behavior
This program should be valid and no errors should be reported

Versions

  • What version of Dr. Memory are you using?
    Dr. Memory version 2.5.19327 build 0 built on Dec 1 2022 15:38:39

  • What operating system version are you running on? ("Windows 10" is not sufficient: give the release number.)
    Windows version: WinVer=105;Rel=2009;Build=19042;Edition=Enterprise

  • Is your application 32-bit or 64-bit?
    64 bits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant