[PATCH 4/4] dwrite: Always initialize output glyph count in GetGlyphs().

Nikolay Sivov nsivov at codeweavers.com
Tue Feb 16 03:48:41 CST 2021


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/dwrite/analyzer.c       | 2 ++
 dlls/dwrite/tests/analyzer.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c
index 53fb18df4c9..d0d769cb346 100644
--- a/dlls/dwrite/analyzer.c
+++ b/dlls/dwrite/analyzer.c
@@ -1188,6 +1188,8 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphs(IDWriteTextAnalyzer2 *iface,
     context.glyph_infos = heap_calloc(glyph_count, sizeof(*context.glyph_infos));
     context.table = &context.cache->gsub;
 
+    *actual_glyph_count = 0;
+
     scriptprops = &dwritescripts_properties[context.script];
     hr = shape_get_glyphs(&context, scriptprops->scripttags);
     if (SUCCEEDED(hr))
diff --git a/dlls/dwrite/tests/analyzer.c b/dlls/dwrite/tests/analyzer.c
index 6dd251270c7..d4889e5aa63 100644
--- a/dlls/dwrite/tests/analyzer.c
+++ b/dlls/dwrite/tests/analyzer.c
@@ -1628,11 +1628,13 @@ static void test_GetGlyphs(void)
     fontface = create_fontface();
 
     maxglyphcount = 1;
+    actual_count = 1;
     sa.script = 0;
     sa.shapes = DWRITE_SCRIPT_SHAPES_DEFAULT;
     hr = IDWriteTextAnalyzer_GetGlyphs(analyzer, test1W, lstrlenW(test1W), fontface, FALSE, FALSE, &sa, NULL,
         NULL, NULL, NULL, 0, maxglyphcount, clustermap, props, glyphs1, shapingprops, &actual_count);
     ok(hr == E_NOT_SUFFICIENT_BUFFER, "got 0x%08x\n", hr);
+    ok(actual_count == 0, "Unexpected count value %u.\n", actual_count);
 
 if (0) {
     /* NULL fontface - crashes on Windows */
-- 
2.30.0




More information about the wine-devel mailing list