diff options
author | suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> | 2010-10-13 16:21:59 +0900 |
---|---|---|
committer | suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> | 2010-10-13 16:21:59 +0900 |
commit | 4b718714186313648a098b823f478ce8c006dc3b (patch) | |
tree | c4e4740630227e6cd90895599388ec8e91d1b121 /builds/amiga | |
parent | 59eb9f8cfe7d1df379a2318316d1f04f80fba54a (diff) | |
download | freetype2-4b718714186313648a098b823f478ce8c006dc3b.tar.gz |
Prevent to open a FT_Stream for zero-sized file on non-Unix.
builds/unix/ftsystem.c prevents to open an useless stream from
zero-sized file and returns FT_Err_Cannot_Open_Stream, but the
stream drivers for ANSI C, Amiga and VMS return useless streams.
For cross-platform consistency, all stream drivers should act
same.
* src/base/ftsystem.c (FT_Stream_Open): If the size of the opened
file is zero, FT_Err_Cannot_Open_Stream is returned.
* builds/amiga/src/base/ftsystem.c (FT_Stream_Open): Ditto.
* src/vms/ftsystem.c (FT_Stream_Open): Ditto.
Diffstat (limited to 'builds/amiga')
-rw-r--r-- | builds/amiga/src/base/ftsystem.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/builds/amiga/src/base/ftsystem.c b/builds/amiga/src/base/ftsystem.c index 016f1e29e..a2619886e 100644 --- a/builds/amiga/src/base/ftsystem.c +++ b/builds/amiga/src/base/ftsystem.c @@ -442,6 +442,14 @@ Free_VecPooled( APTR poolHeader, stream->read = ft_amiga_stream_io; stream->close = ft_amiga_stream_close; + if ( !stream->size ) + { + ft_amiga_stream_close( stream ); + FT_ERROR(( "FT_Stream_Open:" )); + FT_ERROR(( " opened `%s' but zero-sized\n", filepathname )); + return FT_Err_Cannot_Open_Stream;; + } + FT_TRACE1(( "FT_Stream_Open:" )); FT_TRACE1(( " opened `%s' (%ld bytes) successfully\n", filepathname, stream->size )); |