-- v2: mlang: Check handle validity in IMLangFontLink_GetFontCodePages.
From: Haoyang Chen chenhaoyang@kylinos.cn
--- dlls/mlang/mlang.c | 3 +++ dlls/mlang/tests/mlang.c | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+)
diff --git a/dlls/mlang/mlang.c b/dlls/mlang/mlang.c index 9f7d1159e57..3ff3c8b34bb 100644 --- a/dlls/mlang/mlang.c +++ b/dlls/mlang/mlang.c @@ -3471,7 +3471,10 @@ static HRESULT WINAPI fnIMLangFontLink2_GetFontCodePages(IMLangFontLink2 *iface,
TRACE("(%p)->(%p %p %p)\n", This, hdc, hfont, codepages);
+ if (codepages) *codepages = 0; + old_font = SelectObject(hdc, hfont); + if (!old_font) return E_FAIL; GetTextCharsetInfo(hdc, &fontsig, 0); SelectObject(hdc, old_font);
diff --git a/dlls/mlang/tests/mlang.c b/dlls/mlang/tests/mlang.c index 42847406eb8..83caaf163a6 100644 --- a/dlls/mlang/tests/mlang.c +++ b/dlls/mlang/tests/mlang.c @@ -2809,6 +2809,24 @@ static void test_MapFont(IMLangFontLink *font_link, IMLangFontLink2 *font_link2) ok((codepages & (~font_codepages)) != 0 && (codepages & font_codepages) != 0, "code pages of font is incorrect\n");
+ font_codepages = 1; + ret = IMLangFontLink_GetFontCodePages(font_link, NULL, font1, &font_codepages); + ok(ret == E_FAIL && !font_codepages, "expected E_FAIL, but got: %lx, font_codepages:%lx \n", + ret, font_codepages); + font_codepages = 2; + ret = IMLangFontLink_GetFontCodePages(font_link, hdc, NULL, &font_codepages); + ok(ret == E_FAIL && !font_codepages, "expected E_FAIL, but got: %lx, font_codepages:%lx \n", + ret, font_codepages); + + font_codepages = 3; + ret = IMLangFontLink_GetFontCodePages(font_link, (void*)0xabc, font1, &font_codepages); + ok(ret == E_FAIL && !font_codepages, "expected E_FAIL, but got: %lx, font_codepages:%lx \n", + ret, font_codepages); + font_codepages = 4; + ret = IMLangFontLink_GetFontCodePages(font_link, hdc, (void*)0x123456, &font_codepages); + ok(ret == E_FAIL && !font_codepages, "expected E_FAIL, but got: %lx, font_codepages:%lx \n", + ret, font_codepages); + IMLangFontLink_ResetFontMapping(font_link); IMLangFontLink2_ResetFontMapping(font_link2); ReleaseDC(NULL, hdc);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=148965
Your paranoid android.
=== w1064v1507 (32 bit report) ===
mlang: mlang.c:2805: Test failed: expected !NULL/!NULL, got 00000000/2E0A0556
=== w1064v1507 (64 bit report) ===
mlang: mlang.c:2805: Test failed: expected !NULL/!NULL, got 0000000000000000/00000000250A0529
=== debian11b (64 bit WoW report) ===
user32: input.c:5944: Test failed: got pos (49,51)