[PATCH 0/1] MR10933: kernelbase: Add null check for str in OutputDebugStringW
The following code crashes wine but seems to be OK in Windows: ``` #include <windows.h> int main() { OutputDebugStringW(NULL); return 0; } ``` The MR aligns behavior of `OutputDebugStringW` to Windows by adding a null check and bailing out of `OutputDebugStringW`. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10933
From: Matthias Gorzellik <matthias.gorzellik@gmail.com> --- dlls/kernelbase/debug.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/kernelbase/debug.c b/dlls/kernelbase/debug.c index a600b6b59c9..8656859b7bb 100644 --- a/dlls/kernelbase/debug.c +++ b/dlls/kernelbase/debug.c @@ -281,6 +281,7 @@ void WINAPI DECLSPEC_HOTPATCH OutputDebugStringW( LPCWSTR str ) STRING strA; WARN( "%s\n", debugstr_w(str) ); + if (!str) return; RtlInitUnicodeString( &strW, str ); if (!RtlUnicodeStringToAnsiString( &strA, &strW, TRUE )) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10933
Jinoh Kang (@iamahuman) commented about dlls/kernelbase/debug.c:
STRING strA;
WARN( "%s\n", debugstr_w(str) ); + if (!str) return;
This would need tests. Is NULL string skipped entirely? Or coerced to empty (but valud) string and passed to the debugger regardless. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10933#note_140358
participants (3)
-
Jinoh Kang (@iamahuman) -
Matthias Gorzellik -
Matthias Gorzellik (@gotzl)