Nikolay Sivov : dwrite: Always initialize context and font table pointers.

Alexandre Julliard julliard at winehq.org
Thu Jun 16 03:45:42 CDT 2016


Module: wine
Branch: stable
Commit: b5ca1aaa4fd61d614cd4ccb2df96347d52b10101
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b5ca1aaa4fd61d614cd4ccb2df96347d52b10101

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri Apr  1 08:40:07 2016 +0300

dwrite: Always initialize context and font table pointers.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 7cac7bb99f962e268796fe5f7566d0eaffd09bb6)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/dwrite/opentype.c   | 3 +++
 dlls/dwrite/tests/font.c | 9 +++++++++
 2 files changed, 12 insertions(+)

diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c
index 98e7ab0..4799088 100644
--- a/dlls/dwrite/opentype.c
+++ b/dlls/dwrite/opentype.c
@@ -809,6 +809,9 @@ HRESULT opentype_get_font_table(IDWriteFontFileStream *stream, DWRITE_FONT_FACE_
     if (found) *found = FALSE;
     if (table_size) *table_size = 0;
 
+    *table_data = NULL;
+    *table_context = NULL;
+
     if (type == DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION) {
         const TTC_Header_V1 *ttc_header;
         void * ttc_context;
diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c
index 681f010..e15f168 100644
--- a/dlls/dwrite/tests/font.c
+++ b/dlls/dwrite/tests/font.c
@@ -2725,6 +2725,15 @@ static void test_TryGetFontTable(void)
     IDWriteFontFace_ReleaseFontTable(fontface, context2);
     IDWriteFontFace_ReleaseFontTable(fontface, context);
 
+    /* table does not exist */
+    exists = TRUE;
+    context = (void*)0xdeadbeef;
+    table = (void*)0xdeadbeef;
+    hr = IDWriteFontFace_TryGetFontTable(fontface, 0xabababab, &table, &size, &context, &exists);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(exists == FALSE, "got %d\n", exists);
+    ok(context == NULL && table == NULL, "got context %p, table pointer %p\n", context, table);
+
     IDWriteFontFace_Release(fontface);
     IDWriteFontFile_Release(file);
     IDWriteFactory_Release(factory);




More information about the wine-cvs mailing list