https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7547757892c3543354dd2…
commit 7547757892c3543354dd2b8e6de5f5a055c7ad1b
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Fri Aug 2 20:28:30 2019 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Fri Aug 2 20:28:30 2019 +0900
[WIN32SS][NTGDI] Improve IntGetOutlineTextMetrics (#1760)
Improve size checking of IntGetOutlineTextMetrics function.
---
win32ss/gdi/ntgdi/freetype.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/win32ss/gdi/ntgdi/freetype.c b/win32ss/gdi/ntgdi/freetype.c
index 37ff3fbf5a7..d31178d3f2e 100644
--- a/win32ss/gdi/ntgdi/freetype.c
+++ b/win32ss/gdi/ntgdi/freetype.c
@@ -2304,22 +2304,30 @@ IntGetOutlineTextMetrics(PFONTGDI FontGDI,
Cache = &SharedFace->UserLanguage;
}
- if (Cache->OutlineRequiredSize && Size <
Cache->OutlineRequiredSize)
+ if (Size == 0 && Cache->OutlineRequiredSize > 0)
{
+ ASSERT(Otm == NULL);
return Cache->OutlineRequiredSize;
}
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)
{
+ DPRINT1("Size %u < OutlineRequiredSize %u\n", Size,
+ Cache->OutlineRequiredSize);
IntFreeFontNames(&FontNames);
- return Cache->OutlineRequiredSize;
+ return 0; /* failure */
}
XScale = Face->size->metrics.x_scale;