ref: 66043b1c4fdfe971348ef619e0fd8d85284034f4
parent: 3c5ad9516675db198246b460f84ae7ea01b46adb
author: Werner Lemberg <[email protected]>
date: Mon Dec 22 13:09:48 EST 2008
* builds/unix/ftsystem.c (FT_Stream_Open): Reject zero-length files. Patch from Savannah bug #25151.
--- 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 <[email protected]>
* src/pfr/pfrdrivr.c, src/winfonts/winfnt.c, src/cache/ftcmanag.c,
--- 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, */
@@ -278,6 +278,11 @@
if ( stat_buf.st_size > LONG_MAX )
{
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;
}