From 65f5033702780ce355749b09644df57c5305db33 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Wed, 3 Mar 2021 15:25:28 +0100 Subject: [PATCH] dwrite: Do not segfault when there are no typographic features to return. Signed-off-by: Giovanni Mascellani Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/dwrite/shape.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/dwrite/shape.c b/dlls/dwrite/shape.c index 6428bf6ceb0..abeb7eeac79 100644 --- a/dlls/dwrite/shape.c +++ b/dlls/dwrite/shape.c @@ -372,6 +372,12 @@ HRESULT shape_get_typographic_features(struct scriptshaping_context *context, co shape_get_script_lang_index(context, scripts, MS_GPOS_TAG, &script_index, &language_index); opentype_get_typographic_features(&context->cache->gpos, script_index, language_index, &t); + if (t.count == 0) + { + *actual_tagcount = 0; + return S_OK; + } + /* Sort and remove duplicates. */ qsort(t.tags, t.count, sizeof(*t.tags), tag_array_sorting_compare);