[WIN32SS][NTGDI] Improve IntGetOutlineTextMetrics (#1760)

Improve size checking of IntGetOutlineTextMetrics function.
This commit is contained in:
Katayama Hirofumi MZ 2019-08-02 20:28:30 +09:00 committed by GitHub
parent 44cddadba8
commit 7547757892
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2304,22 +2304,30 @@ IntGetOutlineTextMetrics(PFONTGDI FontGDI,
Cache = &SharedFace->UserLanguage; Cache = &SharedFace->UserLanguage;
} }
if (Cache->OutlineRequiredSize && Size < Cache->OutlineRequiredSize) if (Size == 0 && Cache->OutlineRequiredSize > 0)
{ {
ASSERT(Otm == NULL);
return Cache->OutlineRequiredSize; return Cache->OutlineRequiredSize;
} }
IntInitFontNames(&FontNames, SharedFace); IntInitFontNames(&FontNames, SharedFace);
Cache->OutlineRequiredSize = FontNames.OtmSize;
if (!Cache->OutlineRequiredSize) if (Size == 0)
{ {
Cache->OutlineRequiredSize = FontNames.OtmSize; ASSERT(Otm == NULL);
IntFreeFontNames(&FontNames);
return Cache->OutlineRequiredSize;
} }
ASSERT(Otm != NULL);
if (Size < Cache->OutlineRequiredSize) if (Size < Cache->OutlineRequiredSize)
{ {
DPRINT1("Size %u < OutlineRequiredSize %u\n", Size,
Cache->OutlineRequiredSize);
IntFreeFontNames(&FontNames); IntFreeFontNames(&FontNames);
return Cache->OutlineRequiredSize; return 0; /* failure */
} }
XScale = Face->size->metrics.x_scale; XScale = Face->size->metrics.x_scale;