--- /dev/null
+diff -Naur libpng-1.2.29.orig/configure.ac libpng-1.2.29/configure.ac
+--- libpng-1.2.29.orig/configure.ac 2008-05-08 07:58:11.000000000 -0400
++++ libpng-1.2.29/configure.ac 2008-05-31 20:21:12.000000000 -0400
+@@ -63,7 +63,8 @@
+ AC_MSG_CHECKING(
+ [if assembler code in pnggccrd.c can be compiled without PNG_NO_MMX_CODE])
+ AC_TRY_COMPILE(
+- [#include "$srcdir/pnggccrd.c"],
++ [#define PNG_CONFIGURE_LIBPNG
++ #include "$srcdir/pnggccrd.c"],
+ [return 0;],
+ AC_MSG_RESULT(yes)
+ LIBPNG_NO_MMX="",
+diff -Naur libpng-1.2.29.orig/pngconf.h libpng-1.2.29/pngconf.h
+--- libpng-1.2.29.orig/pngconf.h 2008-05-08 07:58:03.000000000 -0400
++++ libpng-1.2.29/pngconf.h 2008-05-31 20:21:12.000000000 -0400
+@@ -35,6 +35,25 @@
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
++#else
++/* pngconf.h is part of the exported API. When a libpng-using application
++ includes us, PNG_CONFIGURE_LIBPNG is of course not defined as we do not have
++ libpng's config.h available in this case. This means that we do not have the
++ defines added to config.h and the commandline by libpng's ./configure .
++
++ For all defines from config.h not having them set is not a problem, however
++ ./configure also adds -DPNG_NO_ASSEMBLER_CODE to the CFLAGS when compiling
++ on a platform on which the MMX and SSE asm code in libpng is not supported.
++
++ We do need this define as this define is used to determine whether or not
++ to define PNG_ASSEMBLER_CODE_SUPPORTED and other assembler related defines
++ and prototypes. PNG_ASSEMBLER_CODE_SUPPORTED in turn is used by applications
++ (ImageMagick for example) to determine whether or not they can use the asm
++ functions. Thus we need to define PNG_NO_ASSEMBLER_CODE here on platforms
++ on which the MMX and SSE asm code in libpng is not supported: */
++#ifndef __i386__ /* change this if MMX/SSE become supported on x86_64! */
++#define PNG_NO_ASSEMBLER_CODE
++#endif
+ #endif
+
+ /*
--- /dev/null
+Patch for CVE-2008-3964
+
+
+diff -ru4NwbB libpng-1.2.31/pngpread.c libpng-1.2.32beta01/pngpread.c
+--- libpng-1.2.31/pngpread.c 2008-08-21 05:54:13.254898477 -0500
++++ libpng-1.2.32beta01/pngpread.c 2008-09-06 07:03:43.043602194 -0500
+@@ -1278,9 +1278,9 @@
+
+ tmp = text;
+ text = (png_charp)png_malloc(png_ptr, text_size +
+ (png_uint_32)(png_ptr->zbuf_size
+- - png_ptr->zstream.avail_out));
++ - 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);
Name: mingw-libpng
Version: 1.2.31
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: MinGW Windows Libpng library
License: zlib
URL: http://www.libpng.org/pub/png/
Source0: ftp://ftp.simplesystems.org/pub/png/src/libpng-%{version}.tar.bz2
+Patch1: libpng-pngconf.patch
+Patch2: libpng-ztxt-bug.patch
+
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%prep
%setup -q -n libpng-%{version}
+%patch1 -p1
+%patch2 -p1
%build
%{_mingw_configure}
%changelog
+* Mon Sep 22 2008 Daniel P. Berrange <berrange@redhat.com> - 1.2.31-4
+- Add patches from rawhide RPM
+
* Sun Sep 21 2008 Richard W.M. Jones <rjones@redhat.com> - 1.2.31-3
- Don't duplicate Fedora native manpages.