gdi32: Check for NULL pointer in GetOutlineTextMetrics.

This commit is contained in:
Daniel Lehman 2015-07-20 16:38:05 -07:00 committed by Alexandre Julliard
parent 5c000dca57
commit 22c51eeabf
2 changed files with 6 additions and 1 deletions

View file

@ -7722,7 +7722,7 @@ static UINT freetype_GetOutlineTextMetrics( PHYSDEV dev, UINT cbSize, OUTLINETEX
if (physdev->font->potm || get_outline_text_metrics( physdev->font ))
{
if(cbSize >= physdev->font->potm->otmSize)
if(potm && cbSize >= physdev->font->potm->otmSize)
{
memcpy(potm, physdev->font->potm, physdev->font->potm->otmSize);
scale_outline_font_metrics(physdev->font, potm);

View file

@ -2147,6 +2147,11 @@ static void test_GetOutlineTextMetrics(void)
}
ok(otm->otmpFullName == unset_ptr, "expected %p got %p\n", unset_ptr, otm->otmpFullName);
/* check handling of NULL pointer */
SetLastError(0xdeadbeef);
ret = GetOutlineTextMetricsA(hdc, otm_size, NULL);
ok(ret == otm_size, "expected %u, got %u, error %d\n", otm_size, ret, GetLastError());
HeapFree(GetProcessHeap(), 0, otm);
SelectObject(hdc, hfont_old);