[PATCH] gdi32/tests: Check array index limit first.

Huw Davies huw at codeweavers.com
Mon May 14 02:36:17 CDT 2018


On Fri, May 11, 2018 at 07:57:37PM +0300, Andrey Gusev wrote:
> Signed-off-by: Andrey Gusev <andrey.goosev at gmail.com>
> ---
>  dlls/gdi32/tests/font.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
> index 6243a6d339..2b214a07aa 100644
> --- a/dlls/gdi32/tests/font.c
> +++ b/dlls/gdi32/tests/font.c
> @@ -202,7 +202,7 @@ static void check_font(const char* test, const LOGFONTA* lf, HFONT hfont)
>  
>      ret = GetObjectA(hfont, sizeof(getobj_lf), &getobj_lf);
>      /* NT4 tries to be clever and only returns the minimum length */
> -    while (lf->lfFaceName[minlen] && minlen < LF_FACESIZE-1)
> +    while (minlen < LF_FACESIZE-1 && lf->lfFaceName[minlen])
>          minlen++;
>      minlen += FIELD_OFFSET(LOGFONTA, lfFaceName) + 1;
>      ok(ret == sizeof(LOGFONTA) || ret == minlen, "%s: GetObject returned %d\n", test, ret);

Actually this workaround for NT4 could be removed completely, along
with other workarounds, further down in the function, for win9x.

Huw.



More information about the wine-devel mailing list