[arch-commits] Commit in libpng/repos (10 files)

Evangelos Foutras foutrelis at nymeria.archlinux.org
Mon May 6 09:40:24 UTC 2013


    Date: Monday, May 6, 2013 @ 11:40:22
  Author: foutrelis
Revision: 184330

archrelease: copy trunk to testing-i686, testing-x86_64

Added:
  libpng/repos/testing-i686/0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch
    (from rev 184329, libpng/trunk/0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch)
  libpng/repos/testing-i686/0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch
    (from rev 184329, libpng/trunk/0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch)
  libpng/repos/testing-i686/PKGBUILD
    (from rev 184329, libpng/trunk/PKGBUILD)
  libpng/repos/testing-i686/adjust-apng-patch-for-libpng16-git-changes.patch
    (from rev 184329, libpng/trunk/adjust-apng-patch-for-libpng16-git-changes.patch)
  libpng/repos/testing-x86_64/0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch
    (from rev 184329, libpng/trunk/0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch)
  libpng/repos/testing-x86_64/0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch
    (from rev 184329, libpng/trunk/0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch)
  libpng/repos/testing-x86_64/PKGBUILD
    (from rev 184329, libpng/trunk/PKGBUILD)
  libpng/repos/testing-x86_64/adjust-apng-patch-for-libpng16-git-changes.patch
    (from rev 184329, libpng/trunk/adjust-apng-patch-for-libpng16-git-changes.patch)
Deleted:
  libpng/repos/testing-i686/PKGBUILD
  libpng/repos/testing-x86_64/PKGBUILD

--------------------------------------------------------------------------------+
 /PKGBUILD                                                                      |  112 ++++++++
 testing-i686/0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch   |  106 +++++++
 testing-i686/0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch   |  133 ++++++++++
 testing-i686/PKGBUILD                                                          |   41 ---
 testing-i686/adjust-apng-patch-for-libpng16-git-changes.patch                  |   19 +
 testing-x86_64/0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch |  106 +++++++
 testing-x86_64/0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch |  133 ++++++++++
 testing-x86_64/PKGBUILD                                                        |   41 ---
 testing-x86_64/adjust-apng-patch-for-libpng16-git-changes.patch                |   19 +
 9 files changed, 628 insertions(+), 82 deletions(-)

Copied: libpng/repos/testing-i686/0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch (from rev 184329, libpng/trunk/0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch)
===================================================================
--- testing-i686/0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch	                        (rev 0)
+++ testing-i686/0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch	2013-05-06 09:40:22 UTC (rev 184330)
@@ -0,0 +1,106 @@
+From 56d6bc2e8855d25e03816509a0137c3a70410ae6 Mon Sep 17 00:00:00 2001
+From: Glenn Randers-Pehrson <glennrp at users.sourceforge.net>
+Date: Mon, 29 Apr 2013 08:57:14 -0500
+Subject: [PATCH 06/10] [libpng16] Avoid dereferencing NULL pointer possibly
+ returned from
+
+png_create_write_struct() (Andrew Church).
+---
+ ANNOUNCE   |  6 ++++--
+ CHANGES    |  4 +++-
+ pngwrite.c | 65 +++++++++++++++++++++++++++++++-------------------------------
+ 3 files changed, 39 insertions(+), 36 deletions(-)
+
+ (foutrelis: pruned non-code changes to apply cleanly to libpng 1.6.2.)
+
+diff --git a/pngwrite.c b/pngwrite.c
+index 33924aa..b71a3d3 100644
+--- a/pngwrite.c
++++ b/pngwrite.c
+@@ -494,51 +494,50 @@ png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
+    png_structrp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
+       error_fn, warn_fn, mem_ptr, malloc_fn, free_fn);
+ #endif /* PNG_USER_MEM_SUPPORTED */
++   if (png_ptr != NULL)
++   {
++      /* Set the zlib control values to defaults; they can be overridden by the
++       * application after the struct has been created.
++       */
++      png_ptr->zbuffer_size = PNG_ZBUF_SIZE;
+ 
+-   /* Set the zlib control values to defaults; they can be overridden by the
+-    * application after the struct has been created.
+-    */
+-   png_ptr->zbuffer_size = PNG_ZBUF_SIZE;
+-
+-   /* The 'zlib_strategy' setting is irrelevant because png_default_claim in
+-    * pngwutil.c defaults it according to whether or not filters will be used,
+-    * and ignores this setting.
+-    */
+-   png_ptr->zlib_strategy = PNG_Z_DEFAULT_STRATEGY;
+-   png_ptr->zlib_level = PNG_Z_DEFAULT_COMPRESSION;
+-   png_ptr->zlib_mem_level = 8;
+-   png_ptr->zlib_window_bits = 15;
+-   png_ptr->zlib_method = 8;
++      /* The 'zlib_strategy' setting is irrelevant because png_default_claim in
++       * pngwutil.c defaults it according to whether or not filters will be
++       * used, and ignores this setting.
++       */
++      png_ptr->zlib_strategy = PNG_Z_DEFAULT_STRATEGY;
++      png_ptr->zlib_level = PNG_Z_DEFAULT_COMPRESSION;
++      png_ptr->zlib_mem_level = 8;
++      png_ptr->zlib_window_bits = 15;
++      png_ptr->zlib_method = 8;
+ 
+ #ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
+-   png_ptr->zlib_text_strategy = PNG_TEXT_Z_DEFAULT_STRATEGY;
+-   png_ptr->zlib_text_level = PNG_TEXT_Z_DEFAULT_COMPRESSION;
+-   png_ptr->zlib_text_mem_level = 8;
+-   png_ptr->zlib_text_window_bits = 15;
+-   png_ptr->zlib_text_method = 8;
++      png_ptr->zlib_text_strategy = PNG_TEXT_Z_DEFAULT_STRATEGY;
++      png_ptr->zlib_text_level = PNG_TEXT_Z_DEFAULT_COMPRESSION;
++      png_ptr->zlib_text_mem_level = 8;
++      png_ptr->zlib_text_window_bits = 15;
++      png_ptr->zlib_text_method = 8;
+ #endif /* PNG_WRITE_COMPRESSED_TEXT_SUPPORTED */
+ 
+-   /* This is a highly dubious configuration option; by default it is off, but
+-    * it may be appropriate for private builds that are testing extensions not
+-    * conformant to the current specification, or of applications that must not
+-    * fail to write at all costs!
+-    */
+-#  ifdef PNG_BENIGN_WRITE_ERRORS_SUPPORTED
++      /* This is a highly dubious configuration option; by default it is off,
++       * but it may be appropriate for private builds that are testing
++       * extensions not conformant to the current specification, or of
++       * applications that must not fail to write at all costs!
++       */
++#ifdef PNG_BENIGN_WRITE_ERRORS_SUPPORTED
+       png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
+       /* In stable builds only warn if an application error can be completely
+        * handled.
+        */
+-#  endif
++#endif
+ 
+-   /* App warnings are warnings in release (or release candidate) builds but
+-    * are errors during development.
+-    */
+-#  if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
++      /* App warnings are warnings in release (or release candidate) builds but
++       * are errors during development.
++       */
++#if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
+       png_ptr->flags |= PNG_FLAG_APP_WARNINGS_WARN;
+-#  endif
++#endif
+ 
+-   if (png_ptr != NULL)
+-   {
+       /* TODO: delay this, it can be done in png_init_io() (if the app doesn't
+        * do it itself) avoiding setting the default function if it is not
+        * required.
+-- 
+1.8.2.2
+

Copied: libpng/repos/testing-i686/0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch (from rev 184329, libpng/trunk/0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch)
===================================================================
--- testing-i686/0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch	                        (rev 0)
+++ testing-i686/0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch	2013-05-06 09:40:22 UTC (rev 184330)
@@ -0,0 +1,133 @@
+From 127b08a265f99ce517ea31ec7988a91fc17da4d9 Mon Sep 17 00:00:00 2001
+From: Glenn Randers-Pehrson <glennrp at users.sourceforge.net>
+Date: Sun, 5 May 2013 22:13:47 -0500
+Subject: [PATCH 09/10] [libpng16] Calculate our own zlib windowBits when
+ decoding rather than
+
+trusting the CMF bytes in the PNG datastream.
+---
+ ANNOUNCE   |  6 +++--
+ CHANGES    |  5 +++-
+ pngrutil.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
+ 3 files changed, 88 insertions(+), 10 deletions(-)
+
+ (foutrelis: pruned non-code changes to apply cleanly to libpng 1.6.2.)
+
+diff --git a/pngrutil.c b/pngrutil.c
+index 01c3679..9c10e26 100644
+--- a/pngrutil.c
++++ b/pngrutil.c
+@@ -18,8 +18,6 @@
+ 
+ #ifdef PNG_READ_SUPPORTED
+ 
+-#define png_strtod(p,a,b) strtod(a,b)
+-
+ png_uint_32 PNGAPI
+ png_get_uint_31(png_const_structrp png_ptr, png_const_bytep buf)
+ {
+@@ -4165,6 +4163,75 @@ png_read_finish_row(png_structrp png_ptr)
+ }
+ #endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
+ 
++#ifdef PNG_READ_OPTIMIZE_WINDOWBITS_SUPPORTED
++/* This is the code to to select a windowBits value to match the smallest
++ * possible sliding window needed to contain the entire uncompressed image.
++ */
++static unsigned int
++required_window_bits(png_alloc_size_t data_size)
++{
++   unsigned int windowBits = 15;
++   if (data_size <= 16384) /* else windowBits must be 15 */
++   {
++      unsigned int half_z_window_size = 1U << (windowBits-1);  /* 16384 */
++
++      do
++      {
++         half_z_window_size >>= 1;
++         --windowBits;
++      }
++      while (windowBits > 8 && data_size <= half_z_window_size);
++   }
++   return windowBits;
++}
++/* This is used below to find the size of an image to pass to png_deflate_claim,
++ * so it only needs to be accurate if the size is less than 16384 bytes (the
++ * point at which a lower LZ window size can be used.)
++ *
++ * To do: merge this with png_image_size() in pngwutil.c and put the result
++ * in png.c as a PNG_INTERNAL_FUNCTION.
++ */
++static png_alloc_size_t
++png_read_image_size(png_structrp png_ptr)
++{
++   /* Only return sizes up to the maximum of a png_uint_32, do this by limiting
++    * the width and height used to 15 bits.
++    */
++   png_uint_32 h = png_ptr->height;
++
++   if (png_ptr->rowbytes < 32768 && h < 32768)
++   {
++      if (png_ptr->interlaced)
++      {
++         /* Interlacing makes the image larger because of the replication of
++          * both the filter byte and the padding to a byte boundary.
++          */
++         png_uint_32 w = png_ptr->width;
++         unsigned int pd = png_ptr->pixel_depth;
++         png_alloc_size_t cb_base;
++         int pass;
++
++         for (cb_base=0, pass=0; pass<=6; ++pass)
++         {
++            png_uint_32 pw = PNG_PASS_COLS(w, pass);
++
++            if (pw > 0)
++               cb_base += (PNG_ROWBYTES(pd, pw)+1) * PNG_PASS_ROWS(h, pass);
++         }
++
++         return cb_base;
++      }
++
++      else
++         return (png_ptr->rowbytes+1) * h;
++   }
++
++   else
++      return 0xffffffffU;
++}
++
++#endif /* PNG_READ_OPTIMIZE_WINDOWBITS_SUPPORTED */
++
+ void /* PRIVATE */
+ png_read_start_row(png_structrp png_ptr)
+ {
+@@ -4449,14 +4516,20 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
+       png_free(png_ptr, buffer);
+    }
+ 
+-   /* Finally claim the zstream for the inflate of the IDAT data, use the bits
+-    * value from the stream (note that this will result in a fatal error if the
+-    * IDAT stream has a bogus deflate header window_bits value, but this should
+-    * not be happening any longer!)
++   /* Finally claim the zstream for the inflate of the IDAT data, using the
++    * windowBts predicted from the uncompressed data size, not the value from
++    * the stream.  If READ_OPTIMIZE_WINDOWBITS_SUPPORTED is not defined, then
++    * simply use a 32kbyte window (windowBits=15).
+     */
+-   if (png_inflate_claim(png_ptr, png_IDAT, 0) != Z_OK)
++#ifdef PNG_READ_OPTIMIZE_WINDOWBITS_SUPPORTED
++   if (png_inflate_claim(png_ptr, png_IDAT,
++      required_window_bits(png_read_image_size(png_ptr))) != Z_OK)
++#else
++   if (png_inflate_claim(png_ptr, png_IDAT, 15) != Z_OK)
++#endif
+       png_error(png_ptr, png_ptr->zstream.msg);
+ 
+    png_ptr->flags |= PNG_FLAG_ROW_INIT;
+ }
++
+ #endif /* PNG_READ_SUPPORTED */
+-- 
+1.8.2.2
+

Deleted: testing-i686/PKGBUILD
===================================================================
--- testing-i686/PKGBUILD	2013-05-06 09:40:01 UTC (rev 184329)
+++ testing-i686/PKGBUILD	2013-05-06 09:40:22 UTC (rev 184330)
@@ -1,41 +0,0 @@
-# $Id$
-# Maintainer: Jan de Groot <jgc at archlinux.org>
-# Contributor: dorphell <dorphell at archlinux.org>
-# Contributor: Travis Willard <travis at archlinux.org>
-# Contributor: Douglas Soares de Andrade <douglas at archlinux.org>
-
-pkgname=libpng
-pkgver=1.6.2
-_apngver=1.6.2
-pkgrel=2
-pkgdesc="A collection of routines used to create PNG format graphics files"
-arch=('i686' 'x86_64')
-url="http://www.libpng.org/pub/png/libpng.html"
-license=('custom')
-depends=('zlib' 'sh')
-options=('!libtool')
-source=("http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.xz"
-        "http://downloads.sourceforge.net/sourceforge/libpng-apng/libpng-$_apngver-apng.patch.gz")
-md5sums=('9d838f6fca9948a9f360a0cc1b516d5f'
-         '7d0c9f4b9a7f45dd5d1088e54b623c98')
-
-build() {
-  cd $pkgname-$pkgver
-
-  # Add animated PNG (apng) support
-  # see http://sourceforge.net/projects/libpng-apng/
-  patch -p1 -i ../libpng-$_apngver-apng.patch
-
-  ./configure --prefix=/usr
-  make
-}
-
-package() {
-  cd $pkgname-$pkgver
-  make DESTDIR="$pkgdir" install
-
-  cd contrib/pngminus
-  make PNGLIB="-L$pkgdir/usr/lib -lpng" -f makefile.std png2pnm pnm2png
-  install -m755 png2pnm pnm2png "$pkgdir/usr/bin/"
-  install -D -m644 ../../LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
-}

Copied: libpng/repos/testing-i686/PKGBUILD (from rev 184329, libpng/trunk/PKGBUILD)
===================================================================
--- testing-i686/PKGBUILD	                        (rev 0)
+++ testing-i686/PKGBUILD	2013-05-06 09:40:22 UTC (rev 184330)
@@ -0,0 +1,56 @@
+# $Id$
+# Maintainer: Jan de Groot <jgc at archlinux.org>
+# Contributor: dorphell <dorphell at archlinux.org>
+# Contributor: Travis Willard <travis at archlinux.org>
+# Contributor: Douglas Soares de Andrade <douglas at archlinux.org>
+
+pkgname=libpng
+pkgver=1.6.2
+_apngver=1.6.2
+pkgrel=3
+pkgdesc="A collection of routines used to create PNG format graphics files"
+arch=('i686' 'x86_64')
+url="http://www.libpng.org/pub/png/libpng.html"
+license=('custom')
+depends=('zlib' 'sh')
+options=('!libtool')
+source=("http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.xz"
+        "http://downloads.sourceforge.net/sourceforge/libpng-apng/libpng-$_apngver-apng.patch.gz"
+        0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch
+        0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch
+        adjust-apng-patch-for-libpng16-git-changes.patch)
+md5sums=('9d838f6fca9948a9f360a0cc1b516d5f'
+         '7d0c9f4b9a7f45dd5d1088e54b623c98'
+         '59b83234f60a7d1d179d9b0b6a0ebc01'
+         'b1f7922b6678305bdb7c23d5bd1763f3'
+         'f87704c3fb6d29f09b52178e89a42e2e')
+
+prepare() {
+  cd $pkgname-$pkgver
+
+  # Add fixes from libpng16 branch
+  patch -Np1 -i ../0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch
+  patch -Np1 -i ../0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch
+
+  # Add animated PNG (apng) support
+  # see http://sourceforge.net/projects/libpng-apng/
+  patch -d .. -Np0 -i adjust-apng-patch-for-libpng16-git-changes.patch
+  patch -Np1 -i ../libpng-$_apngver-apng.patch
+}
+
+build() {
+  cd $pkgname-$pkgver
+
+  ./configure --prefix=/usr
+  make
+}
+
+package() {
+  cd $pkgname-$pkgver
+  make DESTDIR="$pkgdir" install
+
+  cd contrib/pngminus
+  make PNGLIB="-L$pkgdir/usr/lib -lpng" -f makefile.std png2pnm pnm2png
+  install -m755 png2pnm pnm2png "$pkgdir/usr/bin/"
+  install -D -m644 ../../LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}

Copied: libpng/repos/testing-i686/adjust-apng-patch-for-libpng16-git-changes.patch (from rev 184329, libpng/trunk/adjust-apng-patch-for-libpng16-git-changes.patch)
===================================================================
--- testing-i686/adjust-apng-patch-for-libpng16-git-changes.patch	                        (rev 0)
+++ testing-i686/adjust-apng-patch-for-libpng16-git-changes.patch	2013-05-06 09:40:22 UTC (rev 184330)
@@ -0,0 +1,19 @@
+--- libpng-1.6.2-apng.patch.orig	2013-05-06 12:09:16.000000000 +0300
++++ libpng-1.6.2-apng.patch	2013-05-06 12:12:14.000000000 +0300
+@@ -1034,7 +1034,7 @@ diff -Naru libpng-1.6.2.org/pngrutil.c l
+  
+           if (png_ptr->zstream.avail_in > 0 || png_ptr->idat_size > 0)
+              png_chunk_benign_error(png_ptr, "Extra compressed data");
+-@@ -4459,4 +4671,80 @@
++@@ -4459,5 +4671,81 @@
+  
+     png_ptr->flags |= PNG_FLAG_ROW_INIT;
+  }
+@@ -1114,6 +1114,7 @@ diff -Naru libpng-1.6.2.org/pngrutil.c l
+ +}
+ +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
+ +#endif /* PNG_READ_APNG_SUPPORTED */
++ 
+  #endif /* PNG_READ_SUPPORTED */
+ diff -Naru libpng-1.6.2.org/pngset.c libpng-1.6.2/pngset.c
+ --- libpng-1.6.2.org/pngset.c	2013-04-29 17:31:42.000000000 +0900

Copied: libpng/repos/testing-x86_64/0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch (from rev 184329, libpng/trunk/0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch)
===================================================================
--- testing-x86_64/0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch	                        (rev 0)
+++ testing-x86_64/0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch	2013-05-06 09:40:22 UTC (rev 184330)
@@ -0,0 +1,106 @@
+From 56d6bc2e8855d25e03816509a0137c3a70410ae6 Mon Sep 17 00:00:00 2001
+From: Glenn Randers-Pehrson <glennrp at users.sourceforge.net>
+Date: Mon, 29 Apr 2013 08:57:14 -0500
+Subject: [PATCH 06/10] [libpng16] Avoid dereferencing NULL pointer possibly
+ returned from
+
+png_create_write_struct() (Andrew Church).
+---
+ ANNOUNCE   |  6 ++++--
+ CHANGES    |  4 +++-
+ pngwrite.c | 65 +++++++++++++++++++++++++++++++-------------------------------
+ 3 files changed, 39 insertions(+), 36 deletions(-)
+
+ (foutrelis: pruned non-code changes to apply cleanly to libpng 1.6.2.)
+
+diff --git a/pngwrite.c b/pngwrite.c
+index 33924aa..b71a3d3 100644
+--- a/pngwrite.c
++++ b/pngwrite.c
+@@ -494,51 +494,50 @@ png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
+    png_structrp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
+       error_fn, warn_fn, mem_ptr, malloc_fn, free_fn);
+ #endif /* PNG_USER_MEM_SUPPORTED */
++   if (png_ptr != NULL)
++   {
++      /* Set the zlib control values to defaults; they can be overridden by the
++       * application after the struct has been created.
++       */
++      png_ptr->zbuffer_size = PNG_ZBUF_SIZE;
+ 
+-   /* Set the zlib control values to defaults; they can be overridden by the
+-    * application after the struct has been created.
+-    */
+-   png_ptr->zbuffer_size = PNG_ZBUF_SIZE;
+-
+-   /* The 'zlib_strategy' setting is irrelevant because png_default_claim in
+-    * pngwutil.c defaults it according to whether or not filters will be used,
+-    * and ignores this setting.
+-    */
+-   png_ptr->zlib_strategy = PNG_Z_DEFAULT_STRATEGY;
+-   png_ptr->zlib_level = PNG_Z_DEFAULT_COMPRESSION;
+-   png_ptr->zlib_mem_level = 8;
+-   png_ptr->zlib_window_bits = 15;
+-   png_ptr->zlib_method = 8;
++      /* The 'zlib_strategy' setting is irrelevant because png_default_claim in
++       * pngwutil.c defaults it according to whether or not filters will be
++       * used, and ignores this setting.
++       */
++      png_ptr->zlib_strategy = PNG_Z_DEFAULT_STRATEGY;
++      png_ptr->zlib_level = PNG_Z_DEFAULT_COMPRESSION;
++      png_ptr->zlib_mem_level = 8;
++      png_ptr->zlib_window_bits = 15;
++      png_ptr->zlib_method = 8;
+ 
+ #ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
+-   png_ptr->zlib_text_strategy = PNG_TEXT_Z_DEFAULT_STRATEGY;
+-   png_ptr->zlib_text_level = PNG_TEXT_Z_DEFAULT_COMPRESSION;
+-   png_ptr->zlib_text_mem_level = 8;
+-   png_ptr->zlib_text_window_bits = 15;
+-   png_ptr->zlib_text_method = 8;
++      png_ptr->zlib_text_strategy = PNG_TEXT_Z_DEFAULT_STRATEGY;
++      png_ptr->zlib_text_level = PNG_TEXT_Z_DEFAULT_COMPRESSION;
++      png_ptr->zlib_text_mem_level = 8;
++      png_ptr->zlib_text_window_bits = 15;
++      png_ptr->zlib_text_method = 8;
+ #endif /* PNG_WRITE_COMPRESSED_TEXT_SUPPORTED */
+ 
+-   /* This is a highly dubious configuration option; by default it is off, but
+-    * it may be appropriate for private builds that are testing extensions not
+-    * conformant to the current specification, or of applications that must not
+-    * fail to write at all costs!
+-    */
+-#  ifdef PNG_BENIGN_WRITE_ERRORS_SUPPORTED
++      /* This is a highly dubious configuration option; by default it is off,
++       * but it may be appropriate for private builds that are testing
++       * extensions not conformant to the current specification, or of
++       * applications that must not fail to write at all costs!
++       */
++#ifdef PNG_BENIGN_WRITE_ERRORS_SUPPORTED
+       png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
+       /* In stable builds only warn if an application error can be completely
+        * handled.
+        */
+-#  endif
++#endif
+ 
+-   /* App warnings are warnings in release (or release candidate) builds but
+-    * are errors during development.
+-    */
+-#  if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
++      /* App warnings are warnings in release (or release candidate) builds but
++       * are errors during development.
++       */
++#if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
+       png_ptr->flags |= PNG_FLAG_APP_WARNINGS_WARN;
+-#  endif
++#endif
+ 
+-   if (png_ptr != NULL)
+-   {
+       /* TODO: delay this, it can be done in png_init_io() (if the app doesn't
+        * do it itself) avoiding setting the default function if it is not
+        * required.
+-- 
+1.8.2.2
+

Copied: libpng/repos/testing-x86_64/0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch (from rev 184329, libpng/trunk/0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch)
===================================================================
--- testing-x86_64/0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch	                        (rev 0)
+++ testing-x86_64/0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch	2013-05-06 09:40:22 UTC (rev 184330)
@@ -0,0 +1,133 @@
+From 127b08a265f99ce517ea31ec7988a91fc17da4d9 Mon Sep 17 00:00:00 2001
+From: Glenn Randers-Pehrson <glennrp at users.sourceforge.net>
+Date: Sun, 5 May 2013 22:13:47 -0500
+Subject: [PATCH 09/10] [libpng16] Calculate our own zlib windowBits when
+ decoding rather than
+
+trusting the CMF bytes in the PNG datastream.
+---
+ ANNOUNCE   |  6 +++--
+ CHANGES    |  5 +++-
+ pngrutil.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
+ 3 files changed, 88 insertions(+), 10 deletions(-)
+
+ (foutrelis: pruned non-code changes to apply cleanly to libpng 1.6.2.)
+
+diff --git a/pngrutil.c b/pngrutil.c
+index 01c3679..9c10e26 100644
+--- a/pngrutil.c
++++ b/pngrutil.c
+@@ -18,8 +18,6 @@
+ 
+ #ifdef PNG_READ_SUPPORTED
+ 
+-#define png_strtod(p,a,b) strtod(a,b)
+-
+ png_uint_32 PNGAPI
+ png_get_uint_31(png_const_structrp png_ptr, png_const_bytep buf)
+ {
+@@ -4165,6 +4163,75 @@ png_read_finish_row(png_structrp png_ptr)
+ }
+ #endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
+ 
++#ifdef PNG_READ_OPTIMIZE_WINDOWBITS_SUPPORTED
++/* This is the code to to select a windowBits value to match the smallest
++ * possible sliding window needed to contain the entire uncompressed image.
++ */
++static unsigned int
++required_window_bits(png_alloc_size_t data_size)
++{
++   unsigned int windowBits = 15;
++   if (data_size <= 16384) /* else windowBits must be 15 */
++   {
++      unsigned int half_z_window_size = 1U << (windowBits-1);  /* 16384 */
++
++      do
++      {
++         half_z_window_size >>= 1;
++         --windowBits;
++      }
++      while (windowBits > 8 && data_size <= half_z_window_size);
++   }
++   return windowBits;
++}
++/* This is used below to find the size of an image to pass to png_deflate_claim,
++ * so it only needs to be accurate if the size is less than 16384 bytes (the
++ * point at which a lower LZ window size can be used.)
++ *
++ * To do: merge this with png_image_size() in pngwutil.c and put the result
++ * in png.c as a PNG_INTERNAL_FUNCTION.
++ */
++static png_alloc_size_t
++png_read_image_size(png_structrp png_ptr)
++{
++   /* Only return sizes up to the maximum of a png_uint_32, do this by limiting
++    * the width and height used to 15 bits.
++    */
++   png_uint_32 h = png_ptr->height;
++
++   if (png_ptr->rowbytes < 32768 && h < 32768)
++   {
++      if (png_ptr->interlaced)
++      {
++         /* Interlacing makes the image larger because of the replication of
++          * both the filter byte and the padding to a byte boundary.
++          */
++         png_uint_32 w = png_ptr->width;
++         unsigned int pd = png_ptr->pixel_depth;
++         png_alloc_size_t cb_base;
++         int pass;
++
++         for (cb_base=0, pass=0; pass<=6; ++pass)
++         {
++            png_uint_32 pw = PNG_PASS_COLS(w, pass);
++
++            if (pw > 0)
++               cb_base += (PNG_ROWBYTES(pd, pw)+1) * PNG_PASS_ROWS(h, pass);
++         }
++
++         return cb_base;
++      }
++
++      else
++         return (png_ptr->rowbytes+1) * h;
++   }
++
++   else
++      return 0xffffffffU;
++}
++
++#endif /* PNG_READ_OPTIMIZE_WINDOWBITS_SUPPORTED */
++
+ void /* PRIVATE */
+ png_read_start_row(png_structrp png_ptr)
+ {
+@@ -4449,14 +4516,20 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
+       png_free(png_ptr, buffer);
+    }
+ 
+-   /* Finally claim the zstream for the inflate of the IDAT data, use the bits
+-    * value from the stream (note that this will result in a fatal error if the
+-    * IDAT stream has a bogus deflate header window_bits value, but this should
+-    * not be happening any longer!)
++   /* Finally claim the zstream for the inflate of the IDAT data, using the
++    * windowBts predicted from the uncompressed data size, not the value from
++    * the stream.  If READ_OPTIMIZE_WINDOWBITS_SUPPORTED is not defined, then
++    * simply use a 32kbyte window (windowBits=15).
+     */
+-   if (png_inflate_claim(png_ptr, png_IDAT, 0) != Z_OK)
++#ifdef PNG_READ_OPTIMIZE_WINDOWBITS_SUPPORTED
++   if (png_inflate_claim(png_ptr, png_IDAT,
++      required_window_bits(png_read_image_size(png_ptr))) != Z_OK)
++#else
++   if (png_inflate_claim(png_ptr, png_IDAT, 15) != Z_OK)
++#endif
+       png_error(png_ptr, png_ptr->zstream.msg);
+ 
+    png_ptr->flags |= PNG_FLAG_ROW_INIT;
+ }
++
+ #endif /* PNG_READ_SUPPORTED */
+-- 
+1.8.2.2
+

Deleted: testing-x86_64/PKGBUILD
===================================================================
--- testing-x86_64/PKGBUILD	2013-05-06 09:40:01 UTC (rev 184329)
+++ testing-x86_64/PKGBUILD	2013-05-06 09:40:22 UTC (rev 184330)
@@ -1,41 +0,0 @@
-# $Id$
-# Maintainer: Jan de Groot <jgc at archlinux.org>
-# Contributor: dorphell <dorphell at archlinux.org>
-# Contributor: Travis Willard <travis at archlinux.org>
-# Contributor: Douglas Soares de Andrade <douglas at archlinux.org>
-
-pkgname=libpng
-pkgver=1.6.2
-_apngver=1.6.2
-pkgrel=2
-pkgdesc="A collection of routines used to create PNG format graphics files"
-arch=('i686' 'x86_64')
-url="http://www.libpng.org/pub/png/libpng.html"
-license=('custom')
-depends=('zlib' 'sh')
-options=('!libtool')
-source=("http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.xz"
-        "http://downloads.sourceforge.net/sourceforge/libpng-apng/libpng-$_apngver-apng.patch.gz")
-md5sums=('9d838f6fca9948a9f360a0cc1b516d5f'
-         '7d0c9f4b9a7f45dd5d1088e54b623c98')
-
-build() {
-  cd $pkgname-$pkgver
-
-  # Add animated PNG (apng) support
-  # see http://sourceforge.net/projects/libpng-apng/
-  patch -p1 -i ../libpng-$_apngver-apng.patch
-
-  ./configure --prefix=/usr
-  make
-}
-
-package() {
-  cd $pkgname-$pkgver
-  make DESTDIR="$pkgdir" install
-
-  cd contrib/pngminus
-  make PNGLIB="-L$pkgdir/usr/lib -lpng" -f makefile.std png2pnm pnm2png
-  install -m755 png2pnm pnm2png "$pkgdir/usr/bin/"
-  install -D -m644 ../../LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
-}

Copied: libpng/repos/testing-x86_64/PKGBUILD (from rev 184329, libpng/trunk/PKGBUILD)
===================================================================
--- testing-x86_64/PKGBUILD	                        (rev 0)
+++ testing-x86_64/PKGBUILD	2013-05-06 09:40:22 UTC (rev 184330)
@@ -0,0 +1,56 @@
+# $Id$
+# Maintainer: Jan de Groot <jgc at archlinux.org>
+# Contributor: dorphell <dorphell at archlinux.org>
+# Contributor: Travis Willard <travis at archlinux.org>
+# Contributor: Douglas Soares de Andrade <douglas at archlinux.org>
+
+pkgname=libpng
+pkgver=1.6.2
+_apngver=1.6.2
+pkgrel=3
+pkgdesc="A collection of routines used to create PNG format graphics files"
+arch=('i686' 'x86_64')
+url="http://www.libpng.org/pub/png/libpng.html"
+license=('custom')
+depends=('zlib' 'sh')
+options=('!libtool')
+source=("http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.xz"
+        "http://downloads.sourceforge.net/sourceforge/libpng-apng/libpng-$_apngver-apng.patch.gz"
+        0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch
+        0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch
+        adjust-apng-patch-for-libpng16-git-changes.patch)
+md5sums=('9d838f6fca9948a9f360a0cc1b516d5f'
+         '7d0c9f4b9a7f45dd5d1088e54b623c98'
+         '59b83234f60a7d1d179d9b0b6a0ebc01'
+         'b1f7922b6678305bdb7c23d5bd1763f3'
+         'f87704c3fb6d29f09b52178e89a42e2e')
+
+prepare() {
+  cd $pkgname-$pkgver
+
+  # Add fixes from libpng16 branch
+  patch -Np1 -i ../0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch
+  patch -Np1 -i ../0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch
+
+  # Add animated PNG (apng) support
+  # see http://sourceforge.net/projects/libpng-apng/
+  patch -d .. -Np0 -i adjust-apng-patch-for-libpng16-git-changes.patch
+  patch -Np1 -i ../libpng-$_apngver-apng.patch
+}
+
+build() {
+  cd $pkgname-$pkgver
+
+  ./configure --prefix=/usr
+  make
+}
+
+package() {
+  cd $pkgname-$pkgver
+  make DESTDIR="$pkgdir" install
+
+  cd contrib/pngminus
+  make PNGLIB="-L$pkgdir/usr/lib -lpng" -f makefile.std png2pnm pnm2png
+  install -m755 png2pnm pnm2png "$pkgdir/usr/bin/"
+  install -D -m644 ../../LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}

Copied: libpng/repos/testing-x86_64/adjust-apng-patch-for-libpng16-git-changes.patch (from rev 184329, libpng/trunk/adjust-apng-patch-for-libpng16-git-changes.patch)
===================================================================
--- testing-x86_64/adjust-apng-patch-for-libpng16-git-changes.patch	                        (rev 0)
+++ testing-x86_64/adjust-apng-patch-for-libpng16-git-changes.patch	2013-05-06 09:40:22 UTC (rev 184330)
@@ -0,0 +1,19 @@
+--- libpng-1.6.2-apng.patch.orig	2013-05-06 12:09:16.000000000 +0300
++++ libpng-1.6.2-apng.patch	2013-05-06 12:12:14.000000000 +0300
+@@ -1034,7 +1034,7 @@ diff -Naru libpng-1.6.2.org/pngrutil.c l
+  
+           if (png_ptr->zstream.avail_in > 0 || png_ptr->idat_size > 0)
+              png_chunk_benign_error(png_ptr, "Extra compressed data");
+-@@ -4459,4 +4671,80 @@
++@@ -4459,5 +4671,81 @@
+  
+     png_ptr->flags |= PNG_FLAG_ROW_INIT;
+  }
+@@ -1114,6 +1114,7 @@ diff -Naru libpng-1.6.2.org/pngrutil.c l
+ +}
+ +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
+ +#endif /* PNG_READ_APNG_SUPPORTED */
++ 
+  #endif /* PNG_READ_SUPPORTED */
+ diff -Naru libpng-1.6.2.org/pngset.c libpng-1.6.2/pngset.c
+ --- libpng-1.6.2.org/pngset.c	2013-04-29 17:31:42.000000000 +0900




More information about the arch-commits mailing list