diff options
Diffstat (limited to 'libpng/uncompr.c')
-rw-r--r-- | libpng/uncompr.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libpng/uncompr.c b/libpng/uncompr.c index ebcb33f..b59e3d0 100644 --- a/libpng/uncompr.c +++ b/libpng/uncompr.c @@ -1,10 +1,11 @@ /* uncompr.c -- decompress a memory buffer - * Copyright (C) 1995-2002 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h + * Copyright (C) 1995-2003 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ +#define ZLIB_INTERNAL #include "zlib.h" /* =========================================================================== @@ -22,7 +23,11 @@ enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, or Z_DATA_ERROR if the input data was corrupted. */ -int ZEXPORT uncompress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen) +int ZEXPORT uncompress (dest, destLen, source, sourceLen) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; { z_stream stream; int err; @@ -45,7 +50,9 @@ int ZEXPORT uncompress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong err = inflate(&stream, Z_FINISH); if (err != Z_STREAM_END) { inflateEnd(&stream); - return err == Z_OK ? Z_BUF_ERROR : err; + if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) + return Z_DATA_ERROR; + return err; } *destLen = stream.total_out; |