[PATCH 0/1] 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) -- 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 | 13 +++++++++++++ dlls/comctl32_v6/syslink.c | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/dlls/comctl32/tests/syslink.c b/dlls/comctl32/tests/syslink.c index 1cd9414249c..3e68d273f03 100644 --- a/dlls/comctl32/tests/syslink.c +++ b/dlls/comctl32/tests/syslink.c @@ -333,6 +333,19 @@ 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 + { + ok(sz.cx >= 1, "Unexpected ideal width, %ld >= 1.\n", sz.cx); + ok(sz.cx < 100, "Unexpected ideal width, %ld < 100.\n", sz.cx); + ok(sz.cy == ret, "Unexpected ideal height, %ld.\n", sz.cy); + } + DestroyWindow(hwnd); } diff --git a/dlls/comctl32_v6/syslink.c b/dlls/comctl32_v6/syslink.c index 36f7edfca38..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++; @@ -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
participants (2)
-
Bernhard Übelacker -
Bernhard Übelacker (@bernhardu)