Francois Gouget : gdiplus/tests: Fix a font test crash when "MS Shell Dlg" is not found.

Alexandre Julliard julliard at winehq.org
Fri Aug 27 15:03:35 CDT 2021


Module: wine
Branch: master
Commit: 53371cc55666fb9805aaeb6bef42b7baf410b15c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=53371cc55666fb9805aaeb6bef42b7baf410b15c

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Thu Aug 26 16:40:05 2021 +0200

gdiplus/tests: Fix a font test crash when "MS Shell Dlg" is not found.

When "MS Shell Dlg" is missing GdipCreateFontFamilyFromName() leaves
the GpFontFamily* pointer uninitialised. So initialize it to NULL in
order to get clean failures instead of a crash.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Esme Povirk <esme at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdiplus/tests/font.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c
index 4ffa9e823fc..031e4688c6c 100644
--- a/dlls/gdiplus/tests/font.c
+++ b/dlls/gdiplus/tests/font.c
@@ -883,8 +883,10 @@ static void test_font_substitution(void)
     ok(lstrcmpA(lf.lfFaceName, "MS Shell Dlg") != 0, "expected substitution of MS Shell Dlg\n");
     GdipDeleteFont(font);
 
+    family = NULL;
     status = GdipCreateFontFamilyFromName(L"MS Shell Dlg", NULL, &family);
     expect(Ok, status);
+    font = NULL;
     status = GdipCreateFont(family, 12, FontStyleRegular, UnitPoint, &font);
     expect(Ok, status);
     memset(&lf, 0xfe, sizeof(lf));




More information about the wine-cvs mailing list