summaryrefslogtreecommitdiffstats
path: root/src/base/ftsystem.c
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2011-01-26 13:53:40 +0100
committerDavid 'Digit' Turner <digit@google.com>2011-01-26 13:53:40 +0100
commit7f08cbd7d6dcf19b8d8e4328e33032aee342e3b4 (patch)
treef9ed9e041d6830735eae3d4af62e9a602851faea /src/base/ftsystem.c
parentcb487e4c5295d0d9bb96ddd3a27372ffad41ae5b (diff)
downloadandroid_external_freetype-7f08cbd7d6dcf19b8d8e4328e33032aee342e3b4.tar.gz
android_external_freetype-7f08cbd7d6dcf19b8d8e4328e33032aee342e3b4.tar.bz2
android_external_freetype-7f08cbd7d6dcf19b8d8e4328e33032aee342e3b4.zip
Upgrade to upstream 2.4.4
This is necessary to fix several security issues. See b/3344697 Change-Id: Ica5c6387fbd791008199f7994ed03978ed700a69
Diffstat (limited to 'src/base/ftsystem.c')
-rw-r--r--src/base/ftsystem.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/base/ftsystem.c b/src/base/ftsystem.c
index ba86005..66c5d76 100644
--- a/src/base/ftsystem.c
+++ b/src/base/ftsystem.c
@@ -229,6 +229,13 @@
if ( !stream )
return FT_Err_Invalid_Stream_Handle;
+ stream->descriptor.pointer = NULL;
+ stream->pathname.pointer = (char*)filepathname;
+ stream->base = 0;
+ stream->pos = 0;
+ stream->read = NULL;
+ stream->close = NULL;
+
file = ft_fopen( filepathname, "rb" );
if ( !file )
{
@@ -240,12 +247,16 @@
ft_fseek( file, 0, SEEK_END );
stream->size = ft_ftell( file );
+ if ( !stream->size )
+ {
+ FT_ERROR(( "FT_Stream_Open:" ));
+ FT_ERROR(( " opened `%s' but zero-sized\n", filepathname ));
+ ft_fclose( file );
+ return FT_Err_Cannot_Open_Stream;
+ }
ft_fseek( file, 0, SEEK_SET );
stream->descriptor.pointer = file;
- stream->pathname.pointer = (char*)filepathname;
- stream->pos = 0;
-
stream->read = ft_ansi_stream_io;
stream->close = ft_ansi_stream_close;