If there is no space for strings GetOutlineTextMetricsA should not
indicate that they present
Dmitry Timoshkov
dmitry at codeweavers.com
Mon Sep 18 05:00:44 CDT 2006
Hello,
this patch prevents my test application from crashing by dereferencing
memory beyond allocated memory block.
Changelog:
If there is no space for strings GetOutlineTextMetricsA should not
indicate that they present.
--- cvs/hq/wine/dlls/gdi/font.c 2006-08-15 14:51:46.000000000 +0900
+++ wine/dlls/gdi/font.c 2006-09-18 18:38:57.000000000 +0900
@@ -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:
More information about the wine-patches
mailing list