Imported from libpng-1.0.11beta3.tar
diff --git a/ANNOUNCE b/ANNOUNCE
index 8117e75..e846ba4 100644
--- a/ANNOUNCE
+++ b/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.
 
@@ -10,6 +10,7 @@
   Changed several "//" single-line comments to C-style in pnggccrd.c
   Removed PNGAPI from private functions whose prototypes did not have PNGAPI.
   Updated scripts/pngos2.def
+  Added checking the results of many instances of png_malloc() for NULL
 
 Send comments/corrections/commendations to
 png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
diff --git a/CHANGES b/CHANGES
index eecd51f..279177c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -921,6 +921,8 @@
 version 1.0.11beta2 [April 11, 2001]
   Removed PNGAPI from several functions whose prototypes did not have PNGAPI.
   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
 png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
diff --git a/INSTALL b/INSTALL
index da03eba..9467fb3 100644
--- a/INSTALL
+++ b/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
 can usually be found wherever you got libpng.  zlib can be
@@ -10,7 +10,7 @@
 version of zlib that's installed.
 
 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".
 
 Your directory structure should look like this:
@@ -60,8 +60,8 @@
 include
 
  makefile.std      =>  Generic UNIX makefile (cc, creates static libpng.a)
- makefile.linux    =>  Linux/ELF makefile (gcc, creates libpng.so.2.1.0.11beta2)
- makefile.gcmmx    =>  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.11beta3,
                        uses assembler code tuned for Intel MMX platform)
  makefile.gcc      =>  Generic makefile (gcc, creates static libpng.a)
  makefile.knr      =>  Archaic UNIX Makefile that converts files with
@@ -77,9 +77,9 @@
  libpng.icc        =>  Project file for IBM VisualAge/C++ version 4.0 or later
  makefile.macosx   =>  MACOS X Makefile
  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.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.mips     =>  MIPS makefile
  makefile.acorn    =>  Acorn makefile
diff --git a/KNOWNBUG b/KNOWNBUG
index 3477ba8..d58d3cd 100644
--- a/KNOWNBUG
+++ b/KNOWNBUG
@@ -21,3 +21,8 @@
    involved are all either deprecated or intended only for internal use.
 
    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.
diff --git a/LICENSE b/LICENSE
index fdeec35..68c5235 100644
--- a/LICENSE
+++ b/LICENSE
@@ -8,7 +8,7 @@
 If you modify libpng you may insert additional notices immediately following
 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 distributed according to the same disclaimer and license as libpng-1.0.6
 with the following individuals added to the list of Contributing Authors
@@ -99,4 +99,4 @@
 
 Glenn Randers-Pehrson
 randeg@alum.rpi.edu
-April 11, 2001
+April 15, 2001
diff --git a/README b/README
index be1067f..fa452d0 100644
--- a/README
+++ b/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 INSTALL for instructions on how to install libpng.
@@ -183,9 +183,9 @@
        descrip.mms      =>  VMS makefile for MMS or MMK
        makefile.std     =>  Generic UNIX makefile (cc, creates static libpng.a)
        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
-                            libpng.so.2.1.0.11beta2, uses assembler code
+                            libpng.so.2.1.0.11beta3, uses assembler code
                             tuned for Intel MMX platform)
        makefile.gcc     =>  Generic makefile (gcc, creates static libpng.a)
        makefile.knr     =>  Archaic UNIX Makefile that converts files with
@@ -201,10 +201,10 @@
        libpng.icc       =>  Project file, IBM VisualAge/C++ 4.0 or later
        makefile.macosx  =>  MACOS X Makefile
        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.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.mips    =>  MIPS makefile
        makefile.acorn   =>  Acorn makefile
diff --git a/Y2KINFO b/Y2KINFO
index e94f56f..5670ff7 100644
--- a/Y2KINFO
+++ b/Y2KINFO
@@ -1,13 +1,13 @@
    Y2K compliance in libpng:
    =========================
 
-      April 11, 2001
+      April 15, 2001
 
       Since the PNG Development group is an ad-hoc body, we can't make
       an official declaration.
 
       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.
 
       Libpng only has three year fields.  One is a 2-byte unsigned integer
diff --git a/configure b/configure
index 63ed427..47701ba 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 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\"
   directory.  Read the INSTALL file for more details.
 "
diff --git a/example.c b/example.c
index 953d2d7..8a7da25 100644
--- a/example.c
+++ b/example.c
@@ -603,7 +603,10 @@
       PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
 
    /* 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 ... */
    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
diff --git a/libpng.3 b/libpng.3
index 88d775b..657039b 100644
--- a/libpng.3
+++ b/libpng.3
@@ -1,6 +1,6 @@
-.TH LIBPNG 3 "April 11, 2001"
+.TH LIBPNG 3 "April 15, 2001"
 .SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.0.11beta2
+libpng \- Portable Network Graphics (PNG) Reference Library 1.0.11beta3
 .SH SYNOPSIS
 \fI\fB
 
@@ -747,7 +747,7 @@
 .SH LIBPNG.TXT
 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
  <randeg@alum.rpi.edu>
  Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@@ -3464,13 +3464,13 @@
 
 .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
 an official declaration.
 
 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.
 
 Libpng only has three year fields.  One is a 2-byte unsigned integer that
@@ -3579,7 +3579,7 @@
  1.0.10beta1          1    10010  2.1.0.10beta1
  1.0.10rc1            1    10010  2.1.0.10rc1
  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
 and patch numbers; the shared-library major version number will be
@@ -3637,7 +3637,7 @@
 
 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.
 Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
 
@@ -3654,7 +3654,7 @@
 If you modify libpng you may insert additional notices immediately following
 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
 distributed according to the same disclaimer and license as libpng-1.0.6
 with the following individuals added to the list of Contributing Authors
@@ -3746,7 +3746,7 @@
 
 Glenn Randers-Pehrson
 randeg@alum.rpi.edu
-April 11, 2001
+April 15, 2001
 
 .\" end of man page
 
diff --git a/libpng.txt b/libpng.txt
index 2f0d84b..425cf30 100644
--- a/libpng.txt
+++ b/libpng.txt
@@ -1,6 +1,6 @@
 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
  <randeg@alum.rpi.edu>
  Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
@@ -2717,13 +2717,13 @@
 
 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
 an official declaration.
 
 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.
 
 Libpng only has three year fields.  One is a 2-byte unsigned integer that
diff --git a/libpngpf.3 b/libpngpf.3
index 0e35d00..b503e17 100644
--- a/libpngpf.3
+++ b/libpngpf.3
@@ -1,6 +1,6 @@
-.TH LIBPNGPF 3 "April 11, 2001"
+.TH LIBPNGPF 3 "April 15, 2001"
 .SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.0.11beta2
+libpng \- Portable Network Graphics (PNG) Reference Library 1.0.11beta3
 (private functions)
 .SH SYNOPSIS
 \fB#include <png.h>\fP
diff --git a/png.5 b/png.5
index 33a996f..7ff5898 100644
--- a/png.5
+++ b/png.5
@@ -1,4 +1,4 @@
-.TH PNG 5 "April 11, 2001"
+.TH PNG 5 "April 15, 2001"
 .SH NAME
 png \- Portable Network Graphics (PNG) format
 .SH DESCRIPTION
diff --git a/png.c b/png.c
index d392d83..59fab5a 100644
--- a/png.c
+++ b/png.c
@@ -1,7 +1,7 @@
 
 /* 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
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -13,14 +13,14 @@
 #include "png.h"
 
 /* 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
  * string defined in png.h.  */
 
 #ifdef PNG_USE_GLOBAL_ARRAYS
 /* 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 */
 /* Place to hold the signature string for a PNG file. */
@@ -142,15 +142,18 @@
    png_voidp ptr = (png_voidp)png_malloc((png_structp)png_ptr, num_bytes);
 
 #ifndef PNG_NO_ZALLOC_ZERO
-   if (num_bytes > (png_uint_32)0x8000L)
+   if (ptr)
    {
-      png_memset(ptr, 0, (png_size_t)0x8000L);
-      png_memset((png_bytep)ptr + (png_size_t)0x8000L, 0,
-         (png_size_t)(num_bytes - (png_uint_32)0x8000L));
-   }
-   else
-   {
-      png_memset(ptr, 0, (png_size_t)num_bytes);
+     if (num_bytes > (png_uint_32)0x8000L)
+     {
+        png_memset(ptr, 0, (png_size_t)0x8000L);
+        png_memset((png_bytep)ptr + (png_size_t)0x8000L, 0,
+           (png_size_t)(num_bytes - (png_uint_32)0x8000L));
+     }
+     else
+     {
+        png_memset(ptr, 0, (png_size_t)num_bytes);
+     }
    }
 #endif
    return ((voidpf)ptr);
@@ -581,34 +584,39 @@
          sizeof(char)));
    }
 
+   if (png_ptr->time_buffer == NULL)
+      png_warning(png_ptr, "Malloc of buffer for tIME chunk failed");
+   else
+   {
 #if defined(_WIN32_WCE)
-  {
-     wchar_t time_buf[29];
-     wsprintf(time_buf, TEXT("%d %S %d %02d:%02d:%02d +0000"),
-              ptime->day % 32, short_months[(ptime->month - 1) % 12],
-              ptime->year, ptime->hour % 24, ptime->minute % 60,
-              ptime->second % 61);
-     WideCharToMultiByte(CP_ACP, 0, time_buf, -1, png_ptr->time_buffer, 29,
-        NULL, NULL);
-  }
+     {
+        wchar_t time_buf[29];
+        wsprintf(time_buf, TEXT("%d %S %d %02d:%02d:%02d +0000"),
+            ptime->day % 32, short_months[(ptime->month - 1) % 12],
+            ptime->year, ptime->hour % 24, ptime->minute % 60,
+            ptime->second % 61);
+        WideCharToMultiByte(CP_ACP, 0, time_buf, -1, png_ptr->time_buffer, 29,
+            NULL, NULL);
+     }
 #else
 #ifdef USE_FAR_KEYWORD
-   {
-      char near_time_buf[29];
-      sprintf(near_time_buf, "%d %s %d %02d:%02d:%02d +0000",
-               ptime->day % 32, short_months[(ptime->month - 1) % 12],
-               ptime->year, ptime->hour % 24, ptime->minute % 60,
-               ptime->second % 61);
-      png_memcpy(png_ptr->time_buffer, near_time_buf,
-      29*sizeof(char));
-   }
+     {
+        char near_time_buf[29];
+        sprintf(near_time_buf, "%d %s %d %02d:%02d:%02d +0000",
+            ptime->day % 32, short_months[(ptime->month - 1) % 12],
+            ptime->year, ptime->hour % 24, ptime->minute % 60,
+            ptime->second % 61);
+        png_memcpy(png_ptr->time_buffer, near_time_buf,
+            29*sizeof(char));
+     }
 #else
    sprintf(png_ptr->time_buffer, "%d %s %d %02d:%02d:%02d +0000",
-               ptime->day % 32, short_months[(ptime->month - 1) % 12],
-               ptime->year, ptime->hour % 24, ptime->minute % 60,
-               ptime->second % 61);
+       ptime->day % 32, short_months[(ptime->month - 1) % 12],
+       ptime->year, ptime->hour % 24, ptime->minute % 60,
+       ptime->second % 61);
 #endif
 #endif /* _WIN32_WCE */
+   }
    return ((png_charp)png_ptr->time_buffer);
 }
 #endif /* PNG_TIME_RFC1123_SUPPORTED */
@@ -626,7 +634,7 @@
 png_get_copyright(png_structp png_ptr)
 {
    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) 1996, 1997 Andreas Dilger\n\
    Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\n");
@@ -644,8 +652,8 @@
 {
    /* Version of *.c files used when building libpng */
    if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
-      return((png_charp) "1.0.11beta2");
-   return((png_charp) "1.0.11beta2");
+      return((png_charp) "1.0.11beta3");
+   return((png_charp) "1.0.11beta3");
 }
 
 png_charp PNGAPI
diff --git a/png.h b/png.h
index d2c1a9c..b78bac5 100644
--- a/png.h
+++ b/png.h
@@ -1,7 +1,7 @@
 
 /* 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
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -9,7 +9,7 @@
  * Authors and maintainers:
  *  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.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.
  *
  * Note about libpng version numbers:
@@ -67,7 +67,7 @@
  *    1.0.10beta1              1    10010  2.1.0.10beta1
  *    1.0.10rc1                1    10010  2.1.0.10rc1
  *    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
  *    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
  * 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
  * distributed according to the same disclaimer and license as libpng-1.0.6
  * with the following individuals added to the list of Contributing Authors
@@ -202,13 +202,13 @@
  * Y2K compliance in libpng:
  * =========================
  *
- *    April 11, 2001
+ *    April 15, 2001
  *
  *    Since the PNG Development group is an ad-hoc body, we can't make
  *    an official declaration.
  *
  *    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.
  *
  *    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 */
-#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_DLLNUM  %DLLNUM%
@@ -276,7 +276,7 @@
 /* This should match the numeric part of the final component of
  * 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_BETA     2
@@ -1185,9 +1185,9 @@
 
 
 /* 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;
 
@@ -2235,7 +2235,7 @@
 /* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */
 
 #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
 /* With these routines we avoid an integer divide, which will be slower on
diff --git a/pngasmrd.h b/pngasmrd.h
index d6d02cd..aab6160 100644
--- a/pngasmrd.h
+++ b/pngasmrd.h
@@ -1,6 +1,6 @@
 /* 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
  * Copyright (c) 2001 Glenn Randers-Pehrson
  *
diff --git a/pngconf.h b/pngconf.h
index ae486bb..c54744b 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1,6 +1,6 @@
 /* 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
  * Copyright (c) 1998-2001 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngerror.c b/pngerror.c
index dc4c13d..9e76975 100644
--- a/pngerror.c
+++ b/pngerror.c
@@ -1,7 +1,7 @@
 
 /* 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
  * Copyright (c) 1998-2001 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pnggccrd.c b/pnggccrd.c
index a5b1228..ac2b8bb 100644
--- a/pnggccrd.c
+++ b/pnggccrd.c
@@ -6,7 +6,7 @@
  *     and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
  *     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
  * Copyright (c) 1998-2001 Glenn Randers-Pehrson
  * Copyright (c) 1998, Intel Corporation
diff --git a/pngget.c b/pngget.c
index a413948..e05b2af 100644
--- a/pngget.c
+++ b/pngget.c
@@ -1,7 +1,7 @@
 
 /* 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
  * Copyright (c) 1998-2001 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngmem.c b/pngmem.c
index c9bfd2c..3ba7c6a 100644
--- a/pngmem.c
+++ b/pngmem.c
@@ -1,7 +1,7 @@
 
 /* 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
  * Copyright (c) 1998-2001 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngpread.c b/pngpread.c
index e70d1f0..816abbe 100644
--- a/pngpread.c
+++ b/pngpread.c
@@ -1,7 +1,7 @@
 
 /* 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
  * Copyright (c) 1998-2001 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -585,9 +585,18 @@
       old_buffer = png_ptr->save_buffer;
       png_ptr->save_buffer = (png_bytep)png_malloc(png_ptr,
          (png_uint_32)new_max);
-      png_memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
-      png_free(png_ptr, old_buffer);
-      png_ptr->save_buffer_max = 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_free(png_ptr, old_buffer);
+        png_ptr->save_buffer_max = new_max;
+      }
    }
    if (png_ptr->current_buffer_size)
    {
@@ -1017,6 +1026,12 @@
 
    png_ptr->current_text = (png_charp)png_malloc(png_ptr,
          (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_ptr = png_ptr->current_text;
    png_ptr->current_text_size = (png_size_t)length;
@@ -1068,6 +1083,11 @@
          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->key = key;
 #ifdef PNG_iTXt_SUPPORTED
@@ -1110,6 +1130,12 @@
 
    png_ptr->current_text = (png_charp)png_malloc(png_ptr,
        (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_ptr = png_ptr->current_text;
    png_ptr->current_text_size = (png_size_t)length;
@@ -1200,12 +1226,17 @@
                text = (png_charp)png_malloc(png_ptr,
                   (png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out +
                      key_size + 1));
-               png_memcpy(text + key_size, png_ptr->zbuf,
-                  png_ptr->zbuf_size - png_ptr->zstream.avail_out);
-               png_memcpy(text, key, key_size);
-               text_size = key_size + png_ptr->zbuf_size -
-                  png_ptr->zstream.avail_out;
-               *(text + text_size) = '\0';
+               if (text == (png_charp)NULL)
+                 png_warning(png_ptr, "Malloc of text block failed");
+               else
+               {
+                 png_memcpy(text + key_size, png_ptr->zbuf,
+                    png_ptr->zbuf_size - png_ptr->zstream.avail_out);
+                 png_memcpy(text, key, key_size);
+                 text_size = key_size + png_ptr->zbuf_size -
+                    png_ptr->zstream.avail_out;
+                 *(text + text_size) = '\0';
+               }
             }
             else
             {
@@ -1215,12 +1246,17 @@
                text = (png_charp)png_malloc(png_ptr, text_size +
                   (png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out
                    + 1));
-               png_memcpy(text, tmp, text_size);
-               png_free(png_ptr, tmp);
-               png_memcpy(text + text_size, png_ptr->zbuf,
-                  png_ptr->zbuf_size - png_ptr->zstream.avail_out);
-               text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out;
-               *(text + text_size) = '\0';
+               if (text != (png_charp)NULL)
+                 png_warning(png_ptr, "Malloc of new text block failed");
+               else
+               {
+                 png_memcpy(text, tmp, text_size);
+                 png_free(png_ptr, tmp);
+                 png_memcpy(text + text_size, png_ptr->zbuf,
+                    png_ptr->zbuf_size - png_ptr->zstream.avail_out);
+                 text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out;
+                 *(text + text_size) = '\0';
+               }
             }
             if (ret != Z_STREAM_END)
             {
@@ -1252,18 +1288,23 @@
       text += key_size;
 
       text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
-      text_ptr->compression = PNG_TEXT_COMPRESSION_zTXt;
-      text_ptr->key = key;
+      if (text_ptr == (png_textp)NULL)
+         png_warning (png_ptr, "Malloc of iTXt failed");
+      else
+      {
+        text_ptr->compression = PNG_TEXT_COMPRESSION_zTXt;
+        text_ptr->key = key;
 #ifdef PNG_iTXt_SUPPORTED
-      text_ptr->lang = (char *)NULL;
-      text_ptr->lang_key = (char *)NULL;
+        text_ptr->lang = (char *)NULL;
+        text_ptr->lang_key = (char *)NULL;
 #endif
-      text_ptr->text = text;
+        text_ptr->text = text;
 
-      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, key);
-      png_free(png_ptr, text_ptr);
    }
 }
 #endif
@@ -1292,11 +1333,16 @@
 
    png_ptr->current_text = (png_charp)png_malloc(png_ptr,
          (png_uint_32)(length+1));
-   png_ptr->current_text[length] = '\0';
-   png_ptr->current_text_ptr = png_ptr->current_text;
-   png_ptr->current_text_size = (png_size_t)length;
-   png_ptr->current_text_left = (png_size_t)length;
-   png_ptr->process_mode = PNG_READ_iTXt_MODE;
+   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_ptr = png_ptr->current_text;
+       png_ptr->current_text_size = (png_size_t)length;
+       png_ptr->current_text_left = (png_size_t)length;
+       png_ptr->process_mode = PNG_READ_iTXt_MODE;
+     }
 }
 
 void /* PRIVATE */
@@ -1360,6 +1406,10 @@
          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->key = key;
       text_ptr->lang = lang;
@@ -1371,6 +1421,7 @@
       png_set_text(png_ptr, info_ptr, text_ptr, 1);
 
       png_free(png_ptr, text_ptr);
+      }
    }
 }
 #endif
@@ -1418,25 +1469,30 @@
 
        png_strcpy((png_charp)chunk.name, (png_charp)png_ptr->chunk_name);
        chunk.data = (png_bytep)png_malloc(png_ptr, length);
-       png_crc_read(png_ptr, chunk.data, length);
-       chunk.size = length;
-#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
-       if(png_ptr->read_user_chunk_fn != (png_user_chunk_ptr)NULL)
-       {
-          /* callback to user unknown chunk handler */
-          if ((*(png_ptr->read_user_chunk_fn)) (png_ptr, &chunk) <= 0)
-          {
-             if (!(png_ptr->chunk_name[0] & 0x20))
-                if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
-                     HANDLE_CHUNK_ALWAYS)
-                   png_chunk_error(png_ptr, "unknown critical chunk");
-          }
-             png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);
-       }
+       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);
+         chunk.size = length;
+#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
+         if(png_ptr->read_user_chunk_fn != (png_user_chunk_ptr)NULL)
+         {
+            /* callback to user unknown chunk handler */
+            if ((*(png_ptr->read_user_chunk_fn)) (png_ptr, &chunk) <= 0)
+            {
+               if (!(png_ptr->chunk_name[0] & 0x20))
+                  if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
+                       HANDLE_CHUNK_ALWAYS)
+                     png_chunk_error(png_ptr, "unknown critical chunk");
+            }
+               png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);
+         }
+         else
 #endif
-          png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);
-       png_free(png_ptr, chunk.data);
+            png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);
+         png_free(png_ptr, chunk.data);
+       }
    }
    else
 #endif
diff --git a/pngread.c b/pngread.c
index 9498538..28e66d4 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1,7 +1,7 @@
 
 /* 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
  * Copyright (c) 1998-2001 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -115,6 +115,8 @@
    png_ptr->zbuf_size = PNG_ZBUF_SIZE;
    png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
      (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.zfree = png_zfree;
    png_ptr->zstream.opaque = (voidpf)png_ptr;
@@ -197,6 +199,8 @@
    png_ptr->zbuf_size = PNG_ZBUF_SIZE;
    png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
      (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.zfree = png_zfree;
    png_ptr->zstream.opaque = (voidpf)png_ptr;
@@ -715,7 +719,7 @@
  * not called png_set_interlace_handling(), the display_row buffer will
  * 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
@@ -764,7 +768,7 @@
  * only call this function once.  If you desire to have an image for
  * 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
 png_read_image(png_structp png_ptr, png_bytepp image)
@@ -1305,7 +1309,7 @@
 
    /* Optional call to gamma correct and add the background to the palette
     * 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);
 
@@ -1317,13 +1321,26 @@
    if(info_ptr->row_pointers == NULL)
    {
       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
       info_ptr->free_me |= PNG_FREE_ROWS;
 #endif
       for (row = 0; row < (int)info_ptr->height; row++)
+      {
          info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_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);
diff --git a/pngrio.c b/pngrio.c
index 2edced7..d6d1d70 100644
--- a/pngrio.c
+++ b/pngrio.c
@@ -1,7 +1,7 @@
 
 /* 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
  * Copyright (c) 1998-2001 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngrtran.c b/pngrtran.c
index c85bf82..9ab152e 100644
--- a/pngrtran.c
+++ b/pngrtran.c
@@ -1,7 +1,7 @@
 
 /* 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
  * Copyright (c) 1998-2001 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -155,6 +155,11 @@
 
       png_ptr->dither_index = (png_bytep)png_malloc(png_ptr,
          (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++)
          png_ptr->dither_index[i] = (png_byte)i;
    }
@@ -172,6 +177,12 @@
          /* initialize an array to sort colors */
          sort = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_palette
             * 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 */
          for (i = 0; i < num_palette; i++)
@@ -302,6 +313,14 @@
             (png_uint_32)(num_palette * sizeof (png_byte)));
          palette_to_index = (png_bytep)png_malloc(png_ptr,
             (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 */
          for (i = 0; i < num_palette; i++)
@@ -312,6 +331,14 @@
 
          hash = (png_dsortpp)png_malloc(png_ptr, (png_uint_32)(769 *
             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++)
             hash[i] = NULL;
 /*         png_memset(hash, 0, 769 * sizeof (png_dsortp)); */
@@ -346,10 +373,13 @@
 
                      t = (png_dsortp)png_malloc(png_ptr, (png_uint_32)(sizeof
                          (png_dsort)));
+                     if (t != (png_dsortp)NULL)
+                     {
                      t->next = hash[d];
                      t->left = (png_byte)i;
                      t->right = (png_byte)j;
                      hash[d] = t;
+                     }
                   }
                }
             }
@@ -456,16 +486,25 @@
 
       png_ptr->palette_lookup = (png_bytep )png_malloc(png_ptr,
          (png_uint_32)(num_entries * sizeof (png_byte)));
-
-      png_memset(png_ptr->palette_lookup, 0, 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));
 
       distance = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_entries *
          sizeof(png_byte)));
-
-      png_memset(distance, 0xff, num_entries * sizeof(png_byte));
-
-      for (i = 0; i < num_palette; i++)
+      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));
+
+        for (i = 0; i < num_palette; i++)
+        {
          int ir, ig, ib;
          int r = (palette[i].red >> (8 - PNG_DITHER_RED_BITS));
          int g = (palette[i].green >> (8 - PNG_DITHER_GREEN_BITS));
@@ -496,11 +535,12 @@
                      png_ptr->palette_lookup[d_index] = (png_byte)i;
                   }
                }
-            }
-         }
-      }
+             }
+           }
+        }
 
       png_free(png_ptr, distance);
+      }
    }
 }
 #endif
@@ -3858,6 +3898,11 @@
 
       png_ptr->gamma_table = (png_bytep)png_malloc(png_ptr,
          (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++)
       {
@@ -3874,6 +3919,11 @@
 
          png_ptr->gamma_to_1 = (png_bytep)png_malloc(png_ptr,
             (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++)
          {
@@ -3884,6 +3934,11 @@
 
          png_ptr->gamma_from_1 = (png_bytep)png_malloc(png_ptr,
             (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)
             g = 1.0 / png_ptr->screen_gamma;
@@ -3946,6 +4001,11 @@
 
       png_ptr->gamma_16_table = (png_uint_16pp)png_malloc(png_ptr,
          (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))
       {
@@ -3956,6 +4016,11 @@
          {
             png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr,
                (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;
@@ -3986,6 +4051,11 @@
          {
             png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr,
                (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);
             for (j = 0; j < 256; j++)
@@ -4006,11 +4076,22 @@
 
          png_ptr->gamma_16_to_1 = (png_uint_16pp)png_malloc(png_ptr,
             (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++)
          {
             png_ptr->gamma_16_to_1[i] = (png_uint_16p)png_malloc(png_ptr,
                (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 *
                (png_uint_32)png_gamma_shift[shift]) >> 4);
@@ -4029,11 +4110,23 @@
 
          png_ptr->gamma_16_from_1 = (png_uint_16pp)png_malloc(png_ptr,
             (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++)
          {
             png_ptr->gamma_16_from_1[i] = (png_uint_16p)png_malloc(png_ptr,
                (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 *
                (png_uint_32)png_gamma_shift[shift]) >> 4);
diff --git a/pngrutil.c b/pngrutil.c
index 5b9b745..522af2a 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -1,7 +1,7 @@
 
 /* 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
  * Copyright (c) 1998-2001 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -201,15 +201,19 @@
             {
                text_size = prefix_size + sizeof(msg) + 1;
                text = (png_charp)png_malloc(png_ptr, text_size);
-               png_memcpy(text, chunkdata, prefix_size);
+               if (text != NULL)
+                 png_memcpy(text, chunkdata, prefix_size);
             }
 
-            text[text_size - 1] = 0x00;
+            if (text != NULL)
+            {
+               text[text_size - 1] = 0x00;
 
-            /* Copy what we can of the error message into the text chunk */
-            text_size = (png_size_t)(chunklength - (text - chunkdata) - 1);
-            text_size = sizeof(msg) > text_size ? text_size : sizeof(msg);
-            png_memcpy(text + prefix_size, msg, text_size + 1);
+               /* Copy what we can of the error message into the text chunk */
+               text_size = (png_size_t)(chunklength - (text - chunkdata) - 1);
+               text_size = sizeof(msg) > text_size ? text_size : sizeof(msg);
+               png_memcpy(text + prefix_size, msg, text_size + 1);
+            }
             break;
          }
          if (!png_ptr->zstream.avail_out || ret == Z_STREAM_END)
@@ -219,10 +223,13 @@
                text_size = prefix_size +
                    png_ptr->zbuf_size - png_ptr->zstream.avail_out;
                text = (png_charp)png_malloc(png_ptr, text_size + 1);
-               png_memcpy(text + prefix_size, png_ptr->zbuf,
+               if (text != NULL)
+               {
+                 png_memcpy(text + prefix_size, png_ptr->zbuf,
                           text_size - prefix_size);
-               png_memcpy(text, chunkdata, prefix_size);
-               *(text + text_size) = 0x00;
+                 png_memcpy(text, chunkdata, prefix_size);
+                 *(text + text_size) = 0x00;
+               }
             }
             else
             {
@@ -231,12 +238,20 @@
                tmp = text;
                text = (png_charp)png_malloc(png_ptr, (png_uint_32)(text_size +
                   png_ptr->zbuf_size - png_ptr->zstream.avail_out + 1));
+               if (text != NULL)
+               {
                png_memcpy(text, tmp, text_size);
                png_free(png_ptr, tmp);
                png_memcpy(text + text_size, png_ptr->zbuf,
                   (png_ptr->zbuf_size - png_ptr->zstream.avail_out));
                text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out;
                *(text + text_size) = 0x00;
+               }
+               else
+               {
+                  png_warning (png_ptr, "Could not malloc text buffer");
+                  text=tmp;
+               }
             }
             if (ret == Z_STREAM_END)
                break;
@@ -270,9 +285,13 @@
          if (text ==  NULL)
          {
             text = (png_charp)png_malloc(png_ptr, text_size+1);
-            png_memcpy(text, chunkdata, prefix_size);
+            if (text !=  NULL)
+               png_memcpy(text, chunkdata, prefix_size);
+            else
+               png_warning(png_ptr, "Could not malloc text chunkdata");
          }
-         *(text + text_size) = 0x00;
+         if (text !=  NULL)
+            *(text + text_size) = 0x00;
       }
 
       inflateReset(&png_ptr->zstream);
@@ -983,7 +1002,14 @@
 
    chunkdata = (png_charp)png_malloc(png_ptr, length + 1);
    slength = (png_size_t)length;
-   png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
+   if (chunkdata != (png_charp)NULL)
+      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))
    {
@@ -1079,8 +1105,16 @@
 #endif
 
    chunkdata = (png_bytep)png_malloc(png_ptr, length + 1);
-   slength = (png_size_t)length;
-   png_crc_read(png_ptr, chunkdata, slength);
+   if (chunkdata != (png_bytep)NULL)
+   {
+      slength = (png_size_t)length;
+      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))
    {
@@ -1110,12 +1144,19 @@
    if (data_length % entry_size)
    {
       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.entries = (png_sPLT_entryp)png_malloc(
        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
    for (i = 0; i < new_palette.nentries; i++)
@@ -1525,6 +1566,12 @@
    png_debug1(2, "Allocating and reading pCAL chunk data (%lu bytes)\n",
       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;
    png_crc_read(png_ptr, (png_bytep)purpose, slength);
 
@@ -1581,6 +1628,11 @@
    png_debug(3, "Allocating pCAL parameters array\n");
    params = (png_charpp)png_malloc(png_ptr, (png_uint_32)(nparams
       *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. */
    for (i = 0; i < (int)nparams; i++)
@@ -1645,6 +1697,12 @@
    png_debug1(2, "Allocating and reading sCAL chunk data (%lu bytes)\n",
       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;
    png_crc_read(png_ptr, (png_bytep)buffer, slength);
 
@@ -1668,7 +1726,8 @@
 #else
 #ifdef PNG_FIXED_POINT_SUPPORTED
    swidth = (png_charp)png_malloc(png_ptr, png_strlen(ep) + 1);
-   png_memcpy(swidth, ep, (png_size_t)png_strlen(ep));
+   if (swidth != (png_charp)NULL)
+     png_memcpy(swidth, ep, (png_size_t)png_strlen(ep));
 #endif
 #endif
 
@@ -1686,7 +1745,8 @@
 #else
 #ifdef PNG_FIXED_POINT_SUPPORTED
    sheight = (png_charp)png_malloc(png_ptr, png_strlen(ep) + 1);
-   png_memcpy(sheight, ep, (png_size_t)png_strlen(ep));
+   if (sheight != (png_charp)NULL)
+      png_memcpy(sheight, ep, (png_size_t)png_strlen(ep));
 #endif
 #endif
 
@@ -1795,7 +1855,14 @@
 
    key = (png_charp)png_malloc(png_ptr, length + 1);
    slength = (png_size_t)length;
-   png_crc_read(png_ptr, (png_bytep)key, slength);
+   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);
 
    if (png_crc_finish(png_ptr, skip))
    {
@@ -1812,6 +1879,8 @@
       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->key = key;
 #ifdef PNG_iTXt_SUPPORTED
@@ -1824,8 +1893,11 @@
 
    png_set_text(png_ptr, info_ptr, text_ptr, 1);
 
-   png_free(png_ptr, key);
    png_free(png_ptr, text_ptr);
+   }
+   else
+     png_warning(png_ptr, "Could not allocate iTXt pointer");
+   png_free(png_ptr, key);
 }
 #endif
 
@@ -1859,8 +1931,17 @@
 #endif
 
    chunkdata = (png_charp)png_malloc(png_ptr, length + 1);
-   slength = (png_size_t)length;
-   png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
+   if (chunkdata != (png_charp)NULL)
+   {
+     slength = (png_size_t)length;
+     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))
    {
       png_free(png_ptr, chunkdata);
@@ -1894,19 +1975,24 @@
                                     (png_size_t)length, prefix_len, &data_len);
 
    text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
-   text_ptr->compression = comp_type;
-   text_ptr->key = chunkdata;
+   if (text_ptr != (png_textp)NULL)
+   {
+     text_ptr->compression = comp_type;
+     text_ptr->key = chunkdata;
 #ifdef PNG_iTXt_SUPPORTED
-   text_ptr->lang = NULL;
-   text_ptr->lang_key = NULL;
-   text_ptr->itxt_length = 0;
+     text_ptr->lang = NULL;
+     text_ptr->lang_key = NULL;
+     text_ptr->itxt_length = 0;
 #endif
-   text_ptr->text = chunkdata + prefix_len;
-   text_ptr->text_length = data_len;
+     text_ptr->text = chunkdata + prefix_len;
+     text_ptr->text_length = data_len;
 
-   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);
 }
 #endif
@@ -1943,8 +2029,17 @@
 #endif
 
    chunkdata = (png_charp)png_malloc(png_ptr, length + 1);
-   slength = (png_size_t)length;
-   png_crc_read(png_ptr, (png_bytep)chunkdata, slength);
+   if (chunkdata != (png_charp)NULL)
+   {
+     slength = (png_size_t)length;
+     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))
    {
       png_free(png_ptr, chunkdata);
@@ -1989,17 +2084,22 @@
    else
        data_len=png_strlen(chunkdata + prefix_len);
    text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
-   text_ptr->compression = (int)comp_flag + 1;
-   text_ptr->lang_key = chunkdata+(lang_key-key);
-   text_ptr->lang = chunkdata+(lang-key);
-   text_ptr->itxt_length = data_len;
-   text_ptr->text_length = 0;
-   text_ptr->key = chunkdata;
-   text_ptr->text = chunkdata + prefix_len;
+   if (text_ptr != (png_textp)NULL)
+   {
+     text_ptr->compression = (int)comp_flag + 1;
+     text_ptr->lang_key = chunkdata+(lang_key-key);
+     text_ptr->lang = chunkdata+(lang-key);
+     text_ptr->itxt_length = data_len;
+     text_ptr->text_length = 0;
+     text_ptr->key = chunkdata;
+     text_ptr->text = chunkdata + prefix_len;
 
-   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);
 }
 #endif
@@ -2055,8 +2155,17 @@
 #endif
        png_strcpy((png_charp)chunk.name, (png_charp)png_ptr->chunk_name);
        chunk.data = (png_bytep)png_malloc(png_ptr, length);
-       png_crc_read(png_ptr, chunk.data, length);
-       chunk.size = length;
+       if (chunk.data != (png_bytep)NULL)
+       {
+         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(png_ptr->read_user_chunk_fn != (png_user_chunk_ptr)NULL)
        {
@@ -2963,6 +3072,8 @@
       png_error(png_ptr, "This image requires a row greater than 64KB");
 #endif
    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;
 
 #ifdef PNG_MAX_MALLOC_64K
@@ -2971,6 +3082,11 @@
 #endif
    png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)(
       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);
 
diff --git a/pngset.c b/pngset.c
index 0ee46a7..2465fd0 100644
--- a/pngset.c
+++ b/pngset.c
@@ -1,7 +1,7 @@
 
 /* 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
  * Copyright (c) 1998-2001 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -143,14 +143,22 @@
    if (png_ptr == NULL || info_ptr == NULL)
       return;
    if (info_ptr->num_palette == 0)
+   {
        png_warning(png_ptr,
-		   "Palette size 0, hIST allocation skipped.");
+          "Palette size 0, hIST allocation skipped.");
+       return;
+   }
 
 #ifdef PNG_FREE_ME_SUPPORTED
    png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0);
 #endif
    png_ptr->hist = (png_uint_16p)png_malloc(png_ptr,
       (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++)
        png_ptr->hist[i] = hist[i];
@@ -292,6 +300,11 @@
    length = png_strlen(purpose) + 1;
    png_debug1(3, "allocating purpose for info (%lu bytes)\n", 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_debug(3, "storing X0, X1, type, and nparams in info\n");
@@ -303,10 +316,24 @@
    length = png_strlen(units) + 1;
    png_debug1(3, "allocating units for info (%lu bytes)\n", 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);
 
    info_ptr->pcal_params = (png_charpp)png_malloc(png_ptr,
       (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;
 
    for (i = 0; i < nparams; i++)
@@ -314,7 +341,13 @@
       length = png_strlen(params[i]) + 1;
       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);
-      png_memcpy(info_ptr->pcal_params[i], params[i], (png_size_t)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);
    }
 
    info_ptr->valid |= PNG_INFO_pCAL;
@@ -357,12 +390,14 @@
    length = png_strlen(swidth) + 1;
    png_debug1(3, "allocating unit for info (%d bytes)\n", length);
    info_ptr->scal_s_width = (png_charp)png_malloc(png_ptr, length);
-   png_memcpy(info_ptr->scal_s_width, swidth, (png_size_t)length);
+   if (info_ptr->scal_s_width != (png_charp)NULL)
+      png_memcpy(info_ptr->scal_s_width, swidth, (png_size_t)length);
 
    length = png_strlen(sheight) + 1;
    png_debug1(3, "allocating unit for info (%d bytes)\n", length);
-   info_ptr->scal_s_width = (png_charp)png_malloc(png_ptr, length);
-   png_memcpy(info_ptr->scal_s_height, sheight, (png_size_t)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);
 
    info_ptr->valid |= PNG_INFO_sCAL;
 #ifdef PNG_FREE_ME_SUPPORTED
@@ -408,6 +443,11 @@
 #endif
    png_ptr->palette = (png_colorp)png_zalloc(png_ptr, (uInt)num_palette,
       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));
    info_ptr->palette = png_ptr->palette;
    info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
@@ -532,8 +572,19 @@
       return;
 
    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);
    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_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, 0);
@@ -579,6 +630,12 @@
          old_text = info_ptr->text;
          info_ptr->text = (png_textp)png_malloc(png_ptr,
             (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 *
             sizeof(png_text)));
          png_free(png_ptr, old_text);
@@ -589,6 +646,11 @@
          info_ptr->num_text = 0;
          info_ptr->text = (png_textp)png_malloc(png_ptr,
             (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
          info_ptr->free_me |= PNG_FREE_TEXT;
 #endif
@@ -650,6 +712,11 @@
 
       textp->key = (png_charp)png_malloc(png_ptr,
          (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",
          key_len + lang_len + lang_key_len + text_length + 4, (int)textp->key);
 
@@ -737,6 +804,11 @@
 #endif
        png_ptr->trans = info_ptr->trans = (png_bytep)png_malloc(png_ptr,
            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);
 #ifdef PNG_FREE_ME_SUPPORTED
        info_ptr->free_me |= PNG_FREE_TRNS;
@@ -767,6 +839,11 @@
 
     np = (png_sPLT_tp)png_malloc(png_ptr,
         (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,
            info_ptr->splt_palettes_num * sizeof(png_sPLT_t));
@@ -779,14 +856,22 @@
         png_sPLT_tp from = entries + i;
 
         to->name = (png_charp)png_malloc(png_ptr,
-                                        png_strlen(from->name) + 1);
+            png_strlen(from->name) + 1);
         png_strcpy(to->name, from->name);
         to->entries = (png_sPLT_entryp)png_malloc(png_ptr,
-                                 from->nentries * sizeof(png_sPLT_t));
-        png_memcpy(to->entries, from->entries,
+            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,
                from->nentries * sizeof(png_sPLT_t));
-        to->nentries = from->nentries;
-        to->depth = from->depth;
+          to->nentries = from->nentries;
+          to->depth = from->depth;
+        }
     }
 
     info_ptr->splt_palettes = np;
@@ -812,6 +897,11 @@
     np = (png_unknown_chunkp)png_malloc(png_ptr,
         (info_ptr->unknown_chunks_num + num_unknowns) *
         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,
            info_ptr->unknown_chunks_num * sizeof(png_unknown_chunk));
@@ -825,11 +915,19 @@
 
         png_strcpy((png_charp)to->name, (png_charp)from->name);
         to->data = (png_bytep)png_malloc(png_ptr, from->size);
-        png_memcpy(to->data, from->data, from->size);
-        to->size = 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);
+          to->size = from->size;
 
-        /* note our location in the read or write sequence */
-        to->location = (png_byte)(png_ptr->mode & 0xff);
+          /* note our location in the read or write sequence */
+          to->location = (png_byte)(png_ptr->mode & 0xff);
+        }
     }
 
     info_ptr->unknown_chunks = np;
diff --git a/pngtest.c b/pngtest.c
index 972576c..c5c12c1 100644
--- a/pngtest.c
+++ b/pngtest.c
@@ -1,7 +1,7 @@
 
 /* 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
  * Copyright (c) 1998-2001 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -1523,4 +1523,4 @@
 }
 
 /* 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;
diff --git a/pngtrans.c b/pngtrans.c
index ebeda25..6f521e9 100644
--- a/pngtrans.c
+++ b/pngtrans.c
@@ -1,7 +1,7 @@
 
 /* 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
  * Copyright (c) 1998-2001 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngvcrd.c b/pngvcrd.c
index 13d882d..17499ac 100644
--- a/pngvcrd.c
+++ b/pngvcrd.c
@@ -2,7 +2,7 @@
  *
  * 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
  * Copyright (c) 1998-2001 Glenn Randers-Pehrson
  * Copyright (c) 1998, Intel Corporation
diff --git a/pngwio.c b/pngwio.c
index f25ac14..0775dbc 100644
--- a/pngwio.c
+++ b/pngwio.c
@@ -1,7 +1,7 @@
 
 /* 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
  * Copyright (c) 1998-2001 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngwrite.c b/pngwrite.c
index 1678358..18ce24c 100644
--- a/pngwrite.c
+++ b/pngwrite.c
@@ -1,7 +1,7 @@
 
 /* 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
  * Copyright (c) 1998-2001 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -512,6 +512,8 @@
    png_ptr->zbuf_size = PNG_ZBUF_SIZE;
    png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
       (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);
 
@@ -581,6 +583,8 @@
    png_ptr->zbuf_size = PNG_ZBUF_SIZE;
    png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
       (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);
 
 #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
@@ -1029,6 +1033,8 @@
          {
             png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
               (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;
          }
 
@@ -1043,6 +1049,10 @@
             {
                png_ptr->up_row = (png_bytep)png_malloc(png_ptr,
                   (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;
             }
          }
@@ -1058,6 +1068,8 @@
             {
                png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
                   (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;
             }
          }
@@ -1074,6 +1086,8 @@
             {
                png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr,
                   (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;
             }
          }
@@ -1129,10 +1143,13 @@
          png_ptr->prev_filters = (png_bytep)png_malloc(png_ptr,
             (png_uint_32)(sizeof(png_byte) * num_weights));
 
-         /* To make sure that the weighting starts out fairly */
-         for (i = 0; i < num_weights; i++)
+         if (png_ptr->prev_filters != (png_bytep)NULL)
          {
-            png_ptr->prev_filters[i] = 255;
+           /* To make sure that the weighting starts out fairly */
+           for (i = 0; i < num_weights; i++)
+           {
+              png_ptr->prev_filters[i] = 255;
+           }
          }
       }
 
@@ -1143,12 +1160,22 @@
 
          png_ptr->inv_filter_weights = (png_uint_16p)png_malloc(png_ptr,
             (png_uint_32)(sizeof(png_uint_16) * num_weights));
-
-         for (i = 0; i < num_weights; i++)
+         if (png_ptr->inv_filter_weights == (png_uint_16p)NULL)
          {
-            png_ptr->inv_filter_weights[i] =
-            png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
+            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++)
+           {
+              png_ptr->inv_filter_weights[i] =
+              png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
+           }
+         }
+         else
+            num_weights=0;
       }
 
       for (i = 0; i < num_weights; i++)
diff --git a/pngwtran.c b/pngwtran.c
index a77ede4..79437a6 100644
--- a/pngwtran.c
+++ b/pngwtran.c
@@ -1,7 +1,7 @@
 
 /* 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
  * Copyright (c) 1998-2001 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngwutil.c b/pngwutil.c
index 92bdec5..6889f27 100644
--- a/pngwutil.c
+++ b/pngwutil.c
@@ -1,7 +1,7 @@
 
 /* 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
  * Copyright (c) 1998-2001 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -235,21 +235,35 @@
                old_ptr = comp->output_ptr;
                comp->output_ptr = (png_charpp)png_malloc(png_ptr,
                   (png_uint_32)(comp->max_output_ptr * sizeof (png_charpp)));
-               png_memcpy(comp->output_ptr, old_ptr,
-           old_max * sizeof (png_charp));
+               if (comp->output_ptr == (png_charpp)NULL)
+               {
+                  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);
             }
             else
                comp->output_ptr = (png_charpp)png_malloc(png_ptr,
                   (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 */
          comp->output_ptr[comp->num_output_ptr] = (png_charp)png_malloc(png_ptr,
             (png_uint_32)png_ptr->zbuf_size);
-         png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf,
-            png_ptr->zbuf_size);
-         comp->num_output_ptr++;
+         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_ptr->zbuf_size);
+            comp->num_output_ptr++;
+         }
 
          /* and reset the buffer */
          png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
@@ -284,8 +298,9 @@
                   /* This could be optimized to realloc() */
                   comp->output_ptr = (png_charpp)png_malloc(png_ptr,
                      (png_uint_32)(comp->max_output_ptr * sizeof (png_charpp)));
-                  png_memcpy(comp->output_ptr, old_ptr,
-              old_max * sizeof (png_charp));
+                  if (comp->output_ptr != (png_charpp)NULL)
+                    png_memcpy(comp->output_ptr, old_ptr,
+                       old_max * sizeof (png_charp));
                   png_free(png_ptr, old_ptr);
                }
                else
@@ -296,9 +311,14 @@
             /* save off the data */
             comp->output_ptr[comp->num_output_ptr] =
                (png_charp)png_malloc(png_ptr, (png_uint_32)png_ptr->zbuf_size);
-            png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf,
-               png_ptr->zbuf_size);
-            comp->num_output_ptr++;
+            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_ptr->zbuf_size);
+               comp->num_output_ptr++;
+            }
 
             /* and reset the buffer pointers */
             png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
@@ -1109,6 +1129,12 @@
    png_debug1(2, "Keyword to be checked is '%s'\n", key);
 
    *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 */
    for (kp = key, dp = *new_key; *kp != '\0'; kp++, dp++)
@@ -1425,6 +1451,12 @@
    params_len = (png_uint_32p)png_malloc(png_ptr, (png_uint_32)(nparams
       *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
       null terminator for the last parameter. */
    for (i = 0; i < nparams; i++)
@@ -1608,6 +1640,8 @@
 
    /* set up row buffer */
    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;
 
    /* set up filtering buffer, if using this filter */
@@ -1615,6 +1649,8 @@
    {
       png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
          (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;
    }
 
@@ -1629,6 +1665,8 @@
       {
          png_ptr->up_row = (png_bytep )png_malloc(png_ptr,
             (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;
       }
 
@@ -1636,6 +1674,8 @@
       {
          png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
             (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;
       }
 
@@ -1643,6 +1683,8 @@
       {
          png_ptr->paeth_row = (png_bytep )png_malloc(png_ptr,
             (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;
       }
    }
diff --git a/projects/msvc/README.txt b/projects/msvc/README.txt
index aee9707..bfbfe90 100644
--- a/projects/msvc/README.txt
+++ b/projects/msvc/README.txt
@@ -1,5 +1,5 @@
 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
 For conditions of distribution and use, see copyright notice in png.h
diff --git a/projects/msvc/png32ms.def b/projects/msvc/png32ms.def
index 6ca6910..3202558 100644
--- a/projects/msvc/png32ms.def
+++ b/projects/msvc/png32ms.def
@@ -6,7 +6,7 @@
 DESCRIPTION "PNG image compression library for Windows"
 
 EXPORTS
-;Version 1.0.11beta2
+;Version 1.0.11beta3
   png_build_grayscale_palette  @1
   png_check_sig        @2
   png_chunk_error      @3
diff --git a/projects/wince/READMEE.WCE b/projects/wince/READMEE.WCE
index 7177d82..98b833d 100644
--- a/projects/wince/READMEE.WCE
+++ b/projects/wince/READMEE.WCE
@@ -8,9 +8,9 @@
 
 Introduction
 ============
-This is libpng 1.0.11beta2 ported to WindowsCE 2.0 and 2.11.
-libpng 1.0.11beta2 is a PNG reference library.
-See README, a document of original libpng 1.0.11beta2.
+This is libpng 1.0.11beta3 ported to WindowsCE 2.0 and 2.11.
+libpng 1.0.11beta3 is a PNG reference library.
+See README, a document of original libpng 1.0.11beta3.
 
 zlib for WindowsCE
 ==================
@@ -23,7 +23,7 @@
 warranty.  In no event will the authors be held liable for any damages
 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.
 
 Files
diff --git a/projects/wince/READMEJ.WCE b/projects/wince/READMEJ.WCE
index af88d00..83f295b 100644
--- a/projects/wince/READMEJ.WCE
+++ b/projects/wince/READMEJ.WCE
@@ -24,7 +24,7 @@
 ‚É‚È‚Á‚½‚¢‚©‚È‚é”íŠQ‚ɂ‚¢‚Ä‚àAìŽÒA”z•zŽÒA‚»‚Ì‘¼—˜—pŽÒˆÈŠO‚̐l•¨A
 ’c‘̂ɐӔC‚ð‚Æ‚é‹`–±‚Í‚È‚¢‚à‚Ì‚Æ‚µ‚Ü‚·B
 
-‚»‚Ì‘¼A‚±‚̃\ƒtƒgƒEƒFƒA‚Ì—˜—pðŒ‚ɂ‚¢‚ẮAŒ´”Å‚Å‚ ‚é libpng 1.0.11beta2‚É
+‚»‚Ì‘¼A‚±‚̃\ƒtƒgƒEƒFƒA‚Ì—˜—pðŒ‚ɂ‚¢‚ẮAŒ´”Å‚Å‚ ‚é libpng 1.0.11beta3‚É
 €‹’‚·‚é‚à‚Ì‚Æ‚µ‚Ü‚·BÚ‚µ‚­‚́A•t‘®‚Ì README,LICENSE ‚ð‚¨“Ç‚Ý‚­‚¾‚³‚¢B
 
 Žû˜^“à—e
diff --git a/projects/wince/png32ce.def b/projects/wince/png32ce.def
index f24ea42..9eff133 100644
--- a/projects/wince/png32ce.def
+++ b/projects/wince/png32ce.def
@@ -5,7 +5,7 @@
 LIBRARY lpngce
 
 EXPORTS
-;Version 1.0.11beta2
+;Version 1.0.11beta3
   png_build_grayscale_palette  @1
   png_check_sig        @2
   png_chunk_error      @3
diff --git a/scripts/makefile.aix b/scripts/makefile.aix
index fa7814f..aa5e51a 100644
--- a/scripts/makefile.aix
+++ b/scripts/makefile.aix
@@ -18,7 +18,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.11beta2
+PNGMIN = 1.0.11beta3
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 prefix=/usr/local
diff --git a/scripts/makefile.beos b/scripts/makefile.beos
index 39ee92c..a76361d 100644
--- a/scripts/makefile.beos
+++ b/scripts/makefile.beos
@@ -13,7 +13,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.11beta2
+PNGMIN = 1.0.11beta3
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 ALIGN=
diff --git a/scripts/makefile.cygwin b/scripts/makefile.cygwin
index f1c08d9..96fda02 100644
--- a/scripts/makefile.cygwin
+++ b/scripts/makefile.cygwin
@@ -39,8 +39,8 @@
 # have to change it.
 PNGMAJ = 2
 #PNGDLL = $1# msvc
-PNGDLL = 2# cygwin 1.0.11beta2
-PNGMIN = 1.0.11beta2
+PNGDLL = 2# cygwin 1.0.11beta3
+PNGMIN = 1.0.11beta3
 PNGMIN_BASE = 1.0.11
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
diff --git a/scripts/makefile.dec b/scripts/makefile.dec
index 3a31ebf..94e5500 100644
--- a/scripts/makefile.dec
+++ b/scripts/makefile.dec
@@ -17,7 +17,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.11beta2
+PNGMIN = 1.0.11beta3
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 CC=cc
diff --git a/scripts/makefile.gcmmx b/scripts/makefile.gcmmx
index 4c19397..73aaaaa 100644
--- a/scripts/makefile.gcmmx
+++ b/scripts/makefile.gcmmx
@@ -51,7 +51,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.11beta2
+PNGMIN = 1.0.11beta3
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
diff --git a/scripts/makefile.hpgcc b/scripts/makefile.hpgcc
index 00c0b18..a3d01cf 100644
--- a/scripts/makefile.hpgcc
+++ b/scripts/makefile.hpgcc
@@ -34,7 +34,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.11beta2
+PNGMIN = 1.0.11beta3
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
diff --git a/scripts/makefile.hpux b/scripts/makefile.hpux
index 88263d0..235d3e9 100644
--- a/scripts/makefile.hpux
+++ b/scripts/makefile.hpux
@@ -19,7 +19,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.11beta2
+PNGMIN = 1.0.11beta3
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 # where make install puts libpng.a and png.h
diff --git a/scripts/makefile.linux b/scripts/makefile.linux
index 467ccbe..d138290 100644
--- a/scripts/makefile.linux
+++ b/scripts/makefile.linux
@@ -34,7 +34,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.11beta2
+PNGMIN = 1.0.11beta3
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
diff --git a/scripts/makefile.sco b/scripts/makefile.sco
index d016a9d..ffa24da 100644
--- a/scripts/makefile.sco
+++ b/scripts/makefile.sco
@@ -25,7 +25,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.11beta2
+PNGMIN = 1.0.11beta3
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
diff --git a/scripts/makefile.sggcc b/scripts/makefile.sggcc
index d497f7a..9256fab 100644
--- a/scripts/makefile.sggcc
+++ b/scripts/makefile.sggcc
@@ -19,8 +19,8 @@
 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
 LDSHARED=gcc -shared
 
-VER=1.0.11beta2
-LIBS=libpng.so.1.0.11beta2
+VER=1.0.11beta3
+LIBS=libpng.so.1.0.11beta3
 SHAREDLIB=libpng.so
 libdir=$(prefix)/lib32
 
diff --git a/scripts/makefile.sgi b/scripts/makefile.sgi
index 7e1cbbd..82a31c4 100644
--- a/scripts/makefile.sgi
+++ b/scripts/makefile.sgi
@@ -25,7 +25,7 @@
 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
 LDSHARED=cc -shared
 
-VER=1.0.11beta2
+VER=1.0.11beta3
 SONUM=2
 SHAREDLIB=libpng.so
 libdir=$(prefix)
diff --git a/scripts/makefile.solaris b/scripts/makefile.solaris
index 6d58b79..f03041c 100644
--- a/scripts/makefile.solaris
+++ b/scripts/makefile.solaris
@@ -31,7 +31,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 2.  You should not
 # have to change it.
 PNGMAJ = 2
-PNGMIN = 1.0.11beta2
+PNGMIN = 1.0.11beta3
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
diff --git a/scripts/pngdef.pas b/scripts/pngdef.pas
index aa499c1..11c4c92 100644
--- a/scripts/pngdef.pas
+++ b/scripts/pngdef.pas
@@ -7,7 +7,7 @@
 interface
 
 const
-  PNG_LIBPNG_VER_STRING = '1.0.11beta2';
+  PNG_LIBPNG_VER_STRING = '1.0.11beta3';
   PNG_LIBPNG_VER        =  10011;
 
 type
diff --git a/scripts/pngos2.def b/scripts/pngos2.def
index 407345f..6d7a299 100644
--- a/scripts/pngos2.def
+++ b/scripts/pngos2.def
@@ -2,7 +2,7 @@
 ; PNG.LIB module definition file for OS/2
 ;----------------------------------------
 
-; Version 1.0.11beta2
+; Version 1.0.11beta3
 
 LIBRARY		PNG
 DESCRIPTION	"PNG image compression library for OS/2"