From 7785694244cdfc5939ca4754cab4e08bd6980f99 Mon Sep 17 00:00:00 2001 From: marha Date: Sun, 22 Feb 2015 14:47:01 +0100 Subject: Upgraded to freetype 2.5.5 --- freetype/src/gzip/ftgzip.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'freetype/src/gzip/ftgzip.c') diff --git a/freetype/src/gzip/ftgzip.c b/freetype/src/gzip/ftgzip.c index 2c60b6c57..2d4200d9f 100644 --- a/freetype/src/gzip/ftgzip.c +++ b/freetype/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-2006, 2009-2014 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -208,8 +208,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 +603,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 +708,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; -- cgit v1.2.3