[PATCH] gdi32: Handle 0 count in GetCharacterPlacementW.

Huw Davies huw at codeweavers.com
Fri Feb 14 04:13:13 CST 2020


On Thu, Feb 13, 2020 at 05:13:43PM +0100, Sven Baars wrote:
> Signed-off-by: Sven Baars <sbaars at codeweavers.com>
> ---
>  dlls/gdi32/font.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
> index d451f30c3e..8788426a2c 100644
> --- a/dlls/gdi32/font.c
> +++ b/dlls/gdi32/font.c
> @@ -3313,6 +3313,9 @@ GetCharacterPlacementW(
>      TRACE("%s, %d, %d, 0x%08x\n",
>            debugstr_wn(lpString, uCount), uCount, nMaxExtent, dwFlags);
>  
> +    if (!uCount)
> +        return 0;
> +
>      if (!lpResults)
>          return GetTextExtentPoint32W(hdc, lpString, uCount, &size) ? MAKELONG(size.cx, size.cy) : 0;

Some tests would be good.  As well as testing the return value, one might also
test if anything is updated in 'lpResults'.

Huw.



More information about the wine-devel mailing list