summaryrefslogtreecommitdiff
path: root/src/lzw
diff options
context:
space:
mode:
authorWerner Lemberg <wl@gnu.org>2014-11-26 21:59:21 +0100
committerWerner Lemberg <wl@gnu.org>2014-11-26 21:59:21 +0100
commitf34f1925358057d2e374303408088f6c15bebfb8 (patch)
tree8c63f7c9f21930cd36fa2c5ac6ac0c2d08c71ad6 /src/lzw
parent2966889126c34bc530d69589118e5bbdc7f478e4 (diff)
downloadfreetype2-f34f1925358057d2e374303408088f6c15bebfb8.tar.gz
* src/*: Add checks for parameters of API functions where missing.
`API functions' are functions tagged with `FT_EXPORT_DEF'. Besides trivial fixes, the following changes are included, too. * src/base/ftbdf.c (FT_Get_BDF_Charset_ID, FT_Get_BDF_Property): Set error code if no service is available. * src/base/ftinit.c (FT_Done_FreeType): Change return value for invalid `library' parameter to `Invalid_Library_Handle'. * src/base/ftobjs.c (FT_New_Size): Change return value for invalid `asize' parameter to `Invalid_Argument'. * src/base/ftoutln.c (FT_Outline_Copy): Change return value for invalid `source' and `target' parameters to `Invalid_Outline'. (FT_Outline_Done_Internal): Change return value for invalid `outline' parameter to `Invalid_Outline'.
Diffstat (limited to 'src/lzw')
-rw-r--r--src/lzw/ftlzw.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lzw/ftlzw.c b/src/lzw/ftlzw.c
index 82e6c0070..6092626b6 100644
--- a/src/lzw/ftlzw.c
+++ b/src/lzw/ftlzw.c
@@ -8,7 +8,7 @@
/* be used to parse compressed PCF fonts, as found with many X11 server */
/* distributions. */
/* */
-/* Copyright 2004-2006, 2009, 2010, 2012, 2013 by */
+/* Copyright 2004-2006, 2009, 2010, 2012-2014 by */
/* Albert Chin-A-Young. */
/* */
/* Based on code in src/gzip/ftgzip.c, Copyright 2004 by */
@@ -349,10 +349,18 @@
FT_Stream source )
{
FT_Error error;
- FT_Memory memory = source->memory;
+ FT_Memory memory;
FT_LZWFile zip = NULL;
+ if ( !stream || !source )
+ {
+ error = FT_THROW( Invalid_Stream_Handle );
+ goto Exit;
+ }
+
+ memory = source->memory;
+
/*
* Check the header right now; this prevents allocation of a huge
* LZWFile object (400 KByte of heap memory) if not necessary.