If there is no space for strings GetOutlineTextMetricsA should not indicate that they present

Paul Vriens Paul.Vriens at xs4all.nl
Mon Sep 18 05:11:23 CDT 2006


On Mon, 2006-09-18 at 19:00 +0900, Dmitry Timoshkov wrote:
> 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:
this one also fixes an issue I was looking into this morning:

Try to create a key via regedit with the name
{44444444-4444-4444-44444444} and press enter.

Cheers and thanks,

Paul.




More information about the wine-devel mailing list