* builds/unix/ftsystem.c (FT_Stream_Open): Reject zero-length files. Patch from Savannah bug #25151.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
diff --git a/ChangeLog b/ChangeLog
index d5e1cb2..e8591b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-12-22 Steve Grubb
+
+ * builds/unix/ftsystem.c (FT_Stream_Open): Reject zero-length files.
+ Patch from Savannah bug #25151.
+
2008-12-21 Werner Lemberg <wl@gnu.org>
* src/pfr/pfrdrivr.c, src/winfonts/winfnt.c, src/cache/ftcmanag.c,
diff --git a/builds/unix/ftsystem.c b/builds/unix/ftsystem.c
index 3a740fd..52f7cfe 100644
--- a/builds/unix/ftsystem.c
+++ b/builds/unix/ftsystem.c
@@ -4,7 +4,7 @@
/* */
/* Unix-specific FreeType low-level system interface (body). */
/* */
-/* Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -280,6 +280,11 @@
FT_ERROR(( "FT_Stream_Open: file is too big" ));
goto Fail_Map;
}
+ else if ( stat_buf.st_size == 0 )
+ {
+ FT_ERROR(( "FT_Stream_Open: zero-length file" ));
+ goto Fail_Map;
+ }
/* This cast potentially truncates a 64bit to 32bit! */
stream->size = (unsigned long)stat_buf.st_size;