commit a984ae75bd980ae9917bfdd392fd51ce3ad25612 Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 10:57:37 2019 -0400 Package init diff --git a/libpng-1.6.36.tar.gz b/libpng-1.6.36.tar.gz new file mode 100644 index 0000000..174a368 Binary files /dev/null and b/libpng-1.6.36.tar.gz differ diff --git a/libpng-CVE-2019-7317.patch b/libpng-CVE-2019-7317.patch new file mode 100644 index 0000000..a27cfee --- /dev/null +++ b/libpng-CVE-2019-7317.patch @@ -0,0 +1,14 @@ +diff --git a/png.c b/png.c +index a25afeb..ff9da3f 100644 +--- a/png.c ++++ b/png.c +@@ -4594,8 +4594,7 @@ png_image_free(png_imagep image) + if (image != NULL && image->opaque != NULL && + image->opaque->error_buf == NULL) + { +- /* Ignore errors here: */ +- (void)png_safe_execute(image, png_image_free_function, image); ++ png_image_free_function(image); + image->opaque = NULL; + } + } diff --git a/libpng-fix-arm-neon.patch b/libpng-fix-arm-neon.patch new file mode 100644 index 0000000..e424957 --- /dev/null +++ b/libpng-fix-arm-neon.patch @@ -0,0 +1,39 @@ +diff --git a/configure.ac b/configure.ac +index 4fb0778..930bf50 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -283,17 +283,21 @@ AC_ARG_ENABLE([arm-neon], + [case "$enableval" in + no|off) + # disable the default enabling on __ARM_NEON__ systems: ++ AC_DEFINE([PNG_ARM_NEON], [], [ARM NEON support]) + AC_DEFINE([PNG_ARM_NEON_OPT], [0], + [Disable ARM Neon optimizations]) + # Prevent inclusion of the assembler files below: + enable_arm_neon=no;; + check) ++ AC_DEFINE([PNG_ARM_NEON], [], [ARM NEON support]) + AC_DEFINE([PNG_ARM_NEON_CHECK_SUPPORTED], [], + [Check for ARM Neon support at run-time]);; + api) ++ AC_DEFINE([PNG_ARM_NEON], [], [ARM NEON support]) + AC_DEFINE([PNG_ARM_NEON_API_SUPPORTED], [], + [Turn on ARM Neon optimizations at run-time]);; + yes|on) ++ AC_DEFINE([PNG_ARM_NEON], [], [ARM NEON support]) + AC_DEFINE([PNG_ARM_NEON_OPT], [2], + [Enable ARM Neon optimizations]) + AC_MSG_WARN([--enable-arm-neon: please specify 'check' or 'api', if] +diff --git a/pngpriv.h b/pngpriv.h +index 1997503..789206f 100644 +--- a/pngpriv.h ++++ b/pngpriv.h +@@ -125,7 +125,7 @@ + * associated assembler code, pass --enable-arm-neon=no to configure + * or put -DPNG_ARM_NEON_OPT=0 in CPPFLAGS. + */ +-# if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && \ ++# if defined(PNG_ARM_NEON) && (defined(__ARM_NEON__) || defined(__ARM_NEON)) && \ + defined(PNG_ALIGNED_MEMORY_SUPPORTED) + # define PNG_ARM_NEON_OPT 2 + # else diff --git a/libpng-multilib.patch b/libpng-multilib.patch new file mode 100644 index 0000000..c99c765 --- /dev/null +++ b/libpng-multilib.patch @@ -0,0 +1,23 @@ +Use pkg-config to report libpng version and installation directories. + + +diff -Naur libpng-1.5.5.orig/libpng-config.in libpng-1.5.5/libpng-config.in +--- libpng-1.5.5.orig/libpng-config.in 2011-09-22 09:40:23.000000000 -0400 ++++ libpng-1.5.5/libpng-config.in 2011-10-05 01:03:32.335435187 -0400 +@@ -11,11 +11,11 @@ + + # Modeled after libxml-config. + +-version="@PNGLIB_VERSION@" +-prefix="@prefix@" +-exec_prefix="@exec_prefix@" +-libdir="@libdir@" +-includedir="@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@" ++version=`pkg-config --modversion libpng` ++prefix=`pkg-config --variable prefix libpng` ++exec_prefix=`pkg-config --variable exec_prefix libpng` ++libdir=`pkg-config --variable libdir libpng` ++includedir=`pkg-config --variable includedir libpng` + libs="-lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@" + all_libs="-lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ @LIBS@" + I_opts="-I${includedir}" diff --git a/libpng.spec b/libpng.spec new file mode 100644 index 0000000..19fdce3 --- /dev/null +++ b/libpng.spec @@ -0,0 +1,80 @@ +Name: libpng +Epoch: 2 +Version: 1.6.36 +Release: 2 +Summary: A library of functions for manipulating PNG image format files +License: zlib +URL: http://www.libpng.org/pub/png/libpng.html +Source0: https://github.com/glennrp/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz +Source1: pngusr.dfa + +Patch0: libpng-multilib.patch +Patch1: libpng-fix-arm-neon.patch +Patch2: libpng-CVE-2019-7317.patch + +BuildRequires: zlib-devel autoconf automake libtool +Provides: libpng-tools +Obsoletes: libpng-tools + +%description +The libpng package contains libraries used by other programs for reading and writing PNG format files. +The PNG format was designed as a replacement for GIF and, to a lesser extent, TIFF, +with many improvements and extensions and lack of patent problems. + +%package devel +Summary: Development files for libpng +Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release} zlib-devel%{?_isa} pkgconfig%{?_isa} + +Provides: libpng-static +Obsoletes: libpng-static + +%description devel +The libpng-devel package contains libraries and header files for developing +applications that using the PNG library. + +%package help +Summary: Help documents for libpng + +%description help +This package contain the license files and help documents for libpng. + +%prep +%autosetup -n %{name}-%{version} -p1 +cp -p %{SOURCE1} . + +%build +autoreconf -vif +%configure +%make_build DFA_XTRA=pngusr.dfa + +%install +%make_install +rm -f %{buildroot}%{_libdir}/*.la + +%check +%if %{?_with_check:1}%{!?_with_check:0} +make check +%endif + +%ldconfig_post +%ldconfig_postun + +%files +%{!?_licensedir:%global license %%doc} +%license LICENSE +%{_libdir}/libpng16.so.* + +%files devel +%{_bindir}/* +%{_includedir}/* +%{_libdir}/libpng*.so +%{_libdir}/libpng*.a +%{_libdir}/pkgconfig/libpng*.pc + +%files help +%doc libpng-manual.txt example.c TODO CHANGES +%{_mandir}/man*/* + +%changelog +* Wed Sep 18 2019 chenzhenyu - 1.6.36-2 +- Package init diff --git a/pngusr.dfa b/pngusr.dfa new file mode 100644 index 0000000..02e484d --- /dev/null +++ b/pngusr.dfa @@ -0,0 +1,4 @@ +# However, the default defaults seem a tad too restrictive for general +# purpose use, so back them off a little. +setting USER_CHUNK_CACHE_MAX default 1000 +setting USER_CHUNK_MALLOC_MAX default 1000000000