[libpng15] Imported from libpng-1.5.27beta01.tar
diff --git a/ANNOUNCE b/ANNOUNCE
index 10dfd4a..85058c4 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,5 +1,5 @@
 
-Libpng 1.5.27beta01 - February 14, 2016
+Libpng 1.5.27beta01 - March 9, 2016
 
 This is not intended to be a public release.  It will be replaced
 within a few weeks by a public version or by another test version.
@@ -26,7 +26,7 @@
 
 Changes since the last public release (1.5.26):
 
-version 1.5.27beta01 [February 14, 2016]
+version 1.5.27beta01 [March 9, 2016]
   Removed LE/BE dependencies in pngvalid, to 'fix' the current problem
     in the BigEndian tests by not testing it, making the BE code the same 
     as the LE version.
@@ -52,7 +52,8 @@
   Added a common-law trademark notice and export control information
     to the LICENSE file, png.h, and the man page.
   Changed PNG_INFO_cHNK and PNG_FREE_cHNK from 0xnnnn to 0xnnnnU in png.h
-   (Robert C. Seacord).
+    (Robert C. Seacord).
+  Fixed some misleading indentation in pngvalid.c (Krishnaraj Bhat).
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
diff --git a/CHANGES b/CHANGES
index f7906be..275faa5 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4256,7 +4256,8 @@
 Version 1.5.20beta01 [November 6, 2014]
   Removed "option WRITE_COMPRESSED_TEXT enables WRITE_TEXT" from pnglibconf.dfa
   Only mark text chunks as written after successfully writing them.
-  Avoid out-of-bounds memory access in png_user_version_check().
+  Fixed an out-of-range read in png_user_version_check() (Bug report from
+    Qixue Xiao, CVE-2015-8540).
   Simplified and future-proofed png_user_version_check().
 
 Version 1.5.20beta02 [November 10, 2014]
@@ -4454,7 +4455,7 @@
 version 1.5.26 [December 17, 2015]
   No changes.
 
-version 1.5.27beta01 [February 14, 2016]
+version 1.5.27beta01 [March 9, 2016]
   Removed LE/BE dependencies in pngvalid, to 'fix' the current problem
     in the BigEndian tests by not testing it, making the BE code the same 
     as the LE version.
@@ -4480,7 +4481,8 @@
   Added a common-law trademark notice and export control information
     to the LICENSE file, png.h, and the man page.
   Changed PNG_INFO_cHNK and PNG_FREE_cHNK from 0xnnnn to 0xnnnnU in png.h
-   (Robert C. Seacord).
+    (Robert C. Seacord).
+  Fixed some misleading indentation in pngvalid.c (Krishnaraj Bhat).
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
diff --git a/LICENSE b/LICENSE
index 3a5ed5d..2cd4b3a 100644
--- a/LICENSE
+++ b/LICENSE
@@ -10,8 +10,8 @@
 
 This code is released under the libpng license.
 
-libpng versions 1.0.7, July 1, 2000, through 1.5.27beta01, December 18, 2015, are
-Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, are
+libpng versions 1.0.7, July 1, 2000, through 1.5.27beta01, March 9, 2016, are
+Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are
 derived from 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:
@@ -94,18 +94,29 @@
 
 END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
 
-A "png_get_copyright" function is available, for convenient use in "about"
-boxes and the like:
+TRADEMARK:
 
-   printf("%s", png_get_copyright(NULL));
+The name "libpng" has not been registered by the Copyright owner
+as a trademark in any jurisdiction.  However, because libpng has
+been distributed and maintained world-wide, continually since 1995,
+the Copyright owner claims "common-law trademark protection" in any
+jurisdiction where common-law trademark is recognized.
 
-Also, the PNG logo (in PNG format, of course) is supplied in the
-files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
+OSI CERTIFICATION:
 
 Libpng is OSI Certified Open Source Software.  OSI Certified Open Source is
 a certification mark of the Open Source Initiative. OSI has not addressed
 the additional disclaimers inserted at version 1.0.7.
 
+EXPORT CONTROL:
+
+The Copyright owner believes that the Export Control Classification
+Number (ECCN) for libpng is EAR99, which means not subject to export
+controls or International Traffic in Arms Regulations (ITAR) because
+it is open source, publicly available software, that does not contain
+any encryption software.  See the EAR, paragraphs 734.3(b)(3) and
+734.7(b).
+
 Glenn Randers-Pehrson
 glennrp at users.sourceforge.net
-December 18, 2015
+March 9, 2016
diff --git a/README b/README
index 40b0c97..7a6884b 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-README for libpng version 1.5.27beta01 - December 18, 2015 (shared library 15.0)
+README for libpng version 1.5.27beta01 - March 9, 2016 (shared library 15.0)
 See the note about version numbers near the top of png.h
 
 See INSTALL for instructions on how to install libpng.
diff --git a/contrib/libtests/pngvalid.c b/contrib/libtests/pngvalid.c
index c82c269..fa25e39 100644
--- a/contrib/libtests/pngvalid.c
+++ b/contrib/libtests/pngvalid.c
@@ -3307,10 +3307,10 @@
       for (; i<256; ++i)
          tRNS[i] = 24;
 
-#     ifdef PNG_WRITE_tRNS_SUPPORTED
-         if (j > 0)
-            png_set_tRNS(pp, pi, tRNS, j, 0/*color*/);
-#     endif
+#ifdef PNG_WRITE_tRNS_SUPPORTED
+      if (j > 0)
+         png_set_tRNS(pp, pi, tRNS, j, 0/*color*/);
+#endif
    }
 }
 
@@ -7937,11 +7937,11 @@
    else
       back.gray = (png_uint_16)data.red;
 
-#  ifdef PNG_FLOATING_POINT_SUPPORTED
-      png_set_background(pp, &back, PNG_BACKGROUND_GAMMA_FILE, expand, 0);
-#  else
-      png_set_background_fixed(pp, &back, PNG_BACKGROUND_GAMMA_FILE, expand, 0);
-#  endif
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+   png_set_background(pp, &back, PNG_BACKGROUND_GAMMA_FILE, expand, 0);
+#else
+   png_set_background_fixed(pp, &back, PNG_BACKGROUND_GAMMA_FILE, expand, 0);
+#endif
 
    this->next->set(this->next, that, pp, pi);
 }
diff --git a/libpng-manual.txt b/libpng-manual.txt
index f9115e7..9cde42a 100644
--- a/libpng-manual.txt
+++ b/libpng-manual.txt
@@ -1,6 +1,6 @@
 Libpng-manual.txt - A description on how to use and modify libpng
 
- libpng version 1.5.27beta01 - January 2, 2016
+ libpng version 1.5.27beta01 - March 9, 2016
  Updated and distributed by Glenn Randers-Pehrson
  <glennrp at users.sourceforge.net>
  Copyright (c) 1998-2014 Glenn Randers-Pehrson
@@ -11,7 +11,7 @@
 
  Based on:
 
- libpng versions 0.97, January 1998, through 1.5.27beta01 - January 2, 2016
+ libpng versions 0.97, January 1998, through 1.5.27beta01 - March 9, 2016
  Updated and distributed by Glenn Randers-Pehrson
  Copyright (c) 1998-2014 Glenn Randers-Pehrson
 
@@ -4127,7 +4127,8 @@
 the 1.4.5 API and the 1.5.0 API; however, the ability to directly access
 members of the main libpng control structures, png_struct and png_info,
 deprecated in earlier versions of libpng, has been completely removed from
-libpng 1.5.
+libpng 1.5, and new private "pngstruct.h", "pnginfo.h", and "pngdebug.h"
+header files were created.
 
 We no longer include zlib.h in png.h.  The include statement has been moved
 to pngstruct.h, where it is not accessible by applications. Applications that
diff --git a/libpng.3 b/libpng.3
index c451860..b87ed58 100644
--- a/libpng.3
+++ b/libpng.3
@@ -1,4 +1,4 @@
-.TH LIBPNG 3 "January 2, 2016"
+.TH LIBPNG 3 "March 9, 2016"
 .SH NAME
 libpng \- Portable Network Graphics (PNG) Reference Library 1.5.27beta01
 .SH SYNOPSIS
@@ -496,7 +496,7 @@
 .SH LIBPNG.TXT
 Libpng-manual.txt - A description on how to use and modify libpng
 
- libpng version 1.5.27beta01 - January 2, 2016
+ libpng version 1.5.27beta01 - March 9, 2016
  Updated and distributed by Glenn Randers-Pehrson
  <glennrp at users.sourceforge.net>
  Copyright (c) 1998-2014 Glenn Randers-Pehrson
@@ -507,7 +507,7 @@
 
  Based on:
 
- libpng versions 0.97, January 1998, through 1.5.27beta01 - January 2, 2016
+ libpng versions 0.97, January 1998, through 1.5.27beta01 - March 9, 2016
  Updated and distributed by Glenn Randers-Pehrson
  Copyright (c) 1998-2014 Glenn Randers-Pehrson
 
@@ -4623,7 +4623,8 @@
 the 1.4.5 API and the 1.5.0 API; however, the ability to directly access
 members of the main libpng control structures, png_struct and png_info,
 deprecated in earlier versions of libpng, has been completely removed from
-libpng 1.5.
+libpng 1.5, and new private "pngstruct.h", "pnginfo.h", and "pngdebug.h"
+header files were created.
 
 We no longer include zlib.h in png.h.  The include statement has been moved
 to pngstruct.h, where it is not accessible by applications. Applications that
@@ -5108,9 +5109,9 @@
  ...
  1.0.19                  10    10019  10.so.0.19[.0]
  ...
- 1.2.53                  13    10253  12.so.0.53[.0]
+ 1.2.56                  13    10256  12.so.0.56[.0]
  ...
- 1.5.25                  15    10525  15.so.15.25[.0]
+ 1.5.27                  15    10527  15.so.15.27[.0]
 
 Henceforth the source version will match the shared-library minor
 and patch numbers; the shared-library major version number will be
@@ -5166,7 +5167,7 @@
 
 Thanks to Frank J. T. Wojcik for helping with the documentation.
 
-Libpng version 1.5.27beta01 - January 2, 2016:
+Libpng version 1.5.27beta01 - March 9, 2016:
 Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
 Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
 
@@ -5191,7 +5192,7 @@
 
 This code is released under the libpng license.
 
-libpng versions 1.0.7, July 1, 2000, through 1.5.27beta01, January 2, 2016, are
+libpng versions 1.0.7, July 1, 2000, through 1.5.27beta01, March 9, 2016, are
 Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are
 derived from libpng-1.0.6, and are distributed according to the same
 disclaimer and license as libpng-1.0.6 with the following individuals
@@ -5275,6 +5276,29 @@
 
 END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
 
+TRADEMARK:
+
+The name "libpng" has not been registered by the Copyright owner
+as a trademark in any jurisdiction.  However, because libpng has
+been distributed and maintained world-wide, continually since 1995,
+the Copyright owner claims "common-law trademark protection" in any
+jurisdiction where common-law trademark is recognized.
+
+OSI CERTIFICATION:
+
+Libpng is OSI Certified Open Source Software.  OSI Certified Open Source is
+a certification mark of the Open Source Initiative. OSI has not addressed
+the additional disclaimers inserted at version 1.0.7.
+
+EXPORT CONTROL:
+
+The Copyright owner believes that the Export Control Classification
+Number (ECCN) for libpng is EAR99, which means not subject to export
+controls or International Traffic in Arms Regulations (ITAR) because
+it is open source, publicly available software, that does not contain
+any encryption software.  See the EAR, paragraphs 734.3(b)(3) and
+734.7(b).
+
 A "png_get_copyright" function is available, for convenient use in "about"
 boxes and the like:
 
@@ -5283,13 +5307,9 @@
 Also, the PNG logo (in PNG format, of course) is supplied in the
 files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
 
-Libpng is OSI Certified Open Source Software.  OSI Certified Open Source is
-a certification mark of the Open Source Initiative. OSI has not addressed
-the additional disclaimers inserted at version 1.0.7.
-
 Glenn Randers-Pehrson
 glennrp at users.sourceforge.net
-January 2, 2016
+March 9, 2016
 
 .\" end of man page
 
diff --git a/libpngpf.3 b/libpngpf.3
index 73fdcd9..44f4367 100644
--- a/libpngpf.3
+++ b/libpngpf.3
@@ -1,4 +1,4 @@
-.TH LIBPNGPF 3 "December 18, 2015"
+.TH LIBPNGPF 3 "March 9, 2016"
 .SH NAME
 libpng \- Portable Network Graphics (PNG) Reference Library 1.5.27beta01
 (private functions)
diff --git a/png.5 b/png.5
index a64034b..e9d82c2 100644
--- a/png.5
+++ b/png.5
@@ -1,4 +1,4 @@
-.TH PNG 5 "December 18, 2015"
+.TH PNG 5 "March 9, 2016"
 .SH NAME
 png \- Portable Network Graphics (PNG) format
 .SH DESCRIPTION
diff --git a/png.c b/png.c
index 374d3b4..f7ce8b2 100644
--- a/png.c
+++ b/png.c
@@ -655,14 +655,14 @@
 #else
 #  ifdef __STDC__
    return PNG_STRING_NEWLINE \
-     "libpng version 1.5.27beta01 - January 2, 2016" PNG_STRING_NEWLINE \
+     "libpng version 1.5.27beta01 - March 9, 2016" PNG_STRING_NEWLINE \
      "Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson" \
      PNG_STRING_NEWLINE \
      "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
      "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
      PNG_STRING_NEWLINE;
 #  else
-      return "libpng version 1.5.27beta01 - January 2, 2016\
+      return "libpng version 1.5.27beta01 - March 9, 2016\
       Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson\
       Copyright (c) 1996-1997 Andreas Dilger\
       Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
diff --git a/png.h b/png.h
index 4276d70..2c7812a 100644
--- a/png.h
+++ b/png.h
@@ -1,7 +1,7 @@
 
 /* png.h - header file for PNG reference library
  *
- * libpng version 1.5.27beta01, February 14, 2016
+ * libpng version 1.5.27beta01, March 9, 2016
  *
  * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -12,7 +12,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.5.27beta01, February 14, 2016:
+ *   libpng versions 0.97, January 1998, through 1.5.27beta01, March 9, 2016:
  *     Glenn Randers-Pehrson.
  *   See also "Contributing Authors", below.
  */
@@ -25,7 +25,7 @@
  *
  * This code is released under the libpng license.
  *
- * libpng versions 1.0.7, July 1, 2000, through 1.5.27beta01, February 14, 2016, are
+ * libpng versions 1.0.7, July 1, 2000, through 1.5.27beta01, March 9, 2016, are
  * Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are
  * derived from libpng-1.0.6, and are distributed according to the same
  * disclaimer and license as libpng-1.0.6 with the following individuals
@@ -228,7 +228,7 @@
  * Y2K compliance in libpng:
  * =========================
  *
- *    February 14, 2016
+ *    March 9, 2016
  *
  *    Since the PNG Development group is an ad-hoc body, we can't make
  *    an official declaration.
@@ -297,7 +297,7 @@
 /* Version information for png.h - this should match the version in png.c */
 #define PNG_LIBPNG_VER_STRING "1.5.27beta01"
 #define PNG_HEADER_VERSION_STRING \
-     " libpng version 1.5.27beta01 - February 14, 2016\n"
+     " libpng version 1.5.27beta01 - March 9, 2016\n"
 
 #define PNG_LIBPNG_VER_SONUM   15
 #define PNG_LIBPNG_VER_DLLNUM  15
diff --git a/pngconf.h b/pngconf.h
index c91e4f1..be400e1 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1,7 +1,7 @@
 
 /* pngconf.h - machine configurable file for libpng
  *
- * libpng version 1.5.27beta01, December 18, 2015
+ * libpng version 1.5.27beta01, March 9, 2016
  *
  * Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/projects/vstudio/README.txt b/projects/vstudio/README.txt
index 08bacbb..df5dd1a 100644
--- a/projects/vstudio/README.txt
+++ b/projects/vstudio/README.txt
@@ -1,7 +1,7 @@
 
 VisualStudio instructions
 
-libpng version 1.5.27beta01 - December 29, 2015
+libpng version 1.5.27beta01 - March 9, 2016
 
 Copyright (c) 2010,2013,2016 Glenn Randers-Pehrson
 
diff --git a/projects/vstudio/zlib.props b/projects/vstudio/zlib.props
index 0230100..7966ab4 100644
--- a/projects/vstudio/zlib.props
+++ b/projects/vstudio/zlib.props
@@ -2,7 +2,7 @@
 <!--
  * zlib.props - location of zlib source
  *
- * libpng version 1.5.27beta01 - December 18, 2015
+ * libpng version 1.5.27beta01 - March 9, 2016
  *
  * Copyright (c) 1998-2011 Glenn Randers-Pehrson
  *
diff --git a/scripts/README.txt b/scripts/README.txt
index 5242ac9..d04e11c 100644
--- a/scripts/README.txt
+++ b/scripts/README.txt
@@ -1,5 +1,5 @@
 
-Makefiles for  libpng version 1.5.27beta01 - December 18, 2015
+Makefiles for  libpng version 1.5.27beta01 - March 9, 2016
 
 pnglibconf.h.prebuilt       =>  Stores configuration settings
  makefile.linux    =>  Linux/ELF makefile
diff --git a/scripts/options.awk b/scripts/options.awk
index c3a8501..a1850f9 100755
--- a/scripts/options.awk
+++ b/scripts/options.awk
@@ -3,7 +3,7 @@
 #
 # last changed in libpng version 1.5.7 - December 15, 2011
 #
-# Copyright (c) 1998-2011 Glenn Randers-Pehrson
+# Copyright (c) 2011 Glenn Randers-Pehrson
 #
 # This code is released under the libpng license.
 # For conditions of distribution and use, see the disclaimer
diff --git a/scripts/pnglibconf.dfa b/scripts/pnglibconf.dfa
index 9f28a28..96c7905 100644
--- a/scripts/pnglibconf.dfa
+++ b/scripts/pnglibconf.dfa
@@ -8,7 +8,7 @@
 com
 version
 com
-com Copyright (c) 1998-2011 Glenn Randers-Pehrson
+com Copyright (c) 2011-2015 Glenn Randers-Pehrson
 com
 com This code is released under the libpng license.
 com For conditions of distribution and use, see the disclaimer
diff --git a/scripts/pnglibconf.h.prebuilt b/scripts/pnglibconf.h.prebuilt
index 162dadf..35b0f34 100644
--- a/scripts/pnglibconf.h.prebuilt
+++ b/scripts/pnglibconf.h.prebuilt
@@ -1,9 +1,9 @@
 /* 1.5.27beta01 STANDARD API DEFINITION */
 /* pnglibconf.h - library build configuration */
 
-/* libpng version 1.5.27beta01 - December 18, 2015 */
+/* libpng version 1.5.27beta01 - March 9, 2016 */
 
-/* Copyright (c) 1998-2015 Glenn Randers-Pehrson */
+/* Copyright (c) 2011-2015 Glenn Randers-Pehrson */
 
 /* This code is released under the libpng license. */
 /* For conditions of distribution and use, see the disclaimer */