From e41c0acc0c16713d23c926f8442e651e034f99db Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Mon, 18 Sep 2006 19:00:44 +0900 Subject: [PATCH] gdi: If there is no space for strings GetOutlineTextMetricsA should not indicate that they present. --- dlls/gdi/font.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dlls/gdi/font.c b/dlls/gdi/font.c index a4327de29b2..42b4925e736 100644 --- a/dlls/gdi/font.c +++ b/dlls/gdi/font.c @@ -1483,6 +1483,20 @@ UINT WINAPI GetOutlineTextMetricsA( if(output != lpOTM) { memcpy(lpOTM, output, cbData); HeapFree(GetProcessHeap(), 0, output); + + /* check if the string offsets really fit into the provided size */ + /* FIXME: should we check string length as well? */ + if ((UINT_PTR)lpOTM->otmpFamilyName >= lpOTM->otmSize) + lpOTM->otmpFamilyName = 0; /* doesn't fit */ + + if ((UINT_PTR)lpOTM->otmpFaceName >= lpOTM->otmSize) + lpOTM->otmpFaceName = 0; /* doesn't fit */ + + if ((UINT_PTR)lpOTM->otmpStyleName >= lpOTM->otmSize) + lpOTM->otmpStyleName = 0; /* doesn't fit */ + + if ((UINT_PTR)lpOTM->otmpFullName >= lpOTM->otmSize) + lpOTM->otmpFullName = 0; /* doesn't fit */ } end: