[PATCH v2] wineps: Cope correctly with a missing table.

Huw Davies huw at codeweavers.com
Mon Nov 12 04:56:10 CST 2018


From: Wolfgang Walter <wine at stwm.de>

Signed-off-by: Wolfgang Walter <wine at stwm.de>
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 dlls/wineps.drv/type42.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/dlls/wineps.drv/type42.c b/dlls/wineps.drv/type42.c
index 8a56cc6b6c..c808ddbde4 100644
--- a/dlls/wineps.drv/type42.c
+++ b/dlls/wineps.drv/type42.c
@@ -100,10 +100,15 @@ struct tagTYPE42 {
 static BOOL LoadTable(HDC hdc, OTTable *table)
 {
     unsigned int i;
+    DWORD len;
 
     if(table->MS_tag == MS_MAKE_TAG('g','d','i','r')) return TRUE;
-    table->len = GetFontData(hdc, table->MS_tag, 0, NULL, 0);
-    table->data = HeapAlloc(GetProcessHeap(), 0, (table->len + 3) & ~3 );
+    table->len = 0;
+    len = GetFontData(hdc, table->MS_tag, 0, NULL, 0);
+    if(len == GDI_ERROR) return FALSE;
+    table->data = HeapAlloc(GetProcessHeap(), 0, (len + 3) & ~3);
+    if(!table->data) return FALSE;
+    table->len = len;
     memset(table->data + ((table->len - 1) & ~3), 0, sizeof(DWORD));
     GetFontData(hdc, table->MS_tag, 0, table->data, table->len);
     table->check = 0;
-- 
2.18.0




More information about the wine-devel mailing list