[libpng17] Imported from libpng-1.7.0beta36.tar
diff --git a/ANNOUNCE b/ANNOUNCE
index 421f0ea..14a4c53 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,5 +1,5 @@
 
-Libpng 1.7.0beta36 - August 8, 2014
+Libpng 1.7.0beta36 - September 27, 2014
 
 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.
@@ -592,11 +592,12 @@
     definitions from pngconf.h.
   Ensure that CMakeLists.txt makes the target "lib" directory before making
     symbolic link into it (SourceForge bug report #226 by Rolf Timmermans).
+  Added opinion that the ECCN (Export Control Classification Number) for
     libpng is EAR99 to the README file.
-
-Version 1.7.0beta36 [August 8, 2014]
   Updated scripts/makefiles from libpng-1.6.13beta04.
 
+Version 1.7.0beta36 [September 27, 2014]
+
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
 https://lists.sourceforge.net/lists/listinfo/png-mng-implement
diff --git a/CHANGES b/CHANGES
index f2e4d6b..b8816cd 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4884,7 +4884,7 @@
   Added opinion that the ECCN (Export Control Classification Number) for
     libpng is EAR99 to the README file.
 
-Version 1.7.0beta36 [August 6, 2014]
+Version 1.7.0beta36 [September 27, 2014]
   Updated scripts/makefiles from libpng-1.6.13beta04.
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
diff --git a/LICENSE b/LICENSE
index e316578..5b17e79 100644
--- a/LICENSE
+++ b/LICENSE
@@ -10,7 +10,7 @@
 
 This code is released under the libpng license.
 
-libpng versions 1.2.6, August 15, 2004, through 1.7.0beta36, August 6, 2014, are
+libpng versions 1.2.6, August 15, 2004, through 1.7.0beta36, September 27, 2014, are
 Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
 distributed according to the same disclaimer and license as libpng-1.2.5
 with the following individual added to the list of Contributing Authors
@@ -108,4 +108,4 @@
 
 Glenn Randers-Pehrson
 glennrp at users.sourceforge.net
-August 6, 2014
+September 27, 2014
diff --git a/README b/README
index 913550e..b1a82bc 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-README for libpng version 1.7.0beta36 - August 6, 2014 (shared library 17.0)
+README for libpng version 1.7.0beta36 - September 27, 2014 (shared library 17.0)
 See the note about version numbers near the top of png.h
 
 See INSTALL for instructions on how to install libpng.
@@ -87,6 +87,12 @@
 [DOWNLOAD] area, and at ftp://ftp.simplesystems.org.  If you can't find it
 in any of those places, e-mail me, and I'll help you find it.
 
+I am not a lawyer, but I believe 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).
+
 If you have any code changes, requests, problems, etc., please e-mail
 them to me.  Also, I'd appreciate any make files or project files,
 and any modifications you needed to make to get libpng to compile,
diff --git a/contrib/conftest/README b/contrib/conftest/README
index 0a595e3..0f47279 100644
--- a/contrib/conftest/README
+++ b/contrib/conftest/README
@@ -16,6 +16,9 @@
 You can use these .dfa files as the basis of new configurations.  Files in this
 directory should not have any use restrictions or restrictive licenses.
 
+This directory is not included in the .zip and .7z distributions, which do
+not contain 'configure' scripts.
+
 DOCUMENTATION
 =============
 
diff --git a/contrib/gregbook/readpng2.c b/contrib/gregbook/readpng2.c
index e6a132e..2e4c536 100644
--- a/contrib/gregbook/readpng2.c
+++ b/contrib/gregbook/readpng2.c
@@ -448,6 +448,8 @@
 
     /* all done */
 
+    (void)info_ptr; /* Unused */
+
     return;
 }
 
@@ -472,6 +474,7 @@
 {
     fprintf(stderr, "readpng2 libpng warning: %s\n", msg);
     fflush(stderr);
+    (void)png_ptr; /* Unused */
 }
 
 
diff --git a/contrib/gregbook/readppm.c b/contrib/gregbook/readppm.c
index be9a56d..7fefc39 100644
--- a/contrib/gregbook/readppm.c
+++ b/contrib/gregbook/readppm.c
@@ -163,8 +163,12 @@
 
     /* now we can go ahead and just read the whole image */
 
-    fread(image_data, 1L, rowbytes*height, saved_infile);
-
+    if (fread(image_data, 1L, rowbytes*height, saved_infile) <
+       rowbytes*height) {
+        free (image_data);
+        image_data = NULL;
+        return NULL;
+    }
 
     return image_data;
 }
diff --git a/contrib/libtests/pngvalid.c b/contrib/libtests/pngvalid.c
index 592ae73..c469259 100644
--- a/contrib/libtests/pngvalid.c
+++ b/contrib/libtests/pngvalid.c
@@ -30,10 +30,6 @@
 #  include <config.h>
 #endif
 
-#ifdef HAVE_FEENABLEEXCEPT /* from config.h, if included */
-#  include <fenv.h>
-#endif
-
 /* Define the following to use this test against your installed libpng, rather
  * than the one being built here:
  */
@@ -43,6 +39,13 @@
 #  include "../../png.h"
 #endif
 
+#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
+# ifdef HAVE_FEENABLEEXCEPT /* from config.h, if included */
+#   include <fenv.h>
+# endif
+#endif
+
+
 #ifdef PNG_ZLIB_HEADER
 #  include PNG_ZLIB_HEADER
 #else
@@ -9962,9 +9965,11 @@
          pos = safecat(msg, sizeof msg, pos, "abort");
          break;
 
+#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
       case SIGFPE:
          pos = safecat(msg, sizeof msg, pos, "floating point exception");
          break;
+#endif
 
       case SIGILL:
          pos = safecat(msg, sizeof msg, pos, "illegal instruction");
@@ -10030,18 +10035,21 @@
 
    /* Add appropriate signal handlers, just the ANSI specified ones: */
    signal(SIGABRT, signal_handler);
-   signal(SIGFPE, signal_handler);
    signal(SIGILL, signal_handler);
    signal(SIGINT, signal_handler);
    signal(SIGSEGV, signal_handler);
    signal(SIGTERM, signal_handler);
 
-#ifdef HAVE_FEENABLEEXCEPT
+#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
+   signal(SIGFPE, signal_handler);
+
+# ifdef HAVE_FEENABLEEXCEPT
    /* Only required to enable FP exceptions on platforms where they start off
     * disabled; this is not necessary but if it is not done pngvalid will likely
     * end up ignoring FP conditions that other platforms fault.
     */
    feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
+# endif
 #endif
 
    modifier_init(&pm);
diff --git a/libpngpf.3 b/libpngpf.3
index bcc11d8..9329dd0 100644
--- a/libpngpf.3
+++ b/libpngpf.3
@@ -1,4 +1,4 @@
-.TH LIBPNGPF 3 "August 6, 2014"
+.TH LIBPNGPF 3 "September 27, 2014"
 .SH NAME
 libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0beta36
 (private functions)
diff --git a/png.5 b/png.5
index f6c3794..358684f 100644
--- a/png.5
+++ b/png.5
@@ -1,4 +1,4 @@
-.TH PNG 5 "August 6, 2014"
+.TH PNG 5 "September 27, 2014"
 .SH NAME
 png \- Portable Network Graphics (PNG) format
 .SH DESCRIPTION
diff --git a/png.c b/png.c
index ef18fd1..74afe01 100644
--- a/png.c
+++ b/png.c
@@ -696,13 +696,13 @@
 #else
 #  ifdef __STDC__
    return PNG_STRING_NEWLINE \
-     "libpng version 1.7.0beta36 - August 6, 2014" PNG_STRING_NEWLINE \
+     "libpng version 1.7.0beta36 - September 27, 2014" PNG_STRING_NEWLINE \
      "Copyright (c) 1998-2014 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.7.0beta36 - August 6, 2014\
+      return "libpng version 1.7.0beta36 - September 27, 2014\
       Copyright (c) 1998-2014 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 455a2b1..5de9888 100644
--- a/png.h
+++ b/png.h
@@ -1,7 +1,7 @@
 
 /* png.h - header file for PNG reference library
  *
- * libpng version 1.7.0beta36 - August 6, 2014
+ * libpng version 1.7.0beta36 - September 27, 2014
  * Copyright (c) 1998-2013 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.)
@@ -11,7 +11,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.7.0beta36 - August 6, 2014: Glenn
+ *   libpng versions 0.97, January 1998, through 1.7.0beta36 - September 27, 2014: Glenn
  *   See also "Contributing Authors", below.
  *
  * Note about libpng version numbers:
@@ -200,7 +200,7 @@
  *
  * This code is released under the libpng license.
  *
- * libpng versions 1.2.6, August 15, 2004, through 1.7.0beta36, August 6, 2014, are
+ * libpng versions 1.2.6, August 15, 2004, through 1.7.0beta36, September 27, 2014, are
  * Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are
  * distributed according to the same disclaimer and license as libpng-1.2.5
  * with the following individual added to the list of Contributing Authors:
@@ -312,7 +312,7 @@
  * Y2K compliance in libpng:
  * =========================
  *
- *    August 6, 2014
+ *    September 27, 2014
  *
  *    Since the PNG Development group is an ad-hoc body, we can't make
  *    an official declaration.
@@ -382,7 +382,7 @@
 /* Version information for png.h - this should match the version in png.c */
 #define PNG_LIBPNG_VER_STRING "1.7.0beta36"
 #define PNG_HEADER_VERSION_STRING \
-     " libpng version 1.7.0beta36 - August 6, 2014\n"
+     " libpng version 1.7.0beta36 - September 27, 2014\n"
 
 #define PNG_LIBPNG_VER_SONUM   17
 #define PNG_LIBPNG_VER_DLLNUM  17
diff --git a/pngconf.h b/pngconf.h
index cf6907b..fa924b0 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1,7 +1,7 @@
 
 /* pngconf.h - machine configurable file for libpng
  *
- * libpng version 1.7.0beta36 - August 6, 2014
+ * libpng version 1.7.0beta36 - September 27, 2014
  *
  * Copyright (c) 1998-2013 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngread.c b/pngread.c
index b2c323b..bc80bc2 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1,7 +1,7 @@
 
 /* pngread.c - read a PNG file
  *
- * Last changed in libpng 1.6.11 [June 5, 2014]
+ * Last changed in libpng 1.7.0 [(PENDING RELEASE)]
  * Copyright (c) 1998-2014 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.)
diff --git a/pngtest.c b/pngtest.c
index b92943a..1d041dd 100644
--- a/pngtest.c
+++ b/pngtest.c
@@ -1,7 +1,7 @@
 
 /* pngtest.c - a simple test program to test libpng
  *
- * Last changed in libpng 1.6.11 [(PENDING RELEASE)]
+ * Last changed in libpng 1.6.11 [June 5, 2014]
  * Copyright (c) 1998-2014 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.)
diff --git a/pngtrans.c b/pngtrans.c
index 22499e4..9b6c3d0 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)
  *
- * Last changed in libpng 1.6.11 [(PENDING RELEASE)]
+ * Last changed in libpng 1.6.11 [June 5, 2014]
  * Copyright (c) 1998-2014 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.)
@@ -327,9 +327,16 @@
 
       for (i = 0; i < istop; i++, rp += 2)
       {
+#ifdef PNG_BUILTIN_BSWAP16_SUPPORTED
+         /* Feature added to libpng-1.6.11 for testing purposes, not
+          * enabled by default.
+          */
+         *(png_uint_16*)rp = __builtin_bswap16(*(png_uint_16*)rp);
+#else
          png_byte t = *rp;
          *rp = *(rp + 1);
          *(rp + 1) = t;
+#endif
       }
    }
 }
diff --git a/projects/vstudio/readme.txt b/projects/vstudio/readme.txt
index 9a1aa25..32db218 100644
--- a/projects/vstudio/readme.txt
+++ b/projects/vstudio/readme.txt
@@ -1,7 +1,7 @@
 
 VisualStudio instructions
 
-libpng version 1.7.0beta36 - August 6, 2014
+libpng version 1.7.0beta36 - September 27, 2014
 
 Copyright (c) 1998-2010 Glenn Randers-Pehrson
 
diff --git a/projects/vstudio/zlib.props b/projects/vstudio/zlib.props
index 81b9da9..665bdce 100644
--- a/projects/vstudio/zlib.props
+++ b/projects/vstudio/zlib.props
@@ -2,7 +2,7 @@
 <!--
  * zlib.props - location of zlib source
  *
- * libpng version 1.7.0beta36 - August 6, 2014
+ * libpng version 1.7.0beta36 - September 27, 2014
  *
  * Copyright (c) 1998-2011 Glenn Randers-Pehrson
  *
diff --git a/scripts/README.txt b/scripts/README.txt
index fe74842..5d10935 100644
--- a/scripts/README.txt
+++ b/scripts/README.txt
@@ -1,5 +1,5 @@
 
-Makefiles for  libpng version 1.7.0beta36 - August 6, 2014
+Makefiles for  libpng version 1.7.0beta36 - September 27, 2014
 
 pnglibconf.h.prebuilt       =>  Stores configuration settings
  makefile.linux    =>  Linux/ELF makefile
diff --git a/scripts/pnglibconf.h.prebuilt b/scripts/pnglibconf.h.prebuilt
index 7f3b698..b515eb0 100644
--- a/scripts/pnglibconf.h.prebuilt
+++ b/scripts/pnglibconf.h.prebuilt
@@ -2,7 +2,7 @@
 
 /* pnglibconf.h - library build configuration */
 
-/* Libpng version 1.7.0beta36 - August 6, 2014 */
+/* Libpng version 1.7.0beta36 - September 27, 2014 */
 
 /* Copyright (c) 1998-2013 Glenn Randers-Pehrson */