Module: wine Branch: master Commit: 22c51eeabf6f7dcdcdcb6f41d51b1faa8072aead URL: http://source.winehq.org/git/wine.git/?a=commit;h=22c51eeabf6f7dcdcdcb6f41d5...
Author: Daniel Lehman dlehman@esri.com Date: Mon Jul 20 16:38:05 2015 -0700
gdi32: Check for NULL pointer in GetOutlineTextMetrics.
---
dlls/gdi32/freetype.c | 2 +- dlls/gdi32/tests/font.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 9a7a3d7..1187598 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -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); diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index cce4a1f..8595a4a 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -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);