From 4c60bd916cd487b9ee90b561ecfa4011d443c68c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzuki=2C=20Toshiya=20=28=E9=88=B4=E6=9C=A8=E4=BF=8A?= =?UTF-8?q?=E5=93=89=29?= Date: Tue, 19 Aug 2008 15:35:44 +0000 Subject: [PATCH] * Fix FT_Stream_New() to initialize stream always --- ChangeLog | 10 ++++++++++ src/base/ftobjs.c | 7 ++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 00a144de9..617f8ec8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-08-19 suzuki toshiya + + * 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 * src/base/ftmac.c: Add a fallback to guess the availability of the diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 8208e2a45..76ebfe428 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -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;