[PATCH 1/3] dwrite: Don't crash on uninitialized cached and factory fields in dwritefontface_Release
bunglehead at gmail.com
Thu Apr 27 09:18:02 CDT 2017
On 27.04.2017 17:03, Piotr Caban wrote:
> The function may be called with the fields uninitialized from
> create_fontface when init_font_data fails.
> Signed-off-by: Piotr Caban <piotr at codeweavers.com>
> dlls/dwrite/font.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
> - factory_release_cached_fontface(This->cached);
> - IDWriteFactory4_Release(This->factory);
> + if (This->cached)
> + factory_release_cached_fontface(This->cached);
> + if (This->factory)
> + IDWriteFactory4_Release(This->factory);
Yes, this makes sense. The problem with this change is that 'cached' and
'factory' are not necessarily NULL on this failure path. I think at this
point it would be better to use heap_alloc_zero(), and remove all
explicit 0 initialization from create_fontface().
By the way, did you check why init_font_data() fails? If it's because
opentype_get_font_familyname() fails, I'm interested in a log, or font
file that causes it.
More information about the wine-devel