Wolfgang Walter : wineps: Cope correctly with a missing table.

Alexandre Julliard julliard at winehq.org
Mon Nov 12 16:26:55 CST 2018


Module: wine
Branch: master
Commit: 2b23eb2e9a4532b2c8e3d096d0c10740baa0aac2
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=2b23eb2e9a4532b2c8e3d096d0c10740baa0aac2

Author: Wolfgang Walter <wine at stwm.de>
Date:   Mon Nov 12 10:56:10 2018 +0000

wineps: Cope correctly with a missing table.

Signed-off-by: Wolfgang Walter <wine at stwm.de>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 8a56cc6..c808ddb 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;




More information about the wine-cvs mailing list