https://bugs.winehq.org/show_bug.cgi?id=54192
Bug ID: 54192 Summary: user32:clipboard - SetClipboardData() fails on Windows 11 for size < sizeof(WCHAR) Product: Wine Version: unspecified Hardware: x86-64 OS: Windows Status: NEW Severity: normal Priority: P2 Component: user32 Assignee: wine-bugs@winehq.org Reporter: fgouget@codeweavers.com
user32:clipboard - SetClipboardData() fails on Windows 11 for size < sizeof(WCHAR):
clipboard.c:2267: Test failed: 8: wrong data L"f" clipboard.c:2308: Test failed: 8: could not get data clipboard.c:2310: Test failed: 8: wrong size 0 / 1 clipboard.c:2329: Test failed: 8: text not available
See https://test.winehq.org/data/patterns.html#user32:clipboard
In previous Windows versions it would happily terminate the Unicode string with a single NUL character (at least it's not overflowing the buffer).
Also test_string_data() treats the buffer as a Unicode string, at least when dumping it in failure cases, which it is clearly not when it's an odd number of bytes, particularly a single byte. This results in random data going into the output making it look like the failure is always new:
clipboard.c:2267: Test failed: 8: wrong data L"\7866"