* Fix FT_Stream_New() to initialize stream always

This commit is contained in:
Suzuki, Toshiya (鈴木俊哉) 2008-08-19 15:35:44 +00:00
parent 77f7358533
commit 4c60bd916c
2 changed files with 14 additions and 3 deletions

View File

@ -1,3 +1,13 @@
2008-08-19 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
* 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 <mpsuzuki@hiroshima-u.ac.jp>
* src/base/ftmac.c: Add a fallback to guess the availability of the

View File

@ -128,13 +128,14 @@
FT_Stream stream;
*astream = 0;
if ( !library )
return FT_Err_Invalid_Library_Handle;
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;