38 lines
1.1 KiB
Diff
38 lines
1.1 KiB
Diff
--- freetype-2.4.2/src/base/ftstream.c 2010-08-04 15:52:01.000000000 +0200
|
|
+++ freetype-2.4.2/src/base/ftstream.c 2010-10-06 18:47:07.000000000 +0200
|
|
@@ -59,8 +59,17 @@
|
|
{
|
|
FT_Error error = FT_Err_Ok;
|
|
|
|
+ /* note that seeking to the first position after the file is valid */
|
|
+ if ( pos > stream->size )
|
|
+ {
|
|
+ FT_ERROR(( "FT_Stream_Seek:"
|
|
+ " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
|
|
+ pos, stream->size ));
|
|
|
|
- if ( stream->read )
|
|
+ error = FT_Err_Invalid_Stream_Operation;
|
|
+ }
|
|
+
|
|
+ if ( !error && stream->read )
|
|
{
|
|
if ( stream->read( stream, pos, 0, 0 ) )
|
|
{
|
|
@@ -71,15 +80,6 @@
|
|
error = FT_Err_Invalid_Stream_Operation;
|
|
}
|
|
}
|
|
- /* note that seeking to the first position after the file is valid */
|
|
- else if ( pos > stream->size )
|
|
- {
|
|
- FT_ERROR(( "FT_Stream_Seek:"
|
|
- " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
|
|
- pos, stream->size ));
|
|
-
|
|
- error = FT_Err_Invalid_Stream_Operation;
|
|
- }
|
|
|
|
if ( !error )
|
|
stream->pos = pos;
|