Imported from libpng-1.0.11beta3.tar
This commit is contained in:
parent
f64a06f5ec
commit
e1eff58f87
3
ANNOUNCE
3
ANNOUNCE
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Libpng 1.0.11beta2 - April 11, 2001
|
Libpng 1.0.11beta3 - April 15, 2001
|
||||||
|
|
||||||
This is a public release of libpng, intended for use in production codes.
|
This is a public release of libpng, intended for use in production codes.
|
||||||
|
|
||||||
@ -10,6 +10,7 @@ Changes since the last public release (1.0.10):
|
|||||||
Changed several "//" single-line comments to C-style in pnggccrd.c
|
Changed several "//" single-line comments to C-style in pnggccrd.c
|
||||||
Removed PNGAPI from private functions whose prototypes did not have PNGAPI.
|
Removed PNGAPI from private functions whose prototypes did not have PNGAPI.
|
||||||
Updated scripts/pngos2.def
|
Updated scripts/pngos2.def
|
||||||
|
Added checking the results of many instances of png_malloc() for NULL
|
||||||
|
|
||||||
Send comments/corrections/commendations to
|
Send comments/corrections/commendations to
|
||||||
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
||||||
|
2
CHANGES
2
CHANGES
@ -921,6 +921,8 @@ version 1.0.11beta1 [April 3, 2001]
|
|||||||
version 1.0.11beta2 [April 11, 2001]
|
version 1.0.11beta2 [April 11, 2001]
|
||||||
Removed PNGAPI from several functions whose prototypes did not have PNGAPI.
|
Removed PNGAPI from several functions whose prototypes did not have PNGAPI.
|
||||||
Updated scripts/pngos2.def
|
Updated scripts/pngos2.def
|
||||||
|
version 1.0.11beta3 [April 15, 2001]
|
||||||
|
Added checking the results of many instances of png_malloc() for NULL
|
||||||
|
|
||||||
Send comments/corrections/commendations to
|
Send comments/corrections/commendations to
|
||||||
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
|
||||||
|
12
INSTALL
12
INSTALL
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Installing libpng version 1.0.11beta2 - April 11, 2001
|
Installing libpng version 1.0.11beta3 - April 15, 2001
|
||||||
|
|
||||||
Before installing libpng, you must first install zlib. zlib
|
Before installing libpng, you must first install zlib. zlib
|
||||||
can usually be found wherever you got libpng. zlib can be
|
can usually be found wherever you got libpng. zlib can be
|
||||||
@ -10,7 +10,7 @@ zlib.h and zconf.h include files that correspond to the
|
|||||||
version of zlib that's installed.
|
version of zlib that's installed.
|
||||||
|
|
||||||
You can rename the directories that you downloaded (they
|
You can rename the directories that you downloaded (they
|
||||||
might be called "libpng-1.0.11beta2" or "lpng109" and "zlib-1.1.3"
|
might be called "libpng-1.0.11beta3" or "lpng109" and "zlib-1.1.3"
|
||||||
or "zlib113") so that you have directories called "zlib" and "libpng".
|
or "zlib113") so that you have directories called "zlib" and "libpng".
|
||||||
|
|
||||||
Your directory structure should look like this:
|
Your directory structure should look like this:
|
||||||
@ -60,8 +60,8 @@ The files that are presently available in the scripts directory
|
|||||||
include
|
include
|
||||||
|
|
||||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||||
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.11beta2)
|
makefile.linux => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.11beta3)
|
||||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.11beta2,
|
makefile.gcmmx => Linux/ELF makefile (gcc, creates libpng.so.2.1.0.11beta3,
|
||||||
uses assembler code tuned for Intel MMX platform)
|
uses assembler code tuned for Intel MMX platform)
|
||||||
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||||
makefile.knr => Archaic UNIX Makefile that converts files with
|
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||||
@ -77,9 +77,9 @@ include
|
|||||||
libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later
|
libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later
|
||||||
makefile.macosx => MACOS X Makefile
|
makefile.macosx => MACOS X Makefile
|
||||||
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
||||||
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.11beta2)
|
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.11beta3)
|
||||||
makefile.sunos => Sun makefile
|
makefile.sunos => Sun makefile
|
||||||
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.11beta2)
|
makefile.solaris => Solaris 2.X makefile (gcc, creates libpng.so.2.1.0.11beta3)
|
||||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||||
makefile.mips => MIPS makefile
|
makefile.mips => MIPS makefile
|
||||||
makefile.acorn => Acorn makefile
|
makefile.acorn => Acorn makefile
|
||||||
|
5
KNOWNBUG
5
KNOWNBUG
@ -21,3 +21,8 @@ Known bugs in libpng-1.0.10
|
|||||||
involved are all either deprecated or intended only for internal use.
|
involved are all either deprecated or intended only for internal use.
|
||||||
|
|
||||||
STATUS: PNGAPI was removed from the C code in libpng-1.0.11beta2.
|
STATUS: PNGAPI was removed from the C code in libpng-1.0.11beta2.
|
||||||
|
|
||||||
|
4. April 14, 2001: Many instances of png_malloc() are not followed by
|
||||||
|
a check to make sure it didn't return NULL.
|
||||||
|
|
||||||
|
STATUS: tests were added in libpng-1.0.11beta3.
|
||||||
|
4
LICENSE
4
LICENSE
@ -8,7 +8,7 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
|||||||
If you modify libpng you may insert additional notices immediately following
|
If you modify libpng you may insert additional notices immediately following
|
||||||
this sentence.
|
this sentence.
|
||||||
|
|
||||||
libpng versions 1.0.7, July 1, 2000, through 1.0.11beta2, April 11, 2001, are
|
libpng versions 1.0.7, July 1, 2000, through 1.0.11beta3, April 15, 2001, are
|
||||||
Copyright (c) 2000, 2001 Glenn Randers-Pehrson
|
Copyright (c) 2000, 2001 Glenn Randers-Pehrson
|
||||||
and are distributed according to the same disclaimer and license as libpng-1.0.6
|
and are distributed according to the same disclaimer and license as libpng-1.0.6
|
||||||
with the following individuals added to the list of Contributing Authors
|
with the following individuals added to the list of Contributing Authors
|
||||||
@ -99,4 +99,4 @@ certification mark of the Open Source Initiative.
|
|||||||
|
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
randeg@alum.rpi.edu
|
randeg@alum.rpi.edu
|
||||||
April 11, 2001
|
April 15, 2001
|
||||||
|
10
README
10
README
@ -1,4 +1,4 @@
|
|||||||
README for libpng 1.0.11beta2 - April 11, 2001 (shared library 2.1)
|
README for libpng 1.0.11beta3 - April 15, 2001 (shared library 2.1)
|
||||||
See the note about version numbers near the top of png.h
|
See the note about version numbers near the top of png.h
|
||||||
|
|
||||||
See INSTALL for instructions on how to install libpng.
|
See INSTALL for instructions on how to install libpng.
|
||||||
@ -183,9 +183,9 @@ Files in this distribution:
|
|||||||
descrip.mms => VMS makefile for MMS or MMK
|
descrip.mms => VMS makefile for MMS or MMK
|
||||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||||
makefile.linux => Linux/ELF makefile
|
makefile.linux => Linux/ELF makefile
|
||||||
(gcc, creates libpng.so.2.1.0.11beta2)
|
(gcc, creates libpng.so.2.1.0.11beta3)
|
||||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates
|
makefile.gcmmx => Linux/ELF makefile (gcc, creates
|
||||||
libpng.so.2.1.0.11beta2, uses assembler code
|
libpng.so.2.1.0.11beta3, uses assembler code
|
||||||
tuned for Intel MMX platform)
|
tuned for Intel MMX platform)
|
||||||
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||||
makefile.knr => Archaic UNIX Makefile that converts files with
|
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||||
@ -201,10 +201,10 @@ Files in this distribution:
|
|||||||
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
|
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
|
||||||
makefile.macosx => MACOS X Makefile
|
makefile.macosx => MACOS X Makefile
|
||||||
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
|
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
|
||||||
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.11beta2)
|
makefile.sggcc => Silicon Graphics (gcc, creates libpng.so.2.1.0.11beta3)
|
||||||
makefile.sunos => Sun makefile
|
makefile.sunos => Sun makefile
|
||||||
makefile.solaris => Solaris 2.X makefile
|
makefile.solaris => Solaris 2.X makefile
|
||||||
(gcc, creates libpng.so.2.1.0.11beta2)
|
(gcc, creates libpng.so.2.1.0.11beta3)
|
||||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||||
makefile.mips => MIPS makefile
|
makefile.mips => MIPS makefile
|
||||||
makefile.acorn => Acorn makefile
|
makefile.acorn => Acorn makefile
|
||||||
|
4
Y2KINFO
4
Y2KINFO
@ -1,13 +1,13 @@
|
|||||||
Y2K compliance in libpng:
|
Y2K compliance in libpng:
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
April 11, 2001
|
April 15, 2001
|
||||||
|
|
||||||
Since the PNG Development group is an ad-hoc body, we can't make
|
Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
an official declaration.
|
an official declaration.
|
||||||
|
|
||||||
This is your unofficial assurance that libpng from version 0.71 and
|
This is your unofficial assurance that libpng from version 0.71 and
|
||||||
upward through 1.0.11beta2 are Y2K compliant. It is my belief that earlier
|
upward through 1.0.11beta3 are Y2K compliant. It is my belief that earlier
|
||||||
versions were also Y2K compliant.
|
versions were also Y2K compliant.
|
||||||
|
|
||||||
Libpng only has three year fields. One is a 2-byte unsigned integer
|
Libpng only has three year fields. One is a 2-byte unsigned integer
|
||||||
|
2
configure
vendored
2
configure
vendored
@ -1,5 +1,5 @@
|
|||||||
echo "
|
echo "
|
||||||
There is no \"configure\" script for Libpng-1.0.11beta2. Instead, please
|
There is no \"configure\" script for Libpng-1.0.11beta3. Instead, please
|
||||||
copy the appropriate makefile for your system from the \"scripts\"
|
copy the appropriate makefile for your system from the \"scripts\"
|
||||||
directory. Read the INSTALL file for more details.
|
directory. Read the INSTALL file for more details.
|
||||||
"
|
"
|
||||||
|
@ -603,7 +603,10 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||||
|
|
||||||
/* set the palette if there is one. REQUIRED for indexed-color images */
|
/* set the palette if there is one. REQUIRED for indexed-color images */
|
||||||
palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH * sizeof (png_color));
|
palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH
|
||||||
|
* sizeof (png_color));
|
||||||
|
if (palette == NULL)
|
||||||
|
png_error(png_ptr, "Example: malloc of palette failed");
|
||||||
/* ... set palette colors ... */
|
/* ... set palette colors ... */
|
||||||
png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH);
|
png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH);
|
||||||
/* You must not free palette here, because png_set_PLTE only makes a link to
|
/* You must not free palette here, because png_set_PLTE only makes a link to
|
||||||
|
18
libpng.3
18
libpng.3
@ -1,6 +1,6 @@
|
|||||||
.TH LIBPNG 3 "April 11, 2001"
|
.TH LIBPNG 3 "April 15, 2001"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.11beta2
|
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.11beta3
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
@ -747,7 +747,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
|
|||||||
.SH LIBPNG.TXT
|
.SH LIBPNG.TXT
|
||||||
libpng.txt - A description on how to use and modify libpng
|
libpng.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
libpng version 1.0.11beta2 - April 11, 2001
|
libpng version 1.0.11beta3 - April 15, 2001
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
<randeg@alum.rpi.edu>
|
<randeg@alum.rpi.edu>
|
||||||
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
||||||
@ -3464,13 +3464,13 @@ application:
|
|||||||
|
|
||||||
.SH VIII. Y2K Compliance in libpng
|
.SH VIII. Y2K Compliance in libpng
|
||||||
|
|
||||||
April 11, 2001
|
April 15, 2001
|
||||||
|
|
||||||
Since the PNG Development group is an ad-hoc body, we can't make
|
Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
an official declaration.
|
an official declaration.
|
||||||
|
|
||||||
This is your unofficial assurance that libpng from version 0.71 and
|
This is your unofficial assurance that libpng from version 0.71 and
|
||||||
upward through 1.0.11beta2 are Y2K compliant. It is my belief that earlier
|
upward through 1.0.11beta3 are Y2K compliant. It is my belief that earlier
|
||||||
versions were also Y2K compliant.
|
versions were also Y2K compliant.
|
||||||
|
|
||||||
Libpng only has three year fields. One is a 2-byte unsigned integer that
|
Libpng only has three year fields. One is a 2-byte unsigned integer that
|
||||||
@ -3579,7 +3579,7 @@ the first widely used release:
|
|||||||
1.0.10beta1 1 10010 2.1.0.10beta1
|
1.0.10beta1 1 10010 2.1.0.10beta1
|
||||||
1.0.10rc1 1 10010 2.1.0.10rc1
|
1.0.10rc1 1 10010 2.1.0.10rc1
|
||||||
1.0.10 1 10010 2.1.0.10
|
1.0.10 1 10010 2.1.0.10
|
||||||
1.0.11beta1-2 1 10011 2.1.0.11beta1-2
|
1.0.11beta1-3 1 10011 2.1.0.11beta1-3
|
||||||
|
|
||||||
Henceforth the source version will match the shared-library minor
|
Henceforth the source version will match the shared-library minor
|
||||||
and patch numbers; the shared-library major version number will be
|
and patch numbers; the shared-library major version number will be
|
||||||
@ -3637,7 +3637,7 @@ possible without all of you.
|
|||||||
|
|
||||||
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||||
|
|
||||||
Libpng version 1.0.11beta2 - April 11, 2001:
|
Libpng version 1.0.11beta3 - April 15, 2001:
|
||||||
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
||||||
Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
|
Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
|
||||||
|
|
||||||
@ -3654,7 +3654,7 @@ included in the libpng distribution, the latter shall prevail.)
|
|||||||
If you modify libpng you may insert additional notices immediately following
|
If you modify libpng you may insert additional notices immediately following
|
||||||
this sentence.
|
this sentence.
|
||||||
|
|
||||||
libpng versions 1.0.7, July 1, 2000, through 1.0.11beta2, April 11, 2001, are
|
libpng versions 1.0.7, July 1, 2000, through 1.0.11beta3, April 15, 2001, are
|
||||||
Copyright (c) 2000-2001 Glenn Randers-Pehrson, and are
|
Copyright (c) 2000-2001 Glenn Randers-Pehrson, and are
|
||||||
distributed according to the same disclaimer and license as libpng-1.0.6
|
distributed according to the same disclaimer and license as libpng-1.0.6
|
||||||
with the following individuals added to the list of Contributing Authors
|
with the following individuals added to the list of Contributing Authors
|
||||||
@ -3746,7 +3746,7 @@ certification mark of the Open Source Initiative.
|
|||||||
|
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
randeg@alum.rpi.edu
|
randeg@alum.rpi.edu
|
||||||
April 11, 2001
|
April 15, 2001
|
||||||
|
|
||||||
.\" end of man page
|
.\" end of man page
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
libpng.txt - A description on how to use and modify libpng
|
libpng.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
libpng version 1.0.11beta2 - April 11, 2001
|
libpng version 1.0.11beta3 - April 15, 2001
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
<randeg@alum.rpi.edu>
|
<randeg@alum.rpi.edu>
|
||||||
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
||||||
@ -2717,13 +2717,13 @@ application:
|
|||||||
|
|
||||||
VIII. Y2K Compliance in libpng
|
VIII. Y2K Compliance in libpng
|
||||||
|
|
||||||
April 11, 2001
|
April 15, 2001
|
||||||
|
|
||||||
Since the PNG Development group is an ad-hoc body, we can't make
|
Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
an official declaration.
|
an official declaration.
|
||||||
|
|
||||||
This is your unofficial assurance that libpng from version 0.71 and
|
This is your unofficial assurance that libpng from version 0.71 and
|
||||||
upward through 1.0.11beta2 are Y2K compliant. It is my belief that earlier
|
upward through 1.0.11beta3 are Y2K compliant. It is my belief that earlier
|
||||||
versions were also Y2K compliant.
|
versions were also Y2K compliant.
|
||||||
|
|
||||||
Libpng only has three year fields. One is a 2-byte unsigned integer that
|
Libpng only has three year fields. One is a 2-byte unsigned integer that
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
.TH LIBPNGPF 3 "April 11, 2001"
|
.TH LIBPNGPF 3 "April 15, 2001"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.11beta2
|
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.11beta3
|
||||||
(private functions)
|
(private functions)
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
\fB#include <png.h>\fP
|
\fB#include <png.h>\fP
|
||||||
|
2
png.5
2
png.5
@ -1,4 +1,4 @@
|
|||||||
.TH PNG 5 "April 11, 2001"
|
.TH PNG 5 "April 15, 2001"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
png \- Portable Network Graphics (PNG) format
|
png \- Portable Network Graphics (PNG) format
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
|
20
png.c
20
png.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* png.c - location for general purpose libpng functions
|
/* png.c - location for general purpose libpng functions
|
||||||
*
|
*
|
||||||
* libpng version 1.0.11beta2 - April 11, 2001
|
* libpng version 1.0.11beta3 - April 15, 2001
|
||||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -13,14 +13,14 @@
|
|||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
|
||||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||||
typedef version_1_0_11beta2 Your_png_h_is_not_version_1_0_11beta2;
|
typedef version_1_0_11beta3 Your_png_h_is_not_version_1_0_11beta3;
|
||||||
|
|
||||||
/* Version information for C files. This had better match the version
|
/* Version information for C files. This had better match the version
|
||||||
* string defined in png.h. */
|
* string defined in png.h. */
|
||||||
|
|
||||||
#ifdef PNG_USE_GLOBAL_ARRAYS
|
#ifdef PNG_USE_GLOBAL_ARRAYS
|
||||||
/* png_libpng_ver was changed to a function in version 1.0.5c */
|
/* png_libpng_ver was changed to a function in version 1.0.5c */
|
||||||
const char png_libpng_ver[18] = "1.0.11beta2";
|
const char png_libpng_ver[18] = "1.0.11beta3";
|
||||||
|
|
||||||
/* png_sig was changed to a function in version 1.0.5c */
|
/* png_sig was changed to a function in version 1.0.5c */
|
||||||
/* Place to hold the signature string for a PNG file. */
|
/* Place to hold the signature string for a PNG file. */
|
||||||
@ -142,6 +142,8 @@ png_zalloc(voidpf png_ptr, uInt items, uInt size)
|
|||||||
png_voidp ptr = (png_voidp)png_malloc((png_structp)png_ptr, num_bytes);
|
png_voidp ptr = (png_voidp)png_malloc((png_structp)png_ptr, num_bytes);
|
||||||
|
|
||||||
#ifndef PNG_NO_ZALLOC_ZERO
|
#ifndef PNG_NO_ZALLOC_ZERO
|
||||||
|
if (ptr)
|
||||||
|
{
|
||||||
if (num_bytes > (png_uint_32)0x8000L)
|
if (num_bytes > (png_uint_32)0x8000L)
|
||||||
{
|
{
|
||||||
png_memset(ptr, 0, (png_size_t)0x8000L);
|
png_memset(ptr, 0, (png_size_t)0x8000L);
|
||||||
@ -152,6 +154,7 @@ png_zalloc(voidpf png_ptr, uInt items, uInt size)
|
|||||||
{
|
{
|
||||||
png_memset(ptr, 0, (png_size_t)num_bytes);
|
png_memset(ptr, 0, (png_size_t)num_bytes);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return ((voidpf)ptr);
|
return ((voidpf)ptr);
|
||||||
}
|
}
|
||||||
@ -581,6 +584,10 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
|||||||
sizeof(char)));
|
sizeof(char)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (png_ptr->time_buffer == NULL)
|
||||||
|
png_warning(png_ptr, "Malloc of buffer for tIME chunk failed");
|
||||||
|
else
|
||||||
|
{
|
||||||
#if defined(_WIN32_WCE)
|
#if defined(_WIN32_WCE)
|
||||||
{
|
{
|
||||||
wchar_t time_buf[29];
|
wchar_t time_buf[29];
|
||||||
@ -609,6 +616,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
|||||||
ptime->second % 61);
|
ptime->second % 61);
|
||||||
#endif
|
#endif
|
||||||
#endif /* _WIN32_WCE */
|
#endif /* _WIN32_WCE */
|
||||||
|
}
|
||||||
return ((png_charp)png_ptr->time_buffer);
|
return ((png_charp)png_ptr->time_buffer);
|
||||||
}
|
}
|
||||||
#endif /* PNG_TIME_RFC1123_SUPPORTED */
|
#endif /* PNG_TIME_RFC1123_SUPPORTED */
|
||||||
@ -626,7 +634,7 @@ png_charp PNGAPI
|
|||||||
png_get_copyright(png_structp png_ptr)
|
png_get_copyright(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */
|
if (png_ptr != NULL || png_ptr == NULL) /* silence compiler warning */
|
||||||
return ((png_charp) "\n libpng version 1.0.11beta2 - April 11, 2001\n\
|
return ((png_charp) "\n libpng version 1.0.11beta3 - April 15, 2001\n\
|
||||||
Copyright (c) 1998-2001 Glenn Randers-Pehrson\n\
|
Copyright (c) 1998-2001 Glenn Randers-Pehrson\n\
|
||||||
Copyright (c) 1996, 1997 Andreas Dilger\n\
|
Copyright (c) 1996, 1997 Andreas Dilger\n\
|
||||||
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n");
|
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n");
|
||||||
@ -644,8 +652,8 @@ png_get_libpng_ver(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
/* Version of *.c files used when building libpng */
|
/* Version of *.c files used when building libpng */
|
||||||
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
|
||||||
return((png_charp) "1.0.11beta2");
|
return((png_charp) "1.0.11beta3");
|
||||||
return((png_charp) "1.0.11beta2");
|
return((png_charp) "1.0.11beta3");
|
||||||
}
|
}
|
||||||
|
|
||||||
png_charp PNGAPI
|
png_charp PNGAPI
|
||||||
|
22
png.h
22
png.h
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* png.h - header file for PNG reference library
|
/* png.h - header file for PNG reference library
|
||||||
*
|
*
|
||||||
* libpng version 1.0.11beta2 - April 11, 2001
|
* libpng version 1.0.11beta3 - April 15, 2001
|
||||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -9,7 +9,7 @@
|
|||||||
* Authors and maintainers:
|
* Authors and maintainers:
|
||||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
||||||
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
|
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||||
* libpng versions 0.97, January 1998, through 1.0.11beta2 - April 11, 2001: Glenn
|
* libpng versions 0.97, January 1998, through 1.0.11beta3 - April 15, 2001: Glenn
|
||||||
* See also "Contributing Authors", below.
|
* See also "Contributing Authors", below.
|
||||||
*
|
*
|
||||||
* Note about libpng version numbers:
|
* Note about libpng version numbers:
|
||||||
@ -67,7 +67,7 @@
|
|||||||
* 1.0.10beta1 1 10010 2.1.0.10beta1
|
* 1.0.10beta1 1 10010 2.1.0.10beta1
|
||||||
* 1.0.10rc1 1 10010 2.1.0.10rc1
|
* 1.0.10rc1 1 10010 2.1.0.10rc1
|
||||||
* 1.0.10 1 10010 2.1.0.10
|
* 1.0.10 1 10010 2.1.0.10
|
||||||
* 1.0.11beta1-2 1 10011 2.1.0.11beta1-2
|
* 1.0.11beta1-3 1 10011 2.1.0.11beta1-3
|
||||||
*
|
*
|
||||||
* Henceforth the source version will match the shared-library major
|
* Henceforth the source version will match the shared-library major
|
||||||
* and minor numbers; the shared-library major version number will be
|
* and minor numbers; the shared-library major version number will be
|
||||||
@ -97,7 +97,7 @@
|
|||||||
* If you modify libpng you may insert additional notices immediately following
|
* If you modify libpng you may insert additional notices immediately following
|
||||||
* this sentence.
|
* this sentence.
|
||||||
*
|
*
|
||||||
* libpng versions 1.0.7, July 1, 2000, through 1.0.11beta2, April 11, 2001, are
|
* libpng versions 1.0.7, July 1, 2000, through 1.0.11beta3, April 15, 2001, are
|
||||||
* Copyright (c) 2000, 2001 Glenn Randers-Pehrson, and are
|
* Copyright (c) 2000, 2001 Glenn Randers-Pehrson, and are
|
||||||
* distributed according to the same disclaimer and license as libpng-1.0.6
|
* distributed according to the same disclaimer and license as libpng-1.0.6
|
||||||
* with the following individuals added to the list of Contributing Authors
|
* with the following individuals added to the list of Contributing Authors
|
||||||
@ -202,13 +202,13 @@
|
|||||||
* Y2K compliance in libpng:
|
* Y2K compliance in libpng:
|
||||||
* =========================
|
* =========================
|
||||||
*
|
*
|
||||||
* April 11, 2001
|
* April 15, 2001
|
||||||
*
|
*
|
||||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
* an official declaration.
|
* an official declaration.
|
||||||
*
|
*
|
||||||
* This is your unofficial assurance that libpng from version 0.71 and
|
* This is your unofficial assurance that libpng from version 0.71 and
|
||||||
* upward through 1.0.11beta2 are Y2K compliant. It is my belief that earlier
|
* upward through 1.0.11beta3 are Y2K compliant. It is my belief that earlier
|
||||||
* versions were also Y2K compliant.
|
* versions were also Y2K compliant.
|
||||||
*
|
*
|
||||||
* Libpng only has three year fields. One is a 2-byte unsigned integer
|
* Libpng only has three year fields. One is a 2-byte unsigned integer
|
||||||
@ -264,7 +264,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Version information for png.h - this should match the version in png.c */
|
/* Version information for png.h - this should match the version in png.c */
|
||||||
#define PNG_LIBPNG_VER_STRING "1.0.11beta2"
|
#define PNG_LIBPNG_VER_STRING "1.0.11beta3"
|
||||||
|
|
||||||
#define PNG_LIBPNG_VER_SONUM 2
|
#define PNG_LIBPNG_VER_SONUM 2
|
||||||
#define PNG_LIBPNG_VER_DLLNUM %DLLNUM%
|
#define PNG_LIBPNG_VER_DLLNUM %DLLNUM%
|
||||||
@ -276,7 +276,7 @@
|
|||||||
/* This should match the numeric part of the final component of
|
/* This should match the numeric part of the final component of
|
||||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */
|
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */
|
||||||
|
|
||||||
#define PNG_LIBPNG_VER_BUILD 2
|
#define PNG_LIBPNG_VER_BUILD 3
|
||||||
|
|
||||||
#define PNG_LIBPNG_BUILD_ALPHA 1
|
#define PNG_LIBPNG_BUILD_ALPHA 1
|
||||||
#define PNG_LIBPNG_BUILD_BETA 2
|
#define PNG_LIBPNG_BUILD_BETA 2
|
||||||
@ -1185,9 +1185,9 @@ struct png_struct_def
|
|||||||
|
|
||||||
|
|
||||||
/* This prevents a compiler error in png_get_copyright() in png.c if png.c
|
/* This prevents a compiler error in png_get_copyright() in png.c if png.c
|
||||||
and png.h are both at * version 1.0.11beta2
|
and png.h are both at * version 1.0.11beta3
|
||||||
*/
|
*/
|
||||||
typedef png_structp version_1_0_11beta2;
|
typedef png_structp version_1_0_11beta3;
|
||||||
|
|
||||||
typedef png_struct FAR * FAR * png_structpp;
|
typedef png_struct FAR * FAR * png_structpp;
|
||||||
|
|
||||||
@ -2235,7 +2235,7 @@ extern PNG_EXPORT(int,png_mmx_support) PNGARG((void));
|
|||||||
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */
|
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */
|
||||||
|
|
||||||
#define PNG_HEADER_VERSION_STRING \
|
#define PNG_HEADER_VERSION_STRING \
|
||||||
" libpng version 1.0.11beta2 - April 11, 2001 (header)\n"
|
" libpng version 1.0.11beta3 - April 15, 2001 (header)\n"
|
||||||
|
|
||||||
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
|
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
|
||||||
/* With these routines we avoid an integer divide, which will be slower on
|
/* With these routines we avoid an integer divide, which will be slower on
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* pngasmrd.h - assembler version of utilities to read a PNG file
|
/* pngasmrd.h - assembler version of utilities to read a PNG file
|
||||||
*
|
*
|
||||||
* libpng 1.0.11beta2 - April 11, 2001
|
* libpng 1.0.11beta3 - April 15, 2001
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 2001 Glenn Randers-Pehrson
|
* Copyright (c) 2001 Glenn Randers-Pehrson
|
||||||
*
|
*
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* pngconf.h - machine configurable file for libpng
|
/* pngconf.h - machine configurable file for libpng
|
||||||
*
|
*
|
||||||
* libpng 1.0.11beta2 - April 11, 2001
|
* libpng 1.0.11beta3 - April 15, 2001
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngerror.c - stub functions for i/o and memory allocation
|
/* pngerror.c - stub functions for i/o and memory allocation
|
||||||
*
|
*
|
||||||
* libpng 1.0.11beta2 - April 11, 2001
|
* libpng 1.0.11beta3 - April 15, 2001
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
|
* and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
|
||||||
* for Intel's performance analysis of the MMX vs. non-MMX code.
|
* for Intel's performance analysis of the MMX vs. non-MMX code.
|
||||||
*
|
*
|
||||||
* libpng version 1.0.11beta2 - April 11, 2001
|
* libpng version 1.0.11beta3 - April 15, 2001
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1998, Intel Corporation
|
* Copyright (c) 1998, Intel Corporation
|
||||||
|
2
pngget.c
2
pngget.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngget.c - retrieval of values from info struct
|
/* pngget.c - retrieval of values from info struct
|
||||||
*
|
*
|
||||||
* libpng 1.0.11beta2 - April 11, 2001
|
* libpng 1.0.11beta3 - April 15, 2001
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
|
2
pngmem.c
2
pngmem.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngmem.c - stub functions for memory allocation
|
/* pngmem.c - stub functions for memory allocation
|
||||||
*
|
*
|
||||||
* libpng 1.0.11beta2 - April 11, 2001
|
* libpng 1.0.11beta3 - April 15, 2001
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
|
60
pngpread.c
60
pngpread.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngpread.c - read a png file in push mode
|
/* pngpread.c - read a png file in push mode
|
||||||
*
|
*
|
||||||
* libpng 1.0.11beta2 - April 11, 2001
|
* libpng 1.0.11beta3 - April 15, 2001
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
@ -585,10 +585,19 @@ png_push_save_buffer(png_structp png_ptr)
|
|||||||
old_buffer = png_ptr->save_buffer;
|
old_buffer = png_ptr->save_buffer;
|
||||||
png_ptr->save_buffer = (png_bytep)png_malloc(png_ptr,
|
png_ptr->save_buffer = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)new_max);
|
(png_uint_32)new_max);
|
||||||
|
if (png_ptr->save_buffer == (png_bytep)NULL)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Malloc of save buffer failed");
|
||||||
|
png_ptr->save_buffer=old_buffer;
|
||||||
|
png_ptr->current_buffer_size = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
png_memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
|
png_memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
|
||||||
png_free(png_ptr, old_buffer);
|
png_free(png_ptr, old_buffer);
|
||||||
png_ptr->save_buffer_max = new_max;
|
png_ptr->save_buffer_max = new_max;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (png_ptr->current_buffer_size)
|
if (png_ptr->current_buffer_size)
|
||||||
{
|
{
|
||||||
png_memcpy(png_ptr->save_buffer + png_ptr->save_buffer_size,
|
png_memcpy(png_ptr->save_buffer + png_ptr->save_buffer_size,
|
||||||
@ -1017,6 +1026,12 @@ png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
|
|||||||
|
|
||||||
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
|
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(length+1));
|
(png_uint_32)(length+1));
|
||||||
|
if (png_ptr->current_text == (png_charp)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "malloc of current text failed");
|
||||||
|
png_ptr->skip_length=length;
|
||||||
|
return;
|
||||||
|
}
|
||||||
png_ptr->current_text[length] = '\0';
|
png_ptr->current_text[length] = '\0';
|
||||||
png_ptr->current_text_ptr = png_ptr->current_text;
|
png_ptr->current_text_ptr = png_ptr->current_text;
|
||||||
png_ptr->current_text_size = (png_size_t)length;
|
png_ptr->current_text_size = (png_size_t)length;
|
||||||
@ -1068,6 +1083,11 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
text++;
|
text++;
|
||||||
|
|
||||||
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
|
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
|
||||||
|
if (text_ptr == (png_textp)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "malloc of text buffer failed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
|
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
|
||||||
text_ptr->key = key;
|
text_ptr->key = key;
|
||||||
#ifdef PNG_iTXt_SUPPORTED
|
#ifdef PNG_iTXt_SUPPORTED
|
||||||
@ -1110,6 +1130,12 @@ png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
|
|||||||
|
|
||||||
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
|
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(length+1));
|
(png_uint_32)(length+1));
|
||||||
|
if (png_ptr->current_text == (png_charp)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "malloc of zTXt buffer failed");
|
||||||
|
png_push_crc_skip(png_ptr, length);
|
||||||
|
return;
|
||||||
|
}
|
||||||
png_ptr->current_text[length] = '\0';
|
png_ptr->current_text[length] = '\0';
|
||||||
png_ptr->current_text_ptr = png_ptr->current_text;
|
png_ptr->current_text_ptr = png_ptr->current_text;
|
||||||
png_ptr->current_text_size = (png_size_t)length;
|
png_ptr->current_text_size = (png_size_t)length;
|
||||||
@ -1200,6 +1226,10 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
text = (png_charp)png_malloc(png_ptr,
|
text = (png_charp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out +
|
(png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out +
|
||||||
key_size + 1));
|
key_size + 1));
|
||||||
|
if (text == (png_charp)NULL)
|
||||||
|
png_warning(png_ptr, "Malloc of text block failed");
|
||||||
|
else
|
||||||
|
{
|
||||||
png_memcpy(text + key_size, png_ptr->zbuf,
|
png_memcpy(text + key_size, png_ptr->zbuf,
|
||||||
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
|
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
|
||||||
png_memcpy(text, key, key_size);
|
png_memcpy(text, key, key_size);
|
||||||
@ -1207,6 +1237,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
png_ptr->zstream.avail_out;
|
png_ptr->zstream.avail_out;
|
||||||
*(text + text_size) = '\0';
|
*(text + text_size) = '\0';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_charp tmp;
|
png_charp tmp;
|
||||||
@ -1215,6 +1246,10 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
text = (png_charp)png_malloc(png_ptr, text_size +
|
text = (png_charp)png_malloc(png_ptr, text_size +
|
||||||
(png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out
|
(png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out
|
||||||
+ 1));
|
+ 1));
|
||||||
|
if (text != (png_charp)NULL)
|
||||||
|
png_warning(png_ptr, "Malloc of new text block failed");
|
||||||
|
else
|
||||||
|
{
|
||||||
png_memcpy(text, tmp, text_size);
|
png_memcpy(text, tmp, text_size);
|
||||||
png_free(png_ptr, tmp);
|
png_free(png_ptr, tmp);
|
||||||
png_memcpy(text + text_size, png_ptr->zbuf,
|
png_memcpy(text + text_size, png_ptr->zbuf,
|
||||||
@ -1222,6 +1257,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out;
|
text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out;
|
||||||
*(text + text_size) = '\0';
|
*(text + text_size) = '\0';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (ret != Z_STREAM_END)
|
if (ret != Z_STREAM_END)
|
||||||
{
|
{
|
||||||
png_ptr->zstream.next_out = png_ptr->zbuf;
|
png_ptr->zstream.next_out = png_ptr->zbuf;
|
||||||
@ -1252,6 +1288,10 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
text += key_size;
|
text += key_size;
|
||||||
|
|
||||||
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
|
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
|
||||||
|
if (text_ptr == (png_textp)NULL)
|
||||||
|
png_warning (png_ptr, "Malloc of iTXt failed");
|
||||||
|
else
|
||||||
|
{
|
||||||
text_ptr->compression = PNG_TEXT_COMPRESSION_zTXt;
|
text_ptr->compression = PNG_TEXT_COMPRESSION_zTXt;
|
||||||
text_ptr->key = key;
|
text_ptr->key = key;
|
||||||
#ifdef PNG_iTXt_SUPPORTED
|
#ifdef PNG_iTXt_SUPPORTED
|
||||||
@ -1262,9 +1302,10 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
|
|
||||||
png_set_text(png_ptr, info_ptr, text_ptr, 1);
|
png_set_text(png_ptr, info_ptr, text_ptr, 1);
|
||||||
|
|
||||||
png_free(png_ptr, key);
|
|
||||||
png_free(png_ptr, text_ptr);
|
png_free(png_ptr, text_ptr);
|
||||||
}
|
}
|
||||||
|
png_free(png_ptr, key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1292,12 +1333,17 @@ png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length
|
|||||||
|
|
||||||
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
|
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(length+1));
|
(png_uint_32)(length+1));
|
||||||
|
if (png_ptr->current_text == (png_charp)NULL)
|
||||||
|
png_warning (png_ptr, "malloc of iTXt buffer failed");
|
||||||
|
else
|
||||||
|
{
|
||||||
png_ptr->current_text[length] = '\0';
|
png_ptr->current_text[length] = '\0';
|
||||||
png_ptr->current_text_ptr = png_ptr->current_text;
|
png_ptr->current_text_ptr = png_ptr->current_text;
|
||||||
png_ptr->current_text_size = (png_size_t)length;
|
png_ptr->current_text_size = (png_size_t)length;
|
||||||
png_ptr->current_text_left = (png_size_t)length;
|
png_ptr->current_text_left = (png_size_t)length;
|
||||||
png_ptr->process_mode = PNG_READ_iTXt_MODE;
|
png_ptr->process_mode = PNG_READ_iTXt_MODE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
|
png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
|
||||||
@ -1360,6 +1406,10 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
text++;
|
text++;
|
||||||
|
|
||||||
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
|
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
|
||||||
|
if(text_ptr == (png_textp)NULL)
|
||||||
|
png_warning (png_ptr, "Malloc of iTXt pointer failed");
|
||||||
|
else
|
||||||
|
{
|
||||||
text_ptr->compression = comp_flag + 2;
|
text_ptr->compression = comp_flag + 2;
|
||||||
text_ptr->key = key;
|
text_ptr->key = key;
|
||||||
text_ptr->lang = lang;
|
text_ptr->lang = lang;
|
||||||
@ -1373,6 +1423,7 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
|
|||||||
png_free(png_ptr, text_ptr);
|
png_free(png_ptr, text_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This function is called when we haven't found a handler for this
|
/* This function is called when we haven't found a handler for this
|
||||||
@ -1418,6 +1469,10 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 len
|
|||||||
|
|
||||||
png_strcpy((png_charp)chunk.name, (png_charp)png_ptr->chunk_name);
|
png_strcpy((png_charp)chunk.name, (png_charp)png_ptr->chunk_name);
|
||||||
chunk.data = (png_bytep)png_malloc(png_ptr, length);
|
chunk.data = (png_bytep)png_malloc(png_ptr, length);
|
||||||
|
if (chunk.data == (png_bytep)NULL)
|
||||||
|
png_warning (png_ptr, "Malloc of unknown chunk data failed");
|
||||||
|
else
|
||||||
|
{
|
||||||
png_crc_read(png_ptr, chunk.data, length);
|
png_crc_read(png_ptr, chunk.data, length);
|
||||||
chunk.size = length;
|
chunk.size = length;
|
||||||
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
||||||
@ -1438,6 +1493,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 len
|
|||||||
png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);
|
png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);
|
||||||
png_free(png_ptr, chunk.data);
|
png_free(png_ptr, chunk.data);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
skip=length;
|
skip=length;
|
||||||
|
25
pngread.c
25
pngread.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngread.c - read a PNG file
|
/* pngread.c - read a PNG file
|
||||||
*
|
*
|
||||||
* libpng 1.0.11beta2 - April 11, 2001
|
* libpng 1.0.11beta3 - April 15, 2001
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
@ -115,6 +115,8 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
||||||
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)png_ptr->zbuf_size);
|
(png_uint_32)png_ptr->zbuf_size);
|
||||||
|
if (png_ptr->zbuf == (png_bytep)NULL)
|
||||||
|
png_error(png_ptr, "Could not allocate zbuf");
|
||||||
png_ptr->zstream.zalloc = png_zalloc;
|
png_ptr->zstream.zalloc = png_zalloc;
|
||||||
png_ptr->zstream.zfree = png_zfree;
|
png_ptr->zstream.zfree = png_zfree;
|
||||||
png_ptr->zstream.opaque = (voidpf)png_ptr;
|
png_ptr->zstream.opaque = (voidpf)png_ptr;
|
||||||
@ -197,6 +199,8 @@ png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver,
|
|||||||
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
||||||
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)png_ptr->zbuf_size);
|
(png_uint_32)png_ptr->zbuf_size);
|
||||||
|
if (png_ptr->zbuf == (png_bytep)NULL)
|
||||||
|
png_error(png_ptr, "Could not allocate zbuf");
|
||||||
png_ptr->zstream.zalloc = png_zalloc;
|
png_ptr->zstream.zalloc = png_zalloc;
|
||||||
png_ptr->zstream.zfree = png_zfree;
|
png_ptr->zstream.zfree = png_zfree;
|
||||||
png_ptr->zstream.opaque = (voidpf)png_ptr;
|
png_ptr->zstream.opaque = (voidpf)png_ptr;
|
||||||
@ -715,7 +719,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
|
|||||||
* not called png_set_interlace_handling(), the display_row buffer will
|
* not called png_set_interlace_handling(), the display_row buffer will
|
||||||
* be ignored, so pass NULL to it.
|
* be ignored, so pass NULL to it.
|
||||||
*
|
*
|
||||||
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.11beta2
|
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.11beta3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
@ -764,7 +768,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
|
|||||||
* only call this function once. If you desire to have an image for
|
* only call this function once. If you desire to have an image for
|
||||||
* each pass of a interlaced image, use png_read_rows() instead.
|
* each pass of a interlaced image, use png_read_rows() instead.
|
||||||
*
|
*
|
||||||
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.11beta2
|
* [*] png_handle_alpha() does not exist yet, as of libpng version 1.0.11beta3
|
||||||
*/
|
*/
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_read_image(png_structp png_ptr, png_bytepp image)
|
png_read_image(png_structp png_ptr, png_bytepp image)
|
||||||
@ -1305,7 +1309,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
|
|||||||
|
|
||||||
/* Optional call to gamma correct and add the background to the palette
|
/* Optional call to gamma correct and add the background to the palette
|
||||||
* and update info structure. REQUIRED if you are expecting libpng to
|
* and update info structure. REQUIRED if you are expecting libpng to
|
||||||
* update the palette for you (ie you selected such a transform above).
|
* update the palette for you (i.e., you selected such a transform above).
|
||||||
*/
|
*/
|
||||||
png_read_update_info(png_ptr, info_ptr);
|
png_read_update_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
@ -1318,12 +1322,25 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
|
|||||||
{
|
{
|
||||||
info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr,
|
info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr,
|
||||||
info_ptr->height * sizeof(png_bytep));
|
info_ptr->height * sizeof(png_bytep));
|
||||||
|
if (info_ptr->row_pointers)
|
||||||
|
png_error(png_ptr, "png_read_png could not allocate row pointers");
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
info_ptr->free_me |= PNG_FREE_ROWS;
|
info_ptr->free_me |= PNG_FREE_ROWS;
|
||||||
#endif
|
#endif
|
||||||
for (row = 0; row < (int)info_ptr->height; row++)
|
for (row = 0; row < (int)info_ptr->height; row++)
|
||||||
|
{
|
||||||
info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr,
|
info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr,
|
||||||
png_get_rowbytes(png_ptr, info_ptr));
|
png_get_rowbytes(png_ptr, info_ptr));
|
||||||
|
if (info_ptr->row_pointers)
|
||||||
|
{
|
||||||
|
int allocated_row;
|
||||||
|
for (allocated_row=0; allocated_row < row; allocated_row++)
|
||||||
|
png_free(png_ptr, info_ptr->row_pointers[allocated_row]);
|
||||||
|
if (info_ptr->free_me & !(PNG_FREE_ROWS))
|
||||||
|
png_free (png_ptr, info_ptr->row_pointers);
|
||||||
|
png_error(png_ptr, "png_read_png could not allocate row pointer");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
png_read_image(png_ptr, info_ptr->row_pointers);
|
png_read_image(png_ptr, info_ptr->row_pointers);
|
||||||
|
2
pngrio.c
2
pngrio.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngrio.c - functions for data input
|
/* pngrio.c - functions for data input
|
||||||
*
|
*
|
||||||
* libpng 1.0.11beta2 - April 11, 2001
|
* libpng 1.0.11beta3 - April 15, 2001
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
|
99
pngrtran.c
99
pngrtran.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||||
*
|
*
|
||||||
* libpng 1.0.11beta2 - April 11, 2001
|
* libpng 1.0.11beta3 - April 15, 2001
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
@ -155,6 +155,11 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
|||||||
|
|
||||||
png_ptr->dither_index = (png_bytep)png_malloc(png_ptr,
|
png_ptr->dither_index = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)(num_palette * sizeof (png_byte)));
|
(png_uint_32)(num_palette * sizeof (png_byte)));
|
||||||
|
if (png_ptr->dither_index == (png_bytep)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Malloc of dither index failed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (i = 0; i < num_palette; i++)
|
for (i = 0; i < num_palette; i++)
|
||||||
png_ptr->dither_index[i] = (png_byte)i;
|
png_ptr->dither_index[i] = (png_byte)i;
|
||||||
}
|
}
|
||||||
@ -172,6 +177,12 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
|||||||
/* initialize an array to sort colors */
|
/* initialize an array to sort colors */
|
||||||
sort = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_palette
|
sort = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_palette
|
||||||
* sizeof (png_byte)));
|
* sizeof (png_byte)));
|
||||||
|
if (sort == (png_bytep)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Malloc of sort array for dither failed");
|
||||||
|
png_free (png_ptr, png_ptr->dither_index);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* initialize the sort array */
|
/* initialize the sort array */
|
||||||
for (i = 0; i < num_palette; i++)
|
for (i = 0; i < num_palette; i++)
|
||||||
@ -302,6 +313,14 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
|||||||
(png_uint_32)(num_palette * sizeof (png_byte)));
|
(png_uint_32)(num_palette * sizeof (png_byte)));
|
||||||
palette_to_index = (png_bytep)png_malloc(png_ptr,
|
palette_to_index = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)(num_palette * sizeof (png_byte)));
|
(png_uint_32)(num_palette * sizeof (png_byte)));
|
||||||
|
if (index_to_palette == (png_bytep)NULL || palette_to_index ==
|
||||||
|
(png_bytep)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Malloc of index array for dither failed");
|
||||||
|
png_free (png_ptr, index_to_palette);
|
||||||
|
png_free (png_ptr, png_ptr->dither_index);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* initialize the sort array */
|
/* initialize the sort array */
|
||||||
for (i = 0; i < num_palette; i++)
|
for (i = 0; i < num_palette; i++)
|
||||||
@ -312,6 +331,14 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
|||||||
|
|
||||||
hash = (png_dsortpp)png_malloc(png_ptr, (png_uint_32)(769 *
|
hash = (png_dsortpp)png_malloc(png_ptr, (png_uint_32)(769 *
|
||||||
sizeof (png_dsortp)));
|
sizeof (png_dsortp)));
|
||||||
|
if (hash == (png_dsortpp)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Malloc of hash array for dither failed");
|
||||||
|
png_free (png_ptr, palette_to_index);
|
||||||
|
png_free (png_ptr, index_to_palette);
|
||||||
|
png_free (png_ptr, png_ptr->dither_index);
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (i = 0; i < 769; i++)
|
for (i = 0; i < 769; i++)
|
||||||
hash[i] = NULL;
|
hash[i] = NULL;
|
||||||
/* png_memset(hash, 0, 769 * sizeof (png_dsortp)); */
|
/* png_memset(hash, 0, 769 * sizeof (png_dsortp)); */
|
||||||
@ -346,6 +373,8 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
|||||||
|
|
||||||
t = (png_dsortp)png_malloc(png_ptr, (png_uint_32)(sizeof
|
t = (png_dsortp)png_malloc(png_ptr, (png_uint_32)(sizeof
|
||||||
(png_dsort)));
|
(png_dsort)));
|
||||||
|
if (t != (png_dsortp)NULL)
|
||||||
|
{
|
||||||
t->next = hash[d];
|
t->next = hash[d];
|
||||||
t->left = (png_byte)i;
|
t->left = (png_byte)i;
|
||||||
t->right = (png_byte)j;
|
t->right = (png_byte)j;
|
||||||
@ -353,6 +382,7 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i <= max_d; i++)
|
for (i = 0; i <= max_d; i++)
|
||||||
{
|
{
|
||||||
@ -456,12 +486,21 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
|||||||
|
|
||||||
png_ptr->palette_lookup = (png_bytep )png_malloc(png_ptr,
|
png_ptr->palette_lookup = (png_bytep )png_malloc(png_ptr,
|
||||||
(png_uint_32)(num_entries * sizeof (png_byte)));
|
(png_uint_32)(num_entries * sizeof (png_byte)));
|
||||||
|
if (png_ptr->palette_lookup == (png_bytep)NULL)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Malloc of palette_lookup for dither failed");
|
||||||
|
}
|
||||||
|
else
|
||||||
png_memset(png_ptr->palette_lookup, 0, num_entries * sizeof (png_byte));
|
png_memset(png_ptr->palette_lookup, 0, num_entries * sizeof (png_byte));
|
||||||
|
|
||||||
distance = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_entries *
|
distance = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_entries *
|
||||||
sizeof(png_byte)));
|
sizeof(png_byte)));
|
||||||
|
if (distance == (png_bytep)NULL)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Malloc of distance array for dither failed");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
png_memset(distance, 0xff, num_entries * sizeof(png_byte));
|
png_memset(distance, 0xff, num_entries * sizeof(png_byte));
|
||||||
|
|
||||||
for (i = 0; i < num_palette; i++)
|
for (i = 0; i < num_palette; i++)
|
||||||
@ -503,6 +542,7 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
|||||||
png_free(png_ptr, distance);
|
png_free(png_ptr, distance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
|
#if defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
|
||||||
@ -3858,6 +3898,11 @@ png_build_gamma_table(png_structp png_ptr)
|
|||||||
|
|
||||||
png_ptr->gamma_table = (png_bytep)png_malloc(png_ptr,
|
png_ptr->gamma_table = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)256);
|
(png_uint_32)256);
|
||||||
|
if (png_ptr->gamma_table == (png_bytep)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Malloc of gamma table failed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
{
|
{
|
||||||
@ -3874,6 +3919,11 @@ png_build_gamma_table(png_structp png_ptr)
|
|||||||
|
|
||||||
png_ptr->gamma_to_1 = (png_bytep)png_malloc(png_ptr,
|
png_ptr->gamma_to_1 = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)256);
|
(png_uint_32)256);
|
||||||
|
if (png_ptr->gamma_to_1 == (png_bytep)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Malloc of gamma_to_1 table failed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
{
|
{
|
||||||
@ -3884,6 +3934,11 @@ png_build_gamma_table(png_structp png_ptr)
|
|||||||
|
|
||||||
png_ptr->gamma_from_1 = (png_bytep)png_malloc(png_ptr,
|
png_ptr->gamma_from_1 = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)256);
|
(png_uint_32)256);
|
||||||
|
if (png_ptr->gamma_from_1 == (png_bytep)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Malloc of gamma_from_1 table failed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(png_ptr->screen_gamma > 0.000001)
|
if(png_ptr->screen_gamma > 0.000001)
|
||||||
g = 1.0 / png_ptr->screen_gamma;
|
g = 1.0 / png_ptr->screen_gamma;
|
||||||
@ -3946,6 +4001,11 @@ png_build_gamma_table(png_structp png_ptr)
|
|||||||
|
|
||||||
png_ptr->gamma_16_table = (png_uint_16pp)png_malloc(png_ptr,
|
png_ptr->gamma_16_table = (png_uint_16pp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(num * sizeof (png_uint_16p)));
|
(png_uint_32)(num * sizeof (png_uint_16p)));
|
||||||
|
if (png_ptr->gamma_16_table == (png_uint_16pp)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Malloc of gamma_16 table failed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (png_ptr->transformations & (PNG_16_TO_8 | PNG_BACKGROUND))
|
if (png_ptr->transformations & (PNG_16_TO_8 | PNG_BACKGROUND))
|
||||||
{
|
{
|
||||||
@ -3956,6 +4016,11 @@ png_build_gamma_table(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr,
|
png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr,
|
||||||
(png_uint_32)(256 * sizeof (png_uint_16)));
|
(png_uint_32)(256 * sizeof (png_uint_16)));
|
||||||
|
if (png_ptr->gamma_16_table[i] == (png_uint_16p)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Malloc of gamma_16 table entry failed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g = 1.0 / g;
|
g = 1.0 / g;
|
||||||
@ -3986,6 +4051,11 @@ png_build_gamma_table(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr,
|
png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr,
|
||||||
(png_uint_32)(256 * sizeof (png_uint_16)));
|
(png_uint_32)(256 * sizeof (png_uint_16)));
|
||||||
|
if (png_ptr->gamma_16_table[i] == (png_uint_16p)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Malloc of gamma_16 table entry failed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ig = (((png_uint_32)i * (png_uint_32)png_gamma_shift[shift]) >> 4);
|
ig = (((png_uint_32)i * (png_uint_32)png_gamma_shift[shift]) >> 4);
|
||||||
for (j = 0; j < 256; j++)
|
for (j = 0; j < 256; j++)
|
||||||
@ -4006,11 +4076,22 @@ png_build_gamma_table(png_structp png_ptr)
|
|||||||
|
|
||||||
png_ptr->gamma_16_to_1 = (png_uint_16pp)png_malloc(png_ptr,
|
png_ptr->gamma_16_to_1 = (png_uint_16pp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(num * sizeof (png_uint_16p )));
|
(png_uint_32)(num * sizeof (png_uint_16p )));
|
||||||
|
if (png_ptr->gamma_16_to_1 == (png_uint_16pp)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Malloc of gamma_16_to_1 table failed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
png_ptr->gamma_16_to_1[i] = (png_uint_16p)png_malloc(png_ptr,
|
png_ptr->gamma_16_to_1[i] = (png_uint_16p)png_malloc(png_ptr,
|
||||||
(png_uint_32)(256 * sizeof (png_uint_16)));
|
(png_uint_32)(256 * sizeof (png_uint_16)));
|
||||||
|
if (png_ptr->gamma_16_to_1[i] == (png_uint_16p)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr,
|
||||||
|
"Malloc of gamma_16_to_1 table entry failed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ig = (((png_uint_32)i *
|
ig = (((png_uint_32)i *
|
||||||
(png_uint_32)png_gamma_shift[shift]) >> 4);
|
(png_uint_32)png_gamma_shift[shift]) >> 4);
|
||||||
@ -4029,11 +4110,23 @@ png_build_gamma_table(png_structp png_ptr)
|
|||||||
|
|
||||||
png_ptr->gamma_16_from_1 = (png_uint_16pp)png_malloc(png_ptr,
|
png_ptr->gamma_16_from_1 = (png_uint_16pp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(num * sizeof (png_uint_16p)));
|
(png_uint_32)(num * sizeof (png_uint_16p)));
|
||||||
|
if (png_ptr->gamma_16_from_1 == (png_uint_16pp)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr,
|
||||||
|
"Malloc of gamma_16_from_1 table failed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
png_ptr->gamma_16_from_1[i] = (png_uint_16p)png_malloc(png_ptr,
|
png_ptr->gamma_16_from_1[i] = (png_uint_16p)png_malloc(png_ptr,
|
||||||
(png_uint_32)(256 * sizeof (png_uint_16)));
|
(png_uint_32)(256 * sizeof (png_uint_16)));
|
||||||
|
if (png_ptr->gamma_16_from_1[i] == (png_uint_16p)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr,
|
||||||
|
"Malloc of gamma_16_from_1 table failed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ig = (((png_uint_32)i *
|
ig = (((png_uint_32)i *
|
||||||
(png_uint_32)png_gamma_shift[shift]) >> 4);
|
(png_uint_32)png_gamma_shift[shift]) >> 4);
|
||||||
|
128
pngrutil.c
128
pngrutil.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngrutil.c - utilities to read a PNG file
|
/* pngrutil.c - utilities to read a PNG file
|
||||||
*
|
*
|
||||||
* libpng 1.0.11beta2 - April 11, 2001
|
* libpng 1.0.11beta3 - April 15, 2001
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
@ -201,15 +201,19 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
|||||||
{
|
{
|
||||||
text_size = prefix_size + sizeof(msg) + 1;
|
text_size = prefix_size + sizeof(msg) + 1;
|
||||||
text = (png_charp)png_malloc(png_ptr, text_size);
|
text = (png_charp)png_malloc(png_ptr, text_size);
|
||||||
|
if (text != NULL)
|
||||||
png_memcpy(text, chunkdata, prefix_size);
|
png_memcpy(text, chunkdata, prefix_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (text != NULL)
|
||||||
|
{
|
||||||
text[text_size - 1] = 0x00;
|
text[text_size - 1] = 0x00;
|
||||||
|
|
||||||
/* Copy what we can of the error message into the text chunk */
|
/* Copy what we can of the error message into the text chunk */
|
||||||
text_size = (png_size_t)(chunklength - (text - chunkdata) - 1);
|
text_size = (png_size_t)(chunklength - (text - chunkdata) - 1);
|
||||||
text_size = sizeof(msg) > text_size ? text_size : sizeof(msg);
|
text_size = sizeof(msg) > text_size ? text_size : sizeof(msg);
|
||||||
png_memcpy(text + prefix_size, msg, text_size + 1);
|
png_memcpy(text + prefix_size, msg, text_size + 1);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!png_ptr->zstream.avail_out || ret == Z_STREAM_END)
|
if (!png_ptr->zstream.avail_out || ret == Z_STREAM_END)
|
||||||
@ -219,11 +223,14 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
|||||||
text_size = prefix_size +
|
text_size = prefix_size +
|
||||||
png_ptr->zbuf_size - png_ptr->zstream.avail_out;
|
png_ptr->zbuf_size - png_ptr->zstream.avail_out;
|
||||||
text = (png_charp)png_malloc(png_ptr, text_size + 1);
|
text = (png_charp)png_malloc(png_ptr, text_size + 1);
|
||||||
|
if (text != NULL)
|
||||||
|
{
|
||||||
png_memcpy(text + prefix_size, png_ptr->zbuf,
|
png_memcpy(text + prefix_size, png_ptr->zbuf,
|
||||||
text_size - prefix_size);
|
text_size - prefix_size);
|
||||||
png_memcpy(text, chunkdata, prefix_size);
|
png_memcpy(text, chunkdata, prefix_size);
|
||||||
*(text + text_size) = 0x00;
|
*(text + text_size) = 0x00;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_charp tmp;
|
png_charp tmp;
|
||||||
@ -231,6 +238,8 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
|||||||
tmp = text;
|
tmp = text;
|
||||||
text = (png_charp)png_malloc(png_ptr, (png_uint_32)(text_size +
|
text = (png_charp)png_malloc(png_ptr, (png_uint_32)(text_size +
|
||||||
png_ptr->zbuf_size - png_ptr->zstream.avail_out + 1));
|
png_ptr->zbuf_size - png_ptr->zstream.avail_out + 1));
|
||||||
|
if (text != NULL)
|
||||||
|
{
|
||||||
png_memcpy(text, tmp, text_size);
|
png_memcpy(text, tmp, text_size);
|
||||||
png_free(png_ptr, tmp);
|
png_free(png_ptr, tmp);
|
||||||
png_memcpy(text + text_size, png_ptr->zbuf,
|
png_memcpy(text + text_size, png_ptr->zbuf,
|
||||||
@ -238,6 +247,12 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
|||||||
text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out;
|
text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out;
|
||||||
*(text + text_size) = 0x00;
|
*(text + text_size) = 0x00;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Could not malloc text buffer");
|
||||||
|
text=tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (ret == Z_STREAM_END)
|
if (ret == Z_STREAM_END)
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
@ -270,8 +285,12 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
|||||||
if (text == NULL)
|
if (text == NULL)
|
||||||
{
|
{
|
||||||
text = (png_charp)png_malloc(png_ptr, text_size+1);
|
text = (png_charp)png_malloc(png_ptr, text_size+1);
|
||||||
|
if (text != NULL)
|
||||||
png_memcpy(text, chunkdata, prefix_size);
|
png_memcpy(text, chunkdata, prefix_size);
|
||||||
|
else
|
||||||
|
png_warning(png_ptr, "Could not malloc text chunkdata");
|
||||||
}
|
}
|
||||||
|
if (text != NULL)
|
||||||
*(text + text_size) = 0x00;
|
*(text + text_size) = 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -983,7 +1002,14 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
|
|
||||||
chunkdata = (png_charp)png_malloc(png_ptr, length + 1);
|
chunkdata = (png_charp)png_malloc(png_ptr, length + 1);
|
||||||
slength = (png_size_t)length;
|
slength = (png_size_t)length;
|
||||||
|
if (chunkdata != (png_charp)NULL)
|
||||||
png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
|
png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Could not allocate memory for iCCP chunk");
|
||||||
|
png_crc_finish(png_ptr, slength);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (png_crc_finish(png_ptr, skip))
|
if (png_crc_finish(png_ptr, skip))
|
||||||
{
|
{
|
||||||
@ -1079,8 +1105,16 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
chunkdata = (png_bytep)png_malloc(png_ptr, length + 1);
|
chunkdata = (png_bytep)png_malloc(png_ptr, length + 1);
|
||||||
|
if (chunkdata != (png_bytep)NULL)
|
||||||
|
{
|
||||||
slength = (png_size_t)length;
|
slength = (png_size_t)length;
|
||||||
png_crc_read(png_ptr, chunkdata, slength);
|
png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Could not allocate memory for sPLT chunk");
|
||||||
|
skip = (png_size_t)length;
|
||||||
|
}
|
||||||
|
|
||||||
if (png_crc_finish(png_ptr, skip))
|
if (png_crc_finish(png_ptr, skip))
|
||||||
{
|
{
|
||||||
@ -1110,12 +1144,19 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
if (data_length % entry_size)
|
if (data_length % entry_size)
|
||||||
{
|
{
|
||||||
png_free(png_ptr, chunkdata);
|
png_free(png_ptr, chunkdata);
|
||||||
png_error(png_ptr, "sPLT chunk has bad length");
|
png_warning(png_ptr, "sPLT chunk has bad length");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_palette.nentries = data_length / entry_size;
|
new_palette.nentries = data_length / entry_size;
|
||||||
new_palette.entries = (png_sPLT_entryp)png_malloc(
|
new_palette.entries = (png_sPLT_entryp)png_malloc(
|
||||||
png_ptr, new_palette.nentries * sizeof(png_sPLT_entry));
|
png_ptr, new_palette.nentries * sizeof(png_sPLT_entry));
|
||||||
|
if (new_palette.entries == (png_sPLT_entryp)NULL)
|
||||||
|
{
|
||||||
|
png_free(png_ptr, chunkdata);
|
||||||
|
png_warning (png_ptr, "Could not allocate sPLT entries");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef PNG_NO_POINTER_INDEXING
|
#ifndef PNG_NO_POINTER_INDEXING
|
||||||
for (i = 0; i < new_palette.nentries; i++)
|
for (i = 0; i < new_palette.nentries; i++)
|
||||||
@ -1525,6 +1566,12 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
png_debug1(2, "Allocating and reading pCAL chunk data (%lu bytes)\n",
|
png_debug1(2, "Allocating and reading pCAL chunk data (%lu bytes)\n",
|
||||||
length + 1);
|
length + 1);
|
||||||
purpose = (png_charp)png_malloc(png_ptr, length + 1);
|
purpose = (png_charp)png_malloc(png_ptr, length + 1);
|
||||||
|
if (purpose == (png_charp)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Could not allocate memory for pCAL purpose");
|
||||||
|
png_crc_finish(png_ptr, length);
|
||||||
|
return;
|
||||||
|
}
|
||||||
slength = (png_size_t)length;
|
slength = (png_size_t)length;
|
||||||
png_crc_read(png_ptr, (png_bytep)purpose, slength);
|
png_crc_read(png_ptr, (png_bytep)purpose, slength);
|
||||||
|
|
||||||
@ -1581,6 +1628,11 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
png_debug(3, "Allocating pCAL parameters array\n");
|
png_debug(3, "Allocating pCAL parameters array\n");
|
||||||
params = (png_charpp)png_malloc(png_ptr, (png_uint_32)(nparams
|
params = (png_charpp)png_malloc(png_ptr, (png_uint_32)(nparams
|
||||||
*sizeof(png_charp))) ;
|
*sizeof(png_charp))) ;
|
||||||
|
if (params == (png_charpp)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Could not allocate pCAL parameters array");
|
||||||
|
nparams=0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get pointers to the start of each parameter string. */
|
/* Get pointers to the start of each parameter string. */
|
||||||
for (i = 0; i < (int)nparams; i++)
|
for (i = 0; i < (int)nparams; i++)
|
||||||
@ -1645,6 +1697,12 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
png_debug1(2, "Allocating and reading sCAL chunk data (%lu bytes)\n",
|
png_debug1(2, "Allocating and reading sCAL chunk data (%lu bytes)\n",
|
||||||
length + 1);
|
length + 1);
|
||||||
buffer = (png_charp)png_malloc(png_ptr, length + 1);
|
buffer = (png_charp)png_malloc(png_ptr, length + 1);
|
||||||
|
if (buffer == (png_charp)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Could not allocate memory for sCAL buffer");
|
||||||
|
png_crc_finish(png_ptr, length);
|
||||||
|
return;
|
||||||
|
}
|
||||||
slength = (png_size_t)length;
|
slength = (png_size_t)length;
|
||||||
png_crc_read(png_ptr, (png_bytep)buffer, slength);
|
png_crc_read(png_ptr, (png_bytep)buffer, slength);
|
||||||
|
|
||||||
@ -1668,6 +1726,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
#else
|
#else
|
||||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||||
swidth = (png_charp)png_malloc(png_ptr, png_strlen(ep) + 1);
|
swidth = (png_charp)png_malloc(png_ptr, png_strlen(ep) + 1);
|
||||||
|
if (swidth != (png_charp)NULL)
|
||||||
png_memcpy(swidth, ep, (png_size_t)png_strlen(ep));
|
png_memcpy(swidth, ep, (png_size_t)png_strlen(ep));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -1686,6 +1745,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
#else
|
#else
|
||||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||||
sheight = (png_charp)png_malloc(png_ptr, png_strlen(ep) + 1);
|
sheight = (png_charp)png_malloc(png_ptr, png_strlen(ep) + 1);
|
||||||
|
if (sheight != (png_charp)NULL)
|
||||||
png_memcpy(sheight, ep, (png_size_t)png_strlen(ep));
|
png_memcpy(sheight, ep, (png_size_t)png_strlen(ep));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -1795,6 +1855,13 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
|
|
||||||
key = (png_charp)png_malloc(png_ptr, length + 1);
|
key = (png_charp)png_malloc(png_ptr, length + 1);
|
||||||
slength = (png_size_t)length;
|
slength = (png_size_t)length;
|
||||||
|
if (key == (png_charp)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Could not allocate memory for tEXt chunk");
|
||||||
|
png_crc_finish(png_ptr, slength);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
png_crc_read(png_ptr, (png_bytep)key, slength);
|
png_crc_read(png_ptr, (png_bytep)key, slength);
|
||||||
|
|
||||||
if (png_crc_finish(png_ptr, skip))
|
if (png_crc_finish(png_ptr, skip))
|
||||||
@ -1812,6 +1879,8 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
text++;
|
text++;
|
||||||
|
|
||||||
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
|
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
|
||||||
|
if (text_ptr != (png_textp)NULL)
|
||||||
|
{
|
||||||
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
|
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
|
||||||
text_ptr->key = key;
|
text_ptr->key = key;
|
||||||
#ifdef PNG_iTXt_SUPPORTED
|
#ifdef PNG_iTXt_SUPPORTED
|
||||||
@ -1824,9 +1893,12 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
|
|
||||||
png_set_text(png_ptr, info_ptr, text_ptr, 1);
|
png_set_text(png_ptr, info_ptr, text_ptr, 1);
|
||||||
|
|
||||||
png_free(png_ptr, key);
|
|
||||||
png_free(png_ptr, text_ptr);
|
png_free(png_ptr, text_ptr);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
png_warning(png_ptr, "Could not allocate iTXt pointer");
|
||||||
|
png_free(png_ptr, key);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_zTXt_SUPPORTED)
|
#if defined(PNG_READ_zTXt_SUPPORTED)
|
||||||
@ -1859,8 +1931,17 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
chunkdata = (png_charp)png_malloc(png_ptr, length + 1);
|
chunkdata = (png_charp)png_malloc(png_ptr, length + 1);
|
||||||
|
if (chunkdata != (png_charp)NULL)
|
||||||
|
{
|
||||||
slength = (png_size_t)length;
|
slength = (png_size_t)length;
|
||||||
png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
|
png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Could not allocate memory for zTXt chunk data");
|
||||||
|
png_crc_finish(png_ptr, length);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (png_crc_finish(png_ptr, 0))
|
if (png_crc_finish(png_ptr, 0))
|
||||||
{
|
{
|
||||||
png_free(png_ptr, chunkdata);
|
png_free(png_ptr, chunkdata);
|
||||||
@ -1894,6 +1975,8 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
(png_size_t)length, prefix_len, &data_len);
|
(png_size_t)length, prefix_len, &data_len);
|
||||||
|
|
||||||
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
|
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
|
||||||
|
if (text_ptr != (png_textp)NULL)
|
||||||
|
{
|
||||||
text_ptr->compression = comp_type;
|
text_ptr->compression = comp_type;
|
||||||
text_ptr->key = chunkdata;
|
text_ptr->key = chunkdata;
|
||||||
#ifdef PNG_iTXt_SUPPORTED
|
#ifdef PNG_iTXt_SUPPORTED
|
||||||
@ -1907,6 +1990,9 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
png_set_text(png_ptr, info_ptr, text_ptr, 1);
|
png_set_text(png_ptr, info_ptr, text_ptr, 1);
|
||||||
|
|
||||||
png_free(png_ptr, text_ptr);
|
png_free(png_ptr, text_ptr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
png_warning (png_ptr, "Could not allocate memory for zTXt data");
|
||||||
png_free(png_ptr, chunkdata);
|
png_free(png_ptr, chunkdata);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1943,8 +2029,17 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
chunkdata = (png_charp)png_malloc(png_ptr, length + 1);
|
chunkdata = (png_charp)png_malloc(png_ptr, length + 1);
|
||||||
|
if (chunkdata != (png_charp)NULL)
|
||||||
|
{
|
||||||
slength = (png_size_t)length;
|
slength = (png_size_t)length;
|
||||||
png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
|
png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Could not allocate memory for iTXt chunk data");
|
||||||
|
png_crc_finish(png_ptr, length);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (png_crc_finish(png_ptr, 0))
|
if (png_crc_finish(png_ptr, 0))
|
||||||
{
|
{
|
||||||
png_free(png_ptr, chunkdata);
|
png_free(png_ptr, chunkdata);
|
||||||
@ -1989,6 +2084,8 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
else
|
else
|
||||||
data_len=png_strlen(chunkdata + prefix_len);
|
data_len=png_strlen(chunkdata + prefix_len);
|
||||||
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
|
text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
|
||||||
|
if (text_ptr != (png_textp)NULL)
|
||||||
|
{
|
||||||
text_ptr->compression = (int)comp_flag + 1;
|
text_ptr->compression = (int)comp_flag + 1;
|
||||||
text_ptr->lang_key = chunkdata+(lang_key-key);
|
text_ptr->lang_key = chunkdata+(lang_key-key);
|
||||||
text_ptr->lang = chunkdata+(lang-key);
|
text_ptr->lang = chunkdata+(lang-key);
|
||||||
@ -2000,6 +2097,9 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
png_set_text(png_ptr, info_ptr, text_ptr, 1);
|
png_set_text(png_ptr, info_ptr, text_ptr, 1);
|
||||||
|
|
||||||
png_free(png_ptr, text_ptr);
|
png_free(png_ptr, text_ptr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
png_warning (png_ptr, "Could not allocate memory for iTXt chunk data");
|
||||||
png_free(png_ptr, chunkdata);
|
png_free(png_ptr, chunkdata);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -2055,8 +2155,17 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
#endif
|
#endif
|
||||||
png_strcpy((png_charp)chunk.name, (png_charp)png_ptr->chunk_name);
|
png_strcpy((png_charp)chunk.name, (png_charp)png_ptr->chunk_name);
|
||||||
chunk.data = (png_bytep)png_malloc(png_ptr, length);
|
chunk.data = (png_bytep)png_malloc(png_ptr, length);
|
||||||
png_crc_read(png_ptr, chunk.data, length);
|
if (chunk.data != (png_bytep)NULL)
|
||||||
chunk.size = length;
|
{
|
||||||
|
chunk.size = (png_size_t)length;
|
||||||
|
png_crc_read(png_ptr, (png_bytep)chunk.data, length);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Could not allocate memory for iTXt chunk data");
|
||||||
|
png_crc_finish(png_ptr, length);
|
||||||
|
return;
|
||||||
|
}
|
||||||
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
|
||||||
if(png_ptr->read_user_chunk_fn != (png_user_chunk_ptr)NULL)
|
if(png_ptr->read_user_chunk_fn != (png_user_chunk_ptr)NULL)
|
||||||
{
|
{
|
||||||
@ -2963,6 +3072,8 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
|||||||
png_error(png_ptr, "This image requires a row greater than 64KB");
|
png_error(png_ptr, "This image requires a row greater than 64KB");
|
||||||
#endif
|
#endif
|
||||||
png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, row_bytes);
|
png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, row_bytes);
|
||||||
|
if (png_ptr->row_buf == (png_bytep)NULL)
|
||||||
|
png_error (png_ptr, "Could not allocate memory for row buffer");
|
||||||
png_ptr->row_buf_size = row_bytes;
|
png_ptr->row_buf_size = row_bytes;
|
||||||
|
|
||||||
#ifdef PNG_MAX_MALLOC_64K
|
#ifdef PNG_MAX_MALLOC_64K
|
||||||
@ -2971,6 +3082,11 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
|||||||
#endif
|
#endif
|
||||||
png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)(
|
png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)(
|
||||||
png_ptr->rowbytes + 1));
|
png_ptr->rowbytes + 1));
|
||||||
|
if (png_ptr->prev_row == (png_bytep)NULL)
|
||||||
|
{
|
||||||
|
png_free (png_ptr, png_ptr->row_buf);
|
||||||
|
png_error (png_ptr, "Could not allocate memory for previous row buffer");
|
||||||
|
}
|
||||||
|
|
||||||
png_memset_check(png_ptr, png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
|
png_memset_check(png_ptr, png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
|
||||||
|
|
||||||
|
102
pngset.c
102
pngset.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngset.c - storage of image information into info struct
|
/* pngset.c - storage of image information into info struct
|
||||||
*
|
*
|
||||||
* libpng 1.0.11beta2 - April 11, 2001
|
* libpng 1.0.11beta3 - April 15, 2001
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
@ -143,14 +143,22 @@ png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
|
|||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
if (info_ptr->num_palette == 0)
|
if (info_ptr->num_palette == 0)
|
||||||
|
{
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Palette size 0, hIST allocation skipped.");
|
"Palette size 0, hIST allocation skipped.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0);
|
png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0);
|
||||||
#endif
|
#endif
|
||||||
png_ptr->hist = (png_uint_16p)png_malloc(png_ptr,
|
png_ptr->hist = (png_uint_16p)png_malloc(png_ptr,
|
||||||
(png_uint_32)(info_ptr->num_palette * sizeof (png_uint_16)));
|
(png_uint_32)(info_ptr->num_palette * sizeof (png_uint_16)));
|
||||||
|
if (png_ptr->hist == (png_uint_16p)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Could not allocate memory for histogram");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < info_ptr->num_palette; i++)
|
for (i = 0; i < info_ptr->num_palette; i++)
|
||||||
png_ptr->hist[i] = hist[i];
|
png_ptr->hist[i] = hist[i];
|
||||||
@ -292,6 +300,11 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
|
|||||||
length = png_strlen(purpose) + 1;
|
length = png_strlen(purpose) + 1;
|
||||||
png_debug1(3, "allocating purpose for info (%lu bytes)\n", length);
|
png_debug1(3, "allocating purpose for info (%lu bytes)\n", length);
|
||||||
info_ptr->pcal_purpose = (png_charp)png_malloc(png_ptr, length);
|
info_ptr->pcal_purpose = (png_charp)png_malloc(png_ptr, length);
|
||||||
|
if (info_ptr->pcal_purpose == (png_charp)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Could not allocate memory for pCAL");
|
||||||
|
return;
|
||||||
|
}
|
||||||
png_memcpy(info_ptr->pcal_purpose, purpose, (png_size_t)length);
|
png_memcpy(info_ptr->pcal_purpose, purpose, (png_size_t)length);
|
||||||
|
|
||||||
png_debug(3, "storing X0, X1, type, and nparams in info\n");
|
png_debug(3, "storing X0, X1, type, and nparams in info\n");
|
||||||
@ -303,10 +316,24 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
|
|||||||
length = png_strlen(units) + 1;
|
length = png_strlen(units) + 1;
|
||||||
png_debug1(3, "allocating units for info (%lu bytes)\n", length);
|
png_debug1(3, "allocating units for info (%lu bytes)\n", length);
|
||||||
info_ptr->pcal_units = (png_charp)png_malloc(png_ptr, length);
|
info_ptr->pcal_units = (png_charp)png_malloc(png_ptr, length);
|
||||||
|
if (info_ptr->pcal_units == (png_charp)NULL)
|
||||||
|
{
|
||||||
|
png_free (png_ptr, info_ptr->pcal_purpose);
|
||||||
|
png_warning (png_ptr, "Could not allocate memory for pCAL units");
|
||||||
|
return;
|
||||||
|
}
|
||||||
png_memcpy(info_ptr->pcal_units, units, (png_size_t)length);
|
png_memcpy(info_ptr->pcal_units, units, (png_size_t)length);
|
||||||
|
|
||||||
info_ptr->pcal_params = (png_charpp)png_malloc(png_ptr,
|
info_ptr->pcal_params = (png_charpp)png_malloc(png_ptr,
|
||||||
(png_uint_32)((nparams + 1) * sizeof(png_charp)));
|
(png_uint_32)((nparams + 1) * sizeof(png_charp)));
|
||||||
|
if (info_ptr->pcal_params == (png_charpp)NULL)
|
||||||
|
{
|
||||||
|
png_free (png_ptr, info_ptr->pcal_purpose);
|
||||||
|
png_free (png_ptr, info_ptr->pcal_units);
|
||||||
|
png_warning (png_ptr, "Could not allocate memory for pCAL params");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
info_ptr->pcal_params[nparams] = NULL;
|
info_ptr->pcal_params[nparams] = NULL;
|
||||||
|
|
||||||
for (i = 0; i < nparams; i++)
|
for (i = 0; i < nparams; i++)
|
||||||
@ -314,6 +341,12 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
|
|||||||
length = png_strlen(params[i]) + 1;
|
length = png_strlen(params[i]) + 1;
|
||||||
png_debug2(3, "allocating parameter %d for info (%lu bytes)\n", i, length);
|
png_debug2(3, "allocating parameter %d for info (%lu bytes)\n", i, length);
|
||||||
info_ptr->pcal_params[i] = (png_charp)png_malloc(png_ptr, length);
|
info_ptr->pcal_params[i] = (png_charp)png_malloc(png_ptr, length);
|
||||||
|
if (info_ptr->pcal_params[i] == (png_charp)NULL)
|
||||||
|
{
|
||||||
|
nparams=i;
|
||||||
|
png_warning (png_ptr, "Could not allocate memory for pCAL params");
|
||||||
|
}
|
||||||
|
else
|
||||||
png_memcpy(info_ptr->pcal_params[i], params[i], (png_size_t)length);
|
png_memcpy(info_ptr->pcal_params[i], params[i], (png_size_t)length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,11 +390,13 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
|
|||||||
length = png_strlen(swidth) + 1;
|
length = png_strlen(swidth) + 1;
|
||||||
png_debug1(3, "allocating unit for info (%d bytes)\n", length);
|
png_debug1(3, "allocating unit for info (%d bytes)\n", length);
|
||||||
info_ptr->scal_s_width = (png_charp)png_malloc(png_ptr, length);
|
info_ptr->scal_s_width = (png_charp)png_malloc(png_ptr, length);
|
||||||
|
if (info_ptr->scal_s_width != (png_charp)NULL)
|
||||||
png_memcpy(info_ptr->scal_s_width, swidth, (png_size_t)length);
|
png_memcpy(info_ptr->scal_s_width, swidth, (png_size_t)length);
|
||||||
|
|
||||||
length = png_strlen(sheight) + 1;
|
length = png_strlen(sheight) + 1;
|
||||||
png_debug1(3, "allocating unit for info (%d bytes)\n", length);
|
png_debug1(3, "allocating unit for info (%d bytes)\n", length);
|
||||||
info_ptr->scal_s_width = (png_charp)png_malloc(png_ptr, length);
|
info_ptr->scal_s_height = (png_charp)png_malloc(png_ptr, length);
|
||||||
|
if (info_ptr->scal_s_height != (png_charp)NULL)
|
||||||
png_memcpy(info_ptr->scal_s_height, sheight, (png_size_t)length);
|
png_memcpy(info_ptr->scal_s_height, sheight, (png_size_t)length);
|
||||||
|
|
||||||
info_ptr->valid |= PNG_INFO_sCAL;
|
info_ptr->valid |= PNG_INFO_sCAL;
|
||||||
@ -408,6 +443,11 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
|
|||||||
#endif
|
#endif
|
||||||
png_ptr->palette = (png_colorp)png_zalloc(png_ptr, (uInt)num_palette,
|
png_ptr->palette = (png_colorp)png_zalloc(png_ptr, (uInt)num_palette,
|
||||||
sizeof (png_color));
|
sizeof (png_color));
|
||||||
|
if (png_ptr->palette == (png_colorp)NULL)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Unable to allocate palette");
|
||||||
|
return;
|
||||||
|
}
|
||||||
png_memcpy(png_ptr->palette, palette, num_palette * sizeof (png_color));
|
png_memcpy(png_ptr->palette, palette, num_palette * sizeof (png_color));
|
||||||
info_ptr->palette = png_ptr->palette;
|
info_ptr->palette = png_ptr->palette;
|
||||||
info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
|
info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
|
||||||
@ -532,8 +572,19 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
new_iccp_name = (png_charp)png_malloc(png_ptr, png_strlen(name)+1);
|
new_iccp_name = (png_charp)png_malloc(png_ptr, png_strlen(name)+1);
|
||||||
|
if (new_iccp_name == (png_charp)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Could not allocate memory for ICC profile name");
|
||||||
|
return;
|
||||||
|
}
|
||||||
png_strcpy(new_iccp_name, name);
|
png_strcpy(new_iccp_name, name);
|
||||||
new_iccp_profile = (png_charp)png_malloc(png_ptr, proflen);
|
new_iccp_profile = (png_charp)png_malloc(png_ptr, proflen);
|
||||||
|
if (new_iccp_profile == (png_charp)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Could not allocate memory for ICC profile");
|
||||||
|
png_free (png_ptr, new_iccp_name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
png_memcpy(new_iccp_profile, profile, (png_size_t)proflen);
|
png_memcpy(new_iccp_profile, profile, (png_size_t)proflen);
|
||||||
|
|
||||||
png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, 0);
|
png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, 0);
|
||||||
@ -579,6 +630,12 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
|||||||
old_text = info_ptr->text;
|
old_text = info_ptr->text;
|
||||||
info_ptr->text = (png_textp)png_malloc(png_ptr,
|
info_ptr->text = (png_textp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(info_ptr->max_text * sizeof (png_text)));
|
(png_uint_32)(info_ptr->max_text * sizeof (png_text)));
|
||||||
|
if (info_ptr->text == (png_textp)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Could not allocate memory for text");
|
||||||
|
info_ptr->text = old_text;
|
||||||
|
return;
|
||||||
|
}
|
||||||
png_memcpy(info_ptr->text, old_text, (png_size_t)(old_max *
|
png_memcpy(info_ptr->text, old_text, (png_size_t)(old_max *
|
||||||
sizeof(png_text)));
|
sizeof(png_text)));
|
||||||
png_free(png_ptr, old_text);
|
png_free(png_ptr, old_text);
|
||||||
@ -589,6 +646,11 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
|||||||
info_ptr->num_text = 0;
|
info_ptr->num_text = 0;
|
||||||
info_ptr->text = (png_textp)png_malloc(png_ptr,
|
info_ptr->text = (png_textp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(info_ptr->max_text * sizeof (png_text)));
|
(png_uint_32)(info_ptr->max_text * sizeof (png_text)));
|
||||||
|
if (info_ptr->text == (png_textp)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Could not allocate memory for text");
|
||||||
|
return;
|
||||||
|
}
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
info_ptr->free_me |= PNG_FREE_TEXT;
|
info_ptr->free_me |= PNG_FREE_TEXT;
|
||||||
#endif
|
#endif
|
||||||
@ -650,6 +712,11 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
|
|||||||
|
|
||||||
textp->key = (png_charp)png_malloc(png_ptr,
|
textp->key = (png_charp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(key_len + text_length + lang_len + lang_key_len + 4));
|
(png_uint_32)(key_len + text_length + lang_len + lang_key_len + 4));
|
||||||
|
if (textp->key == (png_charp)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Could not allocate memory for text pointer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
png_debug2(2, "Allocated %d bytes at %x in png_set_text\n",
|
png_debug2(2, "Allocated %d bytes at %x in png_set_text\n",
|
||||||
key_len + lang_len + lang_key_len + text_length + 4, (int)textp->key);
|
key_len + lang_len + lang_key_len + text_length + 4, (int)textp->key);
|
||||||
|
|
||||||
@ -737,6 +804,11 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
|
|||||||
#endif
|
#endif
|
||||||
png_ptr->trans = info_ptr->trans = (png_bytep)png_malloc(png_ptr,
|
png_ptr->trans = info_ptr->trans = (png_bytep)png_malloc(png_ptr,
|
||||||
num_trans);
|
num_trans);
|
||||||
|
if (png_ptr->trans == (png_bytep)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Could not allocate memory for tRNS array");
|
||||||
|
return;
|
||||||
|
}
|
||||||
png_memcpy(info_ptr->trans, trans, num_trans);
|
png_memcpy(info_ptr->trans, trans, num_trans);
|
||||||
#ifdef PNG_FREE_ME_SUPPORTED
|
#ifdef PNG_FREE_ME_SUPPORTED
|
||||||
info_ptr->free_me |= PNG_FREE_TRNS;
|
info_ptr->free_me |= PNG_FREE_TRNS;
|
||||||
@ -767,6 +839,11 @@ png_set_sPLT(png_structp png_ptr,
|
|||||||
|
|
||||||
np = (png_sPLT_tp)png_malloc(png_ptr,
|
np = (png_sPLT_tp)png_malloc(png_ptr,
|
||||||
(info_ptr->splt_palettes_num + nentries) * sizeof(png_sPLT_t));
|
(info_ptr->splt_palettes_num + nentries) * sizeof(png_sPLT_t));
|
||||||
|
if (np == (png_sPLT_tp)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Could not allocate memory for sPLT");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
png_memcpy(np, info_ptr->splt_palettes,
|
png_memcpy(np, info_ptr->splt_palettes,
|
||||||
info_ptr->splt_palettes_num * sizeof(png_sPLT_t));
|
info_ptr->splt_palettes_num * sizeof(png_sPLT_t));
|
||||||
@ -783,11 +860,19 @@ png_set_sPLT(png_structp png_ptr,
|
|||||||
png_strcpy(to->name, from->name);
|
png_strcpy(to->name, from->name);
|
||||||
to->entries = (png_sPLT_entryp)png_malloc(png_ptr,
|
to->entries = (png_sPLT_entryp)png_malloc(png_ptr,
|
||||||
from->nentries * sizeof(png_sPLT_t));
|
from->nentries * sizeof(png_sPLT_t));
|
||||||
|
if (to->entries == (png_sPLT_entryp)NULL)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Could not allocate memory for sPLT entry");
|
||||||
|
nentries=i;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
png_memcpy(to->entries, from->entries,
|
png_memcpy(to->entries, from->entries,
|
||||||
from->nentries * sizeof(png_sPLT_t));
|
from->nentries * sizeof(png_sPLT_t));
|
||||||
to->nentries = from->nentries;
|
to->nentries = from->nentries;
|
||||||
to->depth = from->depth;
|
to->depth = from->depth;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
info_ptr->splt_palettes = np;
|
info_ptr->splt_palettes = np;
|
||||||
info_ptr->splt_palettes_num += nentries;
|
info_ptr->splt_palettes_num += nentries;
|
||||||
@ -812,6 +897,11 @@ png_set_unknown_chunks(png_structp png_ptr,
|
|||||||
np = (png_unknown_chunkp)png_malloc(png_ptr,
|
np = (png_unknown_chunkp)png_malloc(png_ptr,
|
||||||
(info_ptr->unknown_chunks_num + num_unknowns) *
|
(info_ptr->unknown_chunks_num + num_unknowns) *
|
||||||
sizeof(png_unknown_chunk));
|
sizeof(png_unknown_chunk));
|
||||||
|
if (np == (png_unknown_chunkp)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Could not allocate memory for unknown chunk");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
png_memcpy(np, info_ptr->unknown_chunks,
|
png_memcpy(np, info_ptr->unknown_chunks,
|
||||||
info_ptr->unknown_chunks_num * sizeof(png_unknown_chunk));
|
info_ptr->unknown_chunks_num * sizeof(png_unknown_chunk));
|
||||||
@ -825,12 +915,20 @@ png_set_unknown_chunks(png_structp png_ptr,
|
|||||||
|
|
||||||
png_strcpy((png_charp)to->name, (png_charp)from->name);
|
png_strcpy((png_charp)to->name, (png_charp)from->name);
|
||||||
to->data = (png_bytep)png_malloc(png_ptr, from->size);
|
to->data = (png_bytep)png_malloc(png_ptr, from->size);
|
||||||
|
if (to->data == (png_bytep)NULL)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Could not allocate memory for unknown entry");
|
||||||
|
num_unknowns=i;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
png_memcpy(to->data, from->data, from->size);
|
png_memcpy(to->data, from->data, from->size);
|
||||||
to->size = from->size;
|
to->size = from->size;
|
||||||
|
|
||||||
/* note our location in the read or write sequence */
|
/* note our location in the read or write sequence */
|
||||||
to->location = (png_byte)(png_ptr->mode & 0xff);
|
to->location = (png_byte)(png_ptr->mode & 0xff);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
info_ptr->unknown_chunks = np;
|
info_ptr->unknown_chunks = np;
|
||||||
info_ptr->unknown_chunks_num += num_unknowns;
|
info_ptr->unknown_chunks_num += num_unknowns;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngtest.c - a simple test program to test libpng
|
/* pngtest.c - a simple test program to test libpng
|
||||||
*
|
*
|
||||||
* libpng 1.0.11beta2 - April 11, 2001
|
* libpng 1.0.11beta3 - April 15, 2001
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
@ -1523,4 +1523,4 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||||
typedef version_1_0_11beta2 your_png_h_is_not_version_1_0_11beta2;
|
typedef version_1_0_11beta3 your_png_h_is_not_version_1_0_11beta3;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||||
*
|
*
|
||||||
* libpng 1.0.11beta2 - April 11, 2001
|
* libpng 1.0.11beta3 - April 15, 2001
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
*
|
*
|
||||||
* For Intel x86 CPU and Microsoft Visual C++ compiler
|
* For Intel x86 CPU and Microsoft Visual C++ compiler
|
||||||
*
|
*
|
||||||
* libpng 1.0.11beta2 - April 11, 2001
|
* libpng 1.0.11beta3 - April 15, 2001
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1998, Intel Corporation
|
* Copyright (c) 1998, Intel Corporation
|
||||||
|
2
pngwio.c
2
pngwio.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngwio.c - functions for data output
|
/* pngwio.c - functions for data output
|
||||||
*
|
*
|
||||||
* libpng 1.0.11beta2 - April 11, 2001
|
* libpng 1.0.11beta3 - April 15, 2001
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
|
31
pngwrite.c
31
pngwrite.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngwrite.c - general routines to write a PNG file
|
/* pngwrite.c - general routines to write a PNG file
|
||||||
*
|
*
|
||||||
* libpng 1.0.11beta2 - April 11, 2001
|
* libpng 1.0.11beta3 - April 15, 2001
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
@ -512,6 +512,8 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||||||
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
||||||
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)png_ptr->zbuf_size);
|
(png_uint_32)png_ptr->zbuf_size);
|
||||||
|
if (png_ptr->zbuf == (png_bytep)NULL)
|
||||||
|
png_error(png_ptr, "Could not allocate zbuf for writing");
|
||||||
|
|
||||||
png_set_write_fn(png_ptr, NULL, NULL, NULL);
|
png_set_write_fn(png_ptr, NULL, NULL, NULL);
|
||||||
|
|
||||||
@ -581,6 +583,8 @@ png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
|
|||||||
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
||||||
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)png_ptr->zbuf_size);
|
(png_uint_32)png_ptr->zbuf_size);
|
||||||
|
if (png_ptr->zbuf == (png_bytep)NULL)
|
||||||
|
png_error(png_ptr, "Could not allocate zbuf for writing");
|
||||||
png_set_write_fn(png_ptr, NULL, NULL, NULL);
|
png_set_write_fn(png_ptr, NULL, NULL, NULL);
|
||||||
|
|
||||||
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
|
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
|
||||||
@ -1029,6 +1033,8 @@ png_set_filter(png_structp png_ptr, int method, int filters)
|
|||||||
{
|
{
|
||||||
png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
|
png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_ptr->rowbytes + 1));
|
(png_ptr->rowbytes + 1));
|
||||||
|
if (png_ptr->sub_row == (png_bytep)NULL)
|
||||||
|
png_error(png_ptr, "Could not allocate sub_row");
|
||||||
png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB;
|
png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1043,6 +1049,10 @@ png_set_filter(png_structp png_ptr, int method, int filters)
|
|||||||
{
|
{
|
||||||
png_ptr->up_row = (png_bytep)png_malloc(png_ptr,
|
png_ptr->up_row = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_ptr->rowbytes + 1));
|
(png_ptr->rowbytes + 1));
|
||||||
|
if (png_ptr->up_row == (png_bytep)NULL)
|
||||||
|
{
|
||||||
|
png_error(png_ptr, "Could not allocate sub_row");
|
||||||
|
}
|
||||||
png_ptr->up_row[0] = PNG_FILTER_VALUE_UP;
|
png_ptr->up_row[0] = PNG_FILTER_VALUE_UP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1058,6 +1068,8 @@ png_set_filter(png_structp png_ptr, int method, int filters)
|
|||||||
{
|
{
|
||||||
png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
|
png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_ptr->rowbytes + 1));
|
(png_ptr->rowbytes + 1));
|
||||||
|
if (png_ptr->avg_row == (png_bytep)NULL)
|
||||||
|
png_error(png_ptr, "Could not allocate avg_row");
|
||||||
png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG;
|
png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1074,6 +1086,8 @@ png_set_filter(png_structp png_ptr, int method, int filters)
|
|||||||
{
|
{
|
||||||
png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr,
|
png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_ptr->rowbytes + 1));
|
(png_ptr->rowbytes + 1));
|
||||||
|
if (png_ptr->paeth_row == (png_bytep)NULL)
|
||||||
|
png_error(png_ptr, "Could not allocate avg_row");
|
||||||
png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
|
png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1129,12 +1143,15 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
|
|||||||
png_ptr->prev_filters = (png_bytep)png_malloc(png_ptr,
|
png_ptr->prev_filters = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_uint_32)(sizeof(png_byte) * num_weights));
|
(png_uint_32)(sizeof(png_byte) * num_weights));
|
||||||
|
|
||||||
|
if (png_ptr->prev_filters != (png_bytep)NULL)
|
||||||
|
{
|
||||||
/* To make sure that the weighting starts out fairly */
|
/* To make sure that the weighting starts out fairly */
|
||||||
for (i = 0; i < num_weights; i++)
|
for (i = 0; i < num_weights; i++)
|
||||||
{
|
{
|
||||||
png_ptr->prev_filters[i] = 255;
|
png_ptr->prev_filters[i] = 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (png_ptr->filter_weights == NULL)
|
if (png_ptr->filter_weights == NULL)
|
||||||
{
|
{
|
||||||
@ -1143,13 +1160,23 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
|
|||||||
|
|
||||||
png_ptr->inv_filter_weights = (png_uint_16p)png_malloc(png_ptr,
|
png_ptr->inv_filter_weights = (png_uint_16p)png_malloc(png_ptr,
|
||||||
(png_uint_32)(sizeof(png_uint_16) * num_weights));
|
(png_uint_32)(sizeof(png_uint_16) * num_weights));
|
||||||
|
if (png_ptr->inv_filter_weights == (png_uint_16p)NULL)
|
||||||
|
{
|
||||||
|
png_free(png_ptr, png_ptr->filter_weights);
|
||||||
|
png_ptr->filter_weights = NULL;
|
||||||
|
}
|
||||||
|
if (png_ptr->filter_weights != (png_uint_16p)NULL &&
|
||||||
|
png_ptr->inv_filter_weights != (png_uint_16p)NULL)
|
||||||
|
{
|
||||||
for (i = 0; i < num_weights; i++)
|
for (i = 0; i < num_weights; i++)
|
||||||
{
|
{
|
||||||
png_ptr->inv_filter_weights[i] =
|
png_ptr->inv_filter_weights[i] =
|
||||||
png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
|
png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
num_weights=0;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < num_weights; i++)
|
for (i = 0; i < num_weights; i++)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||||
*
|
*
|
||||||
* libpng 1.0.11beta2 - April 11, 2001
|
* libpng 1.0.11beta3 - April 15, 2001
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
|
48
pngwutil.c
48
pngwutil.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngwutil.c - utilities to write a PNG file
|
/* pngwutil.c - utilities to write a PNG file
|
||||||
*
|
*
|
||||||
* libpng 1.0.11beta2 - April 11, 2001
|
* libpng 1.0.11beta3 - April 15, 2001
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
@ -235,21 +235,35 @@ png_text_compress(png_structp png_ptr,
|
|||||||
old_ptr = comp->output_ptr;
|
old_ptr = comp->output_ptr;
|
||||||
comp->output_ptr = (png_charpp)png_malloc(png_ptr,
|
comp->output_ptr = (png_charpp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(comp->max_output_ptr * sizeof (png_charpp)));
|
(png_uint_32)(comp->max_output_ptr * sizeof (png_charpp)));
|
||||||
png_memcpy(comp->output_ptr, old_ptr,
|
if (comp->output_ptr == (png_charpp)NULL)
|
||||||
old_max * sizeof (png_charp));
|
{
|
||||||
|
png_warning (png_ptr, "Cannot allocate compression buffer");
|
||||||
|
comp->output_ptr=old_ptr;
|
||||||
|
}
|
||||||
|
png_memcpy(comp->output_ptr, old_ptr, old_max
|
||||||
|
* sizeof (png_charp));
|
||||||
png_free(png_ptr, old_ptr);
|
png_free(png_ptr, old_ptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
comp->output_ptr = (png_charpp)png_malloc(png_ptr,
|
comp->output_ptr = (png_charpp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(comp->max_output_ptr * sizeof (png_charp)));
|
(png_uint_32)(comp->max_output_ptr * sizeof (png_charp)));
|
||||||
|
if (comp->output_ptr == (png_charpp)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Cannot allocate compression buffer");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* save the data */
|
/* save the data */
|
||||||
comp->output_ptr[comp->num_output_ptr] = (png_charp)png_malloc(png_ptr,
|
comp->output_ptr[comp->num_output_ptr] = (png_charp)png_malloc(png_ptr,
|
||||||
(png_uint_32)png_ptr->zbuf_size);
|
(png_uint_32)png_ptr->zbuf_size);
|
||||||
|
if (comp->output_ptr[comp->num_output_ptr] == (png_charp)NULL)
|
||||||
|
png_warning (png_ptr, "Cannot allocate compression buffer");
|
||||||
|
else
|
||||||
|
{
|
||||||
png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf,
|
png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf,
|
||||||
png_ptr->zbuf_size);
|
png_ptr->zbuf_size);
|
||||||
comp->num_output_ptr++;
|
comp->num_output_ptr++;
|
||||||
|
}
|
||||||
|
|
||||||
/* and reset the buffer */
|
/* and reset the buffer */
|
||||||
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
|
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
|
||||||
@ -284,6 +298,7 @@ png_text_compress(png_structp png_ptr,
|
|||||||
/* This could be optimized to realloc() */
|
/* This could be optimized to realloc() */
|
||||||
comp->output_ptr = (png_charpp)png_malloc(png_ptr,
|
comp->output_ptr = (png_charpp)png_malloc(png_ptr,
|
||||||
(png_uint_32)(comp->max_output_ptr * sizeof (png_charpp)));
|
(png_uint_32)(comp->max_output_ptr * sizeof (png_charpp)));
|
||||||
|
if (comp->output_ptr != (png_charpp)NULL)
|
||||||
png_memcpy(comp->output_ptr, old_ptr,
|
png_memcpy(comp->output_ptr, old_ptr,
|
||||||
old_max * sizeof (png_charp));
|
old_max * sizeof (png_charp));
|
||||||
png_free(png_ptr, old_ptr);
|
png_free(png_ptr, old_ptr);
|
||||||
@ -296,9 +311,14 @@ png_text_compress(png_structp png_ptr,
|
|||||||
/* save off the data */
|
/* save off the data */
|
||||||
comp->output_ptr[comp->num_output_ptr] =
|
comp->output_ptr[comp->num_output_ptr] =
|
||||||
(png_charp)png_malloc(png_ptr, (png_uint_32)png_ptr->zbuf_size);
|
(png_charp)png_malloc(png_ptr, (png_uint_32)png_ptr->zbuf_size);
|
||||||
|
if (comp->output_ptr[comp->num_output_ptr] == (png_charp)NULL)
|
||||||
|
png_warning (png_ptr, "Cannot allocate compression buffer");
|
||||||
|
else
|
||||||
|
{
|
||||||
png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf,
|
png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf,
|
||||||
png_ptr->zbuf_size);
|
png_ptr->zbuf_size);
|
||||||
comp->num_output_ptr++;
|
comp->num_output_ptr++;
|
||||||
|
}
|
||||||
|
|
||||||
/* and reset the buffer pointers */
|
/* and reset the buffer pointers */
|
||||||
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
|
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
|
||||||
@ -1110,6 +1130,12 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
|
|||||||
|
|
||||||
*new_key = (png_charp)png_malloc(png_ptr, (png_uint_32)(key_len + 2));
|
*new_key = (png_charp)png_malloc(png_ptr, (png_uint_32)(key_len + 2));
|
||||||
|
|
||||||
|
if (*new_key == (png_charp)NULL)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Could not allocate new key; keyword not checked");
|
||||||
|
return key_len;
|
||||||
|
}
|
||||||
|
|
||||||
/* Replace non-printing characters with a blank and print a warning */
|
/* Replace non-printing characters with a blank and print a warning */
|
||||||
for (kp = key, dp = *new_key; *kp != '\0'; kp++, dp++)
|
for (kp = key, dp = *new_key; *kp != '\0'; kp++, dp++)
|
||||||
{
|
{
|
||||||
@ -1425,6 +1451,12 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
|
|||||||
params_len = (png_uint_32p)png_malloc(png_ptr, (png_uint_32)(nparams
|
params_len = (png_uint_32p)png_malloc(png_ptr, (png_uint_32)(nparams
|
||||||
*sizeof(png_uint_32)));
|
*sizeof(png_uint_32)));
|
||||||
|
|
||||||
|
if (params_len == (png_uint_32p)NULL)
|
||||||
|
{
|
||||||
|
png_warning (png_ptr, "Could not allocate params for pCAL");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Find the length of each parameter, making sure we don't count the
|
/* Find the length of each parameter, making sure we don't count the
|
||||||
null terminator for the last parameter. */
|
null terminator for the last parameter. */
|
||||||
for (i = 0; i < nparams; i++)
|
for (i = 0; i < nparams; i++)
|
||||||
@ -1608,6 +1640,8 @@ png_write_start_row(png_structp png_ptr)
|
|||||||
|
|
||||||
/* set up row buffer */
|
/* set up row buffer */
|
||||||
png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, (png_uint_32)buf_size);
|
png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, (png_uint_32)buf_size);
|
||||||
|
if (png_ptr->row_buf == (png_bytep)NULL)
|
||||||
|
png_error(png_ptr, "Could not allocate row buffer");
|
||||||
png_ptr->row_buf[0] = PNG_FILTER_VALUE_NONE;
|
png_ptr->row_buf[0] = PNG_FILTER_VALUE_NONE;
|
||||||
|
|
||||||
/* set up filtering buffer, if using this filter */
|
/* set up filtering buffer, if using this filter */
|
||||||
@ -1615,6 +1649,8 @@ png_write_start_row(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
|
png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_ptr->rowbytes + 1));
|
(png_ptr->rowbytes + 1));
|
||||||
|
if (png_ptr->sub_row == (png_bytep)NULL)
|
||||||
|
png_error(png_ptr, "Could not allocate sub row buffer");
|
||||||
png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB;
|
png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1629,6 +1665,8 @@ png_write_start_row(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
png_ptr->up_row = (png_bytep )png_malloc(png_ptr,
|
png_ptr->up_row = (png_bytep )png_malloc(png_ptr,
|
||||||
(png_ptr->rowbytes + 1));
|
(png_ptr->rowbytes + 1));
|
||||||
|
if (png_ptr->up_row == (png_bytep)NULL)
|
||||||
|
png_error(png_ptr, "Could not allocate up row buffer");
|
||||||
png_ptr->up_row[0] = PNG_FILTER_VALUE_UP;
|
png_ptr->up_row[0] = PNG_FILTER_VALUE_UP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1636,6 +1674,8 @@ png_write_start_row(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
|
png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
|
||||||
(png_ptr->rowbytes + 1));
|
(png_ptr->rowbytes + 1));
|
||||||
|
if (png_ptr->avg_row == (png_bytep)NULL)
|
||||||
|
png_error(png_ptr, "Could not allocate avg row buffer");
|
||||||
png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG;
|
png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1643,6 +1683,8 @@ png_write_start_row(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
png_ptr->paeth_row = (png_bytep )png_malloc(png_ptr,
|
png_ptr->paeth_row = (png_bytep )png_malloc(png_ptr,
|
||||||
(png_ptr->rowbytes + 1));
|
(png_ptr->rowbytes + 1));
|
||||||
|
if (png_ptr->paeth_row == (png_bytep)NULL)
|
||||||
|
png_error(png_ptr, "Could not allocate paeth row buffer");
|
||||||
png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
|
png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Microsoft Developer Studio Build File, Format Version 6.00 for
|
Microsoft Developer Studio Build File, Format Version 6.00 for
|
||||||
libpng 1.0.11beta2 (April 11, 2001) and zlib
|
libpng 1.0.11beta3 (April 15, 2001) and zlib
|
||||||
|
|
||||||
Copyright (C) 2000 Simon-Pierre Cadieux
|
Copyright (C) 2000 Simon-Pierre Cadieux
|
||||||
For conditions of distribution and use, see copyright notice in png.h
|
For conditions of distribution and use, see copyright notice in png.h
|
||||||
|
@ -6,7 +6,7 @@ LIBRARY
|
|||||||
DESCRIPTION "PNG image compression library for Windows"
|
DESCRIPTION "PNG image compression library for Windows"
|
||||||
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
;Version 1.0.11beta2
|
;Version 1.0.11beta3
|
||||||
png_build_grayscale_palette @1
|
png_build_grayscale_palette @1
|
||||||
png_check_sig @2
|
png_check_sig @2
|
||||||
png_chunk_error @3
|
png_chunk_error @3
|
||||||
|
@ -8,9 +8,9 @@ libpng for WindowsCE Rel.1.0
|
|||||||
|
|
||||||
Introduction
|
Introduction
|
||||||
============
|
============
|
||||||
This is libpng 1.0.11beta2 ported to WindowsCE 2.0 and 2.11.
|
This is libpng 1.0.11beta3 ported to WindowsCE 2.0 and 2.11.
|
||||||
libpng 1.0.11beta2 is a PNG reference library.
|
libpng 1.0.11beta3 is a PNG reference library.
|
||||||
See README, a document of original libpng 1.0.11beta2.
|
See README, a document of original libpng 1.0.11beta3.
|
||||||
|
|
||||||
zlib for WindowsCE
|
zlib for WindowsCE
|
||||||
==================
|
==================
|
||||||
@ -23,7 +23,7 @@ This software is provided 'as-is', without any express or implied
|
|||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
arising from the use of this software.
|
arising from the use of this software.
|
||||||
|
|
||||||
See README and LICENSE, documents of original libpng 1.0.11beta2, for conditions
|
See README and LICENSE, documents of original libpng 1.0.11beta3, for conditions
|
||||||
of use and distribution.
|
of use and distribution.
|
||||||
|
|
||||||
Files
|
Files
|
||||||
|
@ -24,7 +24,7 @@ libpng
|
|||||||
になったいかなる被害についても、作者、配布者、その他利用者以外の人物、
|
になったいかなる被害についても、作者、配布者、その他利用者以外の人物、
|
||||||
団体に責任をとる義務はないものとします。
|
団体に責任をとる義務はないものとします。
|
||||||
|
|
||||||
その他、このソフトウェアの利用条件については、原版である libpng 1.0.11beta2に
|
その他、このソフトウェアの利用条件については、原版である libpng 1.0.11beta3に
|
||||||
準拠するものとします。詳しくは、付属の README,LICENSE をお読みください。
|
準拠するものとします。詳しくは、付属の README,LICENSE をお読みください。
|
||||||
|
|
||||||
収録内容
|
収録内容
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
LIBRARY lpngce
|
LIBRARY lpngce
|
||||||
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
;Version 1.0.11beta2
|
;Version 1.0.11beta3
|
||||||
png_build_grayscale_palette @1
|
png_build_grayscale_palette @1
|
||||||
png_check_sig @2
|
png_check_sig @2
|
||||||
png_chunk_error @3
|
png_chunk_error @3
|
||||||
|
@ -18,7 +18,7 @@ RM = rm -f
|
|||||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||||
# have to change it.
|
# have to change it.
|
||||||
PNGMAJ = 2
|
PNGMAJ = 2
|
||||||
PNGMIN = 1.0.11beta2
|
PNGMIN = 1.0.11beta3
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
prefix=/usr/local
|
prefix=/usr/local
|
||||||
|
@ -13,7 +13,7 @@ ZLIBINC=/usr/local/include
|
|||||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||||
# have to change it.
|
# have to change it.
|
||||||
PNGMAJ = 2
|
PNGMAJ = 2
|
||||||
PNGMIN = 1.0.11beta2
|
PNGMIN = 1.0.11beta3
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
ALIGN=
|
ALIGN=
|
||||||
|
@ -39,8 +39,8 @@ CFLAGS=-I$(ZLIBINC) -Wall -O3 $(ALIGN) -funroll-loops \
|
|||||||
# have to change it.
|
# have to change it.
|
||||||
PNGMAJ = 2
|
PNGMAJ = 2
|
||||||
#PNGDLL = $1# msvc
|
#PNGDLL = $1# msvc
|
||||||
PNGDLL = 2# cygwin 1.0.11beta2
|
PNGDLL = 2# cygwin 1.0.11beta3
|
||||||
PNGMIN = 1.0.11beta2
|
PNGMIN = 1.0.11beta3
|
||||||
PNGMIN_BASE = 1.0.11
|
PNGMIN_BASE = 1.0.11
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ ZLIBINC=../zlib
|
|||||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||||
# have to change it.
|
# have to change it.
|
||||||
PNGMAJ = 2
|
PNGMAJ = 2
|
||||||
PNGMIN = 1.0.11beta2
|
PNGMIN = 1.0.11beta3
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
CC=cc
|
CC=cc
|
||||||
|
@ -51,7 +51,7 @@ RANLIB=ranlib
|
|||||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||||
# have to change it.
|
# have to change it.
|
||||||
PNGMAJ = 2
|
PNGMAJ = 2
|
||||||
PNGMIN = 1.0.11beta2
|
PNGMIN = 1.0.11beta3
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
INCPATH=$(prefix)/include
|
INCPATH=$(prefix)/include
|
||||||
|
@ -34,7 +34,7 @@ RANLIB=ranlib
|
|||||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||||
# have to change it.
|
# have to change it.
|
||||||
PNGMAJ = 2
|
PNGMAJ = 2
|
||||||
PNGMIN = 1.0.11beta2
|
PNGMIN = 1.0.11beta3
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
INCPATH=$(prefix)/include
|
INCPATH=$(prefix)/include
|
||||||
|
@ -19,7 +19,7 @@ RANLIB=ranlib
|
|||||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||||
# have to change it.
|
# have to change it.
|
||||||
PNGMAJ = 2
|
PNGMAJ = 2
|
||||||
PNGMIN = 1.0.11beta2
|
PNGMIN = 1.0.11beta3
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
# where make install puts libpng.a and png.h
|
# where make install puts libpng.a and png.h
|
||||||
|
@ -34,7 +34,7 @@ RANLIB=ranlib
|
|||||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||||
# have to change it.
|
# have to change it.
|
||||||
PNGMAJ = 2
|
PNGMAJ = 2
|
||||||
PNGMIN = 1.0.11beta2
|
PNGMIN = 1.0.11beta3
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
INCPATH=$(prefix)/include
|
INCPATH=$(prefix)/include
|
||||||
|
@ -25,7 +25,7 @@ RANLIB=echo
|
|||||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||||
# have to change it.
|
# have to change it.
|
||||||
PNGMAJ = 2
|
PNGMAJ = 2
|
||||||
PNGMIN = 1.0.11beta2
|
PNGMIN = 1.0.11beta3
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
INCPATH=$(prefix)/include
|
INCPATH=$(prefix)/include
|
||||||
|
@ -19,8 +19,8 @@ CFLAGS=-I$(ZLIBINC) -O2 $(WARNMORE) -fPIC -mabi=n32
|
|||||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
||||||
LDSHARED=gcc -shared
|
LDSHARED=gcc -shared
|
||||||
|
|
||||||
VER=1.0.11beta2
|
VER=1.0.11beta3
|
||||||
LIBS=libpng.so.1.0.11beta2
|
LIBS=libpng.so.1.0.11beta3
|
||||||
SHAREDLIB=libpng.so
|
SHAREDLIB=libpng.so
|
||||||
libdir=$(prefix)/lib32
|
libdir=$(prefix)/lib32
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ CFLAGS=-I$(ZLIBINC) -O $(WARNMORE) -DPNG_USE_PNGGCCRD -DPNG_NO_ASSEMBLER_CODE
|
|||||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
||||||
LDSHARED=cc -shared
|
LDSHARED=cc -shared
|
||||||
|
|
||||||
VER=1.0.11beta2
|
VER=1.0.11beta3
|
||||||
SONUM=2
|
SONUM=2
|
||||||
SHAREDLIB=libpng.so
|
SHAREDLIB=libpng.so
|
||||||
libdir=$(prefix)
|
libdir=$(prefix)
|
||||||
|
@ -31,7 +31,7 @@ RANLIB=echo
|
|||||||
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
|
||||||
# have to change it.
|
# have to change it.
|
||||||
PNGMAJ = 2
|
PNGMAJ = 2
|
||||||
PNGMIN = 1.0.11beta2
|
PNGMIN = 1.0.11beta3
|
||||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||||
|
|
||||||
INCPATH=$(prefix)/include
|
INCPATH=$(prefix)/include
|
||||||
|
@ -7,7 +7,7 @@ unit pngdef;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
const
|
const
|
||||||
PNG_LIBPNG_VER_STRING = '1.0.11beta2';
|
PNG_LIBPNG_VER_STRING = '1.0.11beta3';
|
||||||
PNG_LIBPNG_VER = 10011;
|
PNG_LIBPNG_VER = 10011;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
; PNG.LIB module definition file for OS/2
|
; PNG.LIB module definition file for OS/2
|
||||||
;----------------------------------------
|
;----------------------------------------
|
||||||
|
|
||||||
; Version 1.0.11beta2
|
; Version 1.0.11beta3
|
||||||
|
|
||||||
LIBRARY PNG
|
LIBRARY PNG
|
||||||
DESCRIPTION "PNG image compression library for OS/2"
|
DESCRIPTION "PNG image compression library for OS/2"
|
||||||
|
Reference in New Issue
Block a user