[PATCH v2] dwrite: Do not segfault when there are no typographic features to return.
Giovanni Mascellani
gmascellani at codeweavers.com
Wed Mar 3 07:35:31 CST 2021
Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
---
dlls/dwrite/shape.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/dlls/dwrite/shape.c b/dlls/dwrite/shape.c
index 6428bf6ceb0..809e66ebedb 100644
--- a/dlls/dwrite/shape.c
+++ b/dlls/dwrite/shape.c
@@ -372,6 +372,14 @@ 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);
+ /* Return immediately if there are not features, because the
+ duplicate removal algorithm doesn't like an empty array. */
+ if (t.count == 0)
+ {
+ heap_free(t.tags);
+ return S_OK;
+ }
+
/* Sort and remove duplicates. */
qsort(t.tags, t.count, sizeof(*t.tags), tag_array_sorting_compare);
--
2.30.1
More information about the wine-devel
mailing list