aboutsummaryrefslogtreecommitdiff
path: root/freetype/src/lzw/ftlzw.c
diff options
context:
space:
mode:
Diffstat (limited to 'freetype/src/lzw/ftlzw.c')
-rw-r--r--freetype/src/lzw/ftlzw.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/freetype/src/lzw/ftlzw.c b/freetype/src/lzw/ftlzw.c
index 8bdd0b4e8..459fc81d7 100644
--- a/freetype/src/lzw/ftlzw.c
+++ b/freetype/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 */
@@ -96,8 +96,8 @@
goto Exit;
/* head[0] && head[1] are the magic numbers */
- if ( head[0] != 0x1f ||
- head[1] != 0x9d )
+ if ( head[0] != 0x1F ||
+ head[1] != 0x9D )
error = FT_THROW( Invalid_File_Format );
Exit:
@@ -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.