aboutsummaryrefslogtreecommitdiff
path: root/freetype/src/base/ftsystem.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-01-16 17:43:39 +0000
committermarha <marha@users.sourceforge.net>2011-01-16 17:43:39 +0000
commit2177eb8fad173f2b0fe04f188c4d6dadaa8f4441 (patch)
tree862ef4b348586f932593a7d2b599913230059cdd /freetype/src/base/ftsystem.c
parent367c91bebcdc1f5ba4278b68eb8715218d9640ad (diff)
downloadvcxsrv-2177eb8fad173f2b0fe04f188c4d6dadaa8f4441.tar.gz
vcxsrv-2177eb8fad173f2b0fe04f188c4d6dadaa8f4441.tar.bz2
vcxsrv-2177eb8fad173f2b0fe04f188c4d6dadaa8f4441.zip
freetype 2.4.4
Diffstat (limited to 'freetype/src/base/ftsystem.c')
-rw-r--r--freetype/src/base/ftsystem.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/freetype/src/base/ftsystem.c b/freetype/src/base/ftsystem.c
index ba86005c5..66c5d76a9 100644
--- a/freetype/src/base/ftsystem.c
+++ b/freetype/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;