shithub: freetype+ttf2subf

Download patch

ref: 4c60bd916cd487b9ee90b561ecfa4011d443c68c
parent: 77f7358533406db47f7a3bd94b5c71c84ec6c911
author: Suzuki, Toshiya (鈴木俊哉) <[email protected]>
date: Tue Aug 19 11:35:44 EDT 2008

* Fix FT_Stream_New() to initialize stream always

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-08-19  suzuki toshiya <[email protected]>
+
+	* src/base/ftobjs.c (FT_Stream_New): Initialize *astream
+	always, even if passed library or arguments are invalid.
+	This fixes a bug that uninitialized stream is freed when
+	an invalid library handle is passed. Originally proposed
+	by Mike Fabian, 2008/08/18 on freetype-devel.
+	(FT_Open_Face): Ditto (stream).
+	(load_face_in_embedded_rfork): Ditto (stream2).
+
 2008-08-18  suzuki toshiya <[email protected]>
 
 	* src/base/ftmac.c: Add a fallback to guess the availability of the
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -128,6 +128,8 @@
     FT_Stream  stream;
 
 
+    *astream = 0;
+
     if ( !library )
       return FT_Err_Invalid_Library_Handle;
 
@@ -134,7 +136,6 @@
     if ( !args )
       return FT_Err_Invalid_Argument;
 
-    *astream = 0;
     memory   = library->memory;
 
     if ( FT_NEW( stream ) )
@@ -1600,7 +1601,7 @@
     FT_Error   errors[FT_RACCESS_N_RULES];
 
     FT_Open_Args  args2;
-    FT_Stream     stream2;
+    FT_Stream     stream2 = 0;
 
 
     FT_Raccess_Guess( library, stream,
@@ -1713,7 +1714,7 @@
     FT_Error     error;
     FT_Driver    driver;
     FT_Memory    memory;
-    FT_Stream    stream;
+    FT_Stream    stream = 0;
     FT_Face      face = 0;
     FT_ListNode  node = 0;
     FT_Bool      external_stream;