summaryrefslogtreecommitdiffstats
path: root/src/gzip
diff options
context:
space:
mode:
Diffstat (limited to 'src/gzip')
-rw-r--r--src/gzip/ftgzip.c22
-rw-r--r--src/gzip/inftrees.c10
2 files changed, 22 insertions, 10 deletions
diff --git a/src/gzip/ftgzip.c b/src/gzip/ftgzip.c
index 2c60b6c..879eb88 100644
--- a/src/gzip/ftgzip.c
+++ b/src/gzip/ftgzip.c
@@ -8,7 +8,7 @@
/* parse compressed PCF fonts, as found with many X11 server */
/* distributions. */
/* */
-/* Copyright 2002-2006, 2009-2013 by */
+/* Copyright 2002-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -58,7 +58,6 @@
/* conflicts when a program is linked with both FreeType and the */
/* original ZLib. */
-#define NO_DUMMY_DECL
#ifndef USE_ZLIB_ZCALLOC
#define MY_ZCALLOC /* prevent all zcalloc() & zfree() in zutils.c */
#endif
@@ -208,8 +207,8 @@
/* head[0] && head[1] are the magic numbers; */
/* head[2] is the method, and head[3] the flags */
- if ( head[0] != 0x1f ||
- head[1] != 0x8b ||
+ if ( head[0] != 0x1F ||
+ head[1] != 0x8B ||
head[2] != Z_DEFLATED ||
(head[3] & FT_GZIP_RESERVED) )
{
@@ -603,10 +602,18 @@
FT_Stream source )
{
FT_Error error;
- FT_Memory memory = source->memory;
+ FT_Memory memory;
FT_GZipFile zip = NULL;
+ if ( !stream || !source )
+ {
+ error = FT_THROW( Invalid_Stream_Handle );
+ goto Exit;
+ }
+
+ memory = source->memory;
+
/*
* check the header right now; this prevents allocating un-necessary
* objects when we don't need them
@@ -700,6 +707,11 @@
int err;
+ /* check for `input' delayed to `inflate' */
+
+ if ( !memory || ! output_len || !output )
+ return FT_THROW( Invalid_Argument );
+
/* this function is modeled after zlib's `uncompress' function */
stream.next_in = (Bytef*)input;
diff --git a/src/gzip/inftrees.c b/src/gzip/inftrees.c
index ef53652..56f52b1 100644
--- a/src/gzip/inftrees.c
+++ b/src/gzip/inftrees.c
@@ -115,16 +115,16 @@ uIntf *v /* working area: values in order of bit length */
uInt f; /* i repeats in table every f entries */
int g; /* maximum code length */
int h; /* table level */
- register uInt i; /* counter, current code */
- register uInt j; /* counter */
- register int k; /* number of bits in current code */
+ uInt i; /* counter, current code */
+ uInt j; /* counter */
+ int k; /* number of bits in current code */
int l; /* bits per table (returned in m) */
uInt mask; /* (1 << w) - 1, to avoid cc -O bug on HP */
- register uIntf *p; /* pointer into c[], b[], or v[] */
+ uIntf *p; /* pointer into c[], b[], or v[] */
inflate_huft *q; /* points to current table */
struct inflate_huft_s r; /* table entry for structure assignment */
inflate_huft *u[BMAX]; /* table stack */
- register int w; /* bits before this table == (l * h) */
+ int w; /* bits before this table == (l * h) */
uInt x[BMAX+1]; /* bit offsets, then code stack */
uIntf *xp; /* pointer into x */
int y; /* number of dummy codes added */