[PATCH v3 0/3] MR11623: comctl32_v6: Avoid wrong return value for a single space in SYSLINK_Render.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59944 If a syslink control contains just a sinlge space currently unintialized values got returned in `SYSLINK_Render`. ~~Because this failure depends on memory initialization I did not split this patch.~~ [Testbot run with this patch](https://testbot.winehq.org/JobDetails.pl?Key=163972) -- v3: comctl32_v6: Fix SYSLINK_Render for a single space. comctl32_v6: Avoid uninitialized value for a single space in SYSLINK_Render. comctl32/tests: Add test for LM_GETIDEALSIZE for syslink with empty text. https://gitlab.winehq.org/wine/wine/-/merge_requests/11623
From: Bernhard Übelacker <bernhardu@mailbox.org> --- dlls/comctl32/tests/syslink.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/dlls/comctl32/tests/syslink.c b/dlls/comctl32/tests/syslink.c index 1cd9414249c..3dbf3d9bb58 100644 --- a/dlls/comctl32/tests/syslink.c +++ b/dlls/comctl32/tests/syslink.c @@ -333,6 +333,25 @@ static void test_LM_GETIDEALSIZE(void) ok(sz.cx > sz.cy, "Expected sz.cx > sz.cy (%ld > %ld).\n", sz.cx, sz.cy); } + ret = SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)" "); + ok(ret, "Unexpected return value, %ld.\n", ret); + sz.cx = sz.cy = -1; + ret = SendMessageA(hwnd, LM_GETIDEALSIZE, 0, (LPARAM)&sz); + if (sz.cy == -1) + win_skip("LM_GETIDEALSIZE is not supported.\n"); + else + { + todo_wine_if(sz.cx < 1) + ok(sz.cx >= 1, "Unexpected ideal width, %ld >= 1.\n", sz.cx); + todo_wine_if(sz.cx >= 100) + ok(sz.cx < 100, "Unexpected ideal width, %ld < 100.\n", sz.cx); + todo_wine_if(sz.cy < 1) + ok(sz.cy >= 1, "Unexpected ideal height, %ld < 100.\n", sz.cy); + todo_wine_if(sz.cy >= 100) + ok(sz.cy < 100, "Unexpected ideal height, %ld < 100.\n", sz.cy); + ok(sz.cy == ret, "Unexpected ideal height, %ld.\n", sz.cy); + } + DestroyWindow(hwnd); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11623
From: Bernhard Übelacker <bernhardu@mailbox.org> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59944 --- dlls/comctl32/tests/syslink.c | 6 ++---- dlls/comctl32_v6/syslink.c | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dlls/comctl32/tests/syslink.c b/dlls/comctl32/tests/syslink.c index 3dbf3d9bb58..5728117b884 100644 --- a/dlls/comctl32/tests/syslink.c +++ b/dlls/comctl32/tests/syslink.c @@ -341,13 +341,11 @@ static void test_LM_GETIDEALSIZE(void) win_skip("LM_GETIDEALSIZE is not supported.\n"); else { - todo_wine_if(sz.cx < 1) + todo_wine ok(sz.cx >= 1, "Unexpected ideal width, %ld >= 1.\n", sz.cx); - todo_wine_if(sz.cx >= 100) ok(sz.cx < 100, "Unexpected ideal width, %ld < 100.\n", sz.cx); - todo_wine_if(sz.cy < 1) + todo_wine ok(sz.cy >= 1, "Unexpected ideal height, %ld < 100.\n", sz.cy); - todo_wine_if(sz.cy >= 100) ok(sz.cy < 100, "Unexpected ideal height, %ld < 100.\n", sz.cy); ok(sz.cy == ret, "Unexpected ideal height, %ld.\n", sz.cy); } diff --git a/dlls/comctl32_v6/syslink.c b/dlls/comctl32_v6/syslink.c index 36f7edfca38..5f866ba9a61 100644 --- a/dlls/comctl32_v6/syslink.c +++ b/dlls/comctl32_v6/syslink.c @@ -1235,6 +1235,7 @@ static VOID SYSLINK_Render (const SYSLINK_INFO *infoPtr, HDC hdc, PRECT pRect) } } + szDim.cx = szDim.cy = 0; if((n == 0 && SkipChars != 0) || GetTextExtentExPointW(hdc, tx, n, rc.right - x, &nFit, NULL, &szDim)) { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11623
From: Bernhard Übelacker <bernhardu@mailbox.org> --- dlls/comctl32/tests/syslink.c | 2 -- dlls/comctl32_v6/syslink.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/dlls/comctl32/tests/syslink.c b/dlls/comctl32/tests/syslink.c index 5728117b884..54efa95e1a2 100644 --- a/dlls/comctl32/tests/syslink.c +++ b/dlls/comctl32/tests/syslink.c @@ -341,10 +341,8 @@ static void test_LM_GETIDEALSIZE(void) win_skip("LM_GETIDEALSIZE is not supported.\n"); else { - todo_wine ok(sz.cx >= 1, "Unexpected ideal width, %ld >= 1.\n", sz.cx); ok(sz.cx < 100, "Unexpected ideal width, %ld < 100.\n", sz.cx); - todo_wine ok(sz.cy >= 1, "Unexpected ideal height, %ld < 100.\n", sz.cy); ok(sz.cy < 100, "Unexpected ideal height, %ld < 100.\n", sz.cy); ok(sz.cy == ret, "Unexpected ideal height, %ld.\n", sz.cy); diff --git a/dlls/comctl32_v6/syslink.c b/dlls/comctl32_v6/syslink.c index 5f866ba9a61..e32b064dc4d 100644 --- a/dlls/comctl32_v6/syslink.c +++ b/dlls/comctl32_v6/syslink.c @@ -1227,7 +1227,7 @@ static VOID SYSLINK_Render (const SYSLINK_INFO *infoPtr, HDC hdc, PRECT pRect) SkipChars++; n--; } - while(n > 0 && (*tx) == infoPtr->BreakChar) + while(n > 1 && (*tx) == infoPtr->BreakChar) { tx++; SkipChars++; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11623
v3: ([Testbot run with this version](https://testbot.winehq.org/JobDetails.pl?Key=164042)) - Split first patch into adding test and changing implementation. (Uses todo_wine_if because it is unknown which value the uninitialized memory will return.) -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11623#note_149082
On Tue Aug 11 07:26:43 2026 +0000, Zhiyi Zhang wrote:
Let's put the tests in a separate commit. Hello, sorry for the delay, I was distracted by some other issue. I am not sure if that is the expected way to handle the uninitialized return values in tests.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/11623#note_149092
participants (2)
-
Bernhard Übelacker -
Bernhard Übelacker (@bernhardu)