without freetype, some calling return failed, so some value may not be initialized (it initialize by some failed calling and pass argument by point of it), it would cause random crash!
Signed-off-by: Fan WenJie fanwj@mail.ustc.edu.cn
From: Fan WenJie fanwj@mail.ustc.edu.cn
Signed-off-by: Fan WenJie fanwj@mail.ustc.edu.cn --- dlls/win32u/sysparams.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 9a06db2c7f6..9a885d182aa 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -4323,13 +4323,16 @@ LONG get_char_dimensions( HDC hdc, TEXTMETRICW *metric, int *height ) 'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H', 'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
- if (metric && !NtGdiGetTextMetricsW( hdc, metric, 0 )) return 0; + if (metric && !NtGdiGetTextMetricsW( hdc, metric, 0 )) goto fail;
if (!NtGdiGetTextExtentExW( hdc, abcdW, ARRAYSIZE(abcdW), 0, NULL, NULL, &sz, 0 )) - return 0; + goto fail;
if (height) *height = sz.cy; return (sz.cx / 26 + 1) / 2; +fail: + if (height) *height = 1; + return 0; }
/* get text metrics and/or "average" char width of the specified logfont @@ -4340,6 +4343,7 @@ static void get_text_metr_size( HDC hdc, LOGFONTW *lf, TEXTMETRICW *metric, UINT TEXTMETRICW tm; UINT ret; if (!metric) metric = &tm; + memset(metric, 0, sizeof(*metric)); hfont = NtGdiHfontCreate( lf, sizeof(*lf), 0, 0, NULL ); if (!hfont || !(hfontsav = NtGdiSelectFont( hdc, hfont ))) {