[0.4.7][WIN32SS] Fix BSOD CORE-15433 and repeatedly hit assert CORE-14755
authorJoachim Henze <Joachim.Henze@reactos.org>
Fri, 11 Dec 2020 00:08:55 +0000 (01:08 +0100)
committerJoachim Henze <Joachim.Henze@reactos.org>
Fri, 11 Dec 2020 00:08:55 +0000 (01:08 +0100)
CORE-15433 "Fix assertless BSOD when Opera 12.18 browses duckduckgo.com"
fix ported from 0.4.12-dev-20-g 43e2089 (I ported it back earlier into 0.4.11-RC-7-g 7d0eadd already)

CORE-14775 Allow NULL, Fix repeatedly hit assert when Opera 12.18 browses www.palemoon.org style_name==NULL
by taking parts only of the fix from 0.4.10-dev-284-g ae8762e . I left the verbosed debug-prints aside, as that is not performance-neutral.

They are both related. Actually style_name == NULL is ok, that assert was not correct.
but some of the code was just not handling it properly and dereferenced it.

win32ss/gdi/ntgdi/freetype.c

index 5865868..a85158f 100644 (file)
@@ -910,7 +910,8 @@ IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont,
     Status = RtlAnsiStringToUnicodeString(&Entry->FaceName, &AnsiString, TRUE);
     if (NT_SUCCESS(Status))
     {
-        if (Face->style_name[0] && strcmp(Face->style_name, "Regular"))
+        if (Face->style_name && Face->style_name[0] &&
+            strcmp(Face->style_name, "Regular") != 0)
         {
             RtlInitAnsiString(&AnsiString, Face->style_name);
             Status = RtlAnsiStringToUnicodeString(&Entry->StyleName, &AnsiString, TRUE);
@@ -4057,7 +4058,6 @@ GetFontPenalty(const LOGFONTW *               LogFont,
 
     ASSERT(Otm);
     ASSERT(LogFont);
-    ASSERT(style_name);
 
     /* FIXME: Aspect Penalty 30 */
     /* FIXME: IntSizeSynth Penalty 20 */