From 6f99f196fc0bf48583a45ef1114e8a571f4dc3a6 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Wed, 3 Jun 2015 18:57:54 +0300 Subject: [PATCH] dwrite: Fix potential null pointer access in GetFontCollection() (Coverity). --- dlls/dwrite/layout.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index 365f0b238a3..8f4243387e1 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -1863,8 +1863,11 @@ static HRESULT WINAPI dwritetextlayout_layout_GetFontCollection(IDWriteTextLayou TRACE("(%p)->(%u %p %p)\n", This, position, collection, r); + if (position >= This->len) + return S_OK; + range = get_layout_range_by_pos(This, position); - *collection = range ? range->collection : NULL; + *collection = range->collection; if (*collection) IDWriteFontCollection_AddRef(*collection);