[WIN32l:NTGDI] -Check the return value IntGetOutlineTextMetrics and stop using garbage from the pool in case of error. CORE-13089, CORE-12752

svn path=/trunk/; revision=74633
This commit is contained in:
Giannis Adamopoulos 2017-05-23 09:40:07 +00:00
parent d7e4f26d1a
commit c04750f246

View file

@ -2264,7 +2264,12 @@ FontFamilyFillInfo(PFONTFAMILYINFO Info, LPCWSTR FaceName,
{
return;
}
IntGetOutlineTextMetrics(FontGDI, Size, Otm);
Size = IntGetOutlineTextMetrics(FontGDI, Size, Otm);
if (!Size)
{
ExFreePoolWithTag(Otm, GDITAG_TEXT);
return;
}
Lf = &Info->EnumLogFontEx.elfLogFont;
TM = &Otm->otmTextMetrics;
@ -3182,7 +3187,14 @@ ftGdiGetGlyphOutline(
TEXTOBJ_UnlockText(TextObj);
return GDI_ERROR;
}
IntGetOutlineTextMetrics(FontGDI, Size, potm);
Size = IntGetOutlineTextMetrics(FontGDI, Size, potm);
if (!Size)
{
/* FIXME: last error? */
ExFreePoolWithTag(potm, GDITAG_TEXT);
TEXTOBJ_UnlockText(TextObj);
return GDI_ERROR;
}
IntLockFreeType;
TextIntUpdateSize(dc, TextObj, FontGDI, FALSE);
@ -4441,7 +4453,10 @@ FindBestFontFromList(FONTOBJ **FontObj, ULONG *MatchPenalty,
/* update FontObj if lowest penalty */
if (Otm)
{
IntGetOutlineTextMetrics(FontGDI, OtmSize, Otm);
OtmSize = IntGetOutlineTextMetrics(FontGDI, OtmSize, Otm);
if (!OtmSize)
continue;
OldOtmSize = OtmSize;
Penalty = GetFontPenalty(LogFont, Otm, Face->style_name);
@ -6467,8 +6482,9 @@ NtGdiGetGlyphIndicesW(
cwc = GDI_ERROR;
goto ErrorRet;
}
IntGetOutlineTextMetrics(FontGDI, Size, potm);
DefChar = potm->otmTextMetrics.tmDefaultChar;
Size = IntGetOutlineTextMetrics(FontGDI, Size, potm);
if (Size)
DefChar = potm->otmTextMetrics.tmDefaultChar;
ExFreePoolWithTag(potm, GDITAG_TEXT);
}
}