From dc36a804304128adc7ec742cac89f4f4e23ba468 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 23 May 2007 21:02:52 +0000 Subject: [PATCH] Add patch to fix CVE-2007-2445 --- libpng-trns-bug.patch | 19 +++++++++++++++++++ libpng.spec | 8 +++++++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 libpng-trns-bug.patch diff --git a/libpng-trns-bug.patch b/libpng-trns-bug.patch new file mode 100644 index 0000000..b9e6dfd --- /dev/null +++ b/libpng-trns-bug.patch @@ -0,0 +1,19 @@ +Fix for CVE-2007-2445 --- libpng crashes if CRC error is detected in +a grayscale tRNS chunk, because png_handle_tRNS leaves inconsistent state +which eventually leads to attempting to free() unallocated memory. + + +diff -Naur libpng-1.2.16.orig/pngrutil.c libpng-1.2.16/pngrutil.c +--- libpng-1.2.16.orig/pngrutil.c 2007-01-31 08:22:35.000000000 -0500 ++++ libpng-1.2.16/pngrutil.c 2007-05-12 17:07:41.000000000 -0400 +@@ -1314,7 +1314,10 @@ + } + + if (png_crc_finish(png_ptr, 0)) ++ { ++ png_ptr->num_trans = 0; + return; ++ } + + png_set_tRNS(png_ptr, info_ptr, readbuf, png_ptr->num_trans, + &(png_ptr->trans_values)); diff --git a/libpng.spec b/libpng.spec index e7fddaa..2a72fe8 100644 --- a/libpng.spec +++ b/libpng.spec @@ -2,7 +2,7 @@ Summary: A library of functions for manipulating PNG image format files Name: libpng Epoch: 2 Version: 1.2.16 -Release: 1%{?dist} +Release: 2%{?dist} License: BSD Group: System Environment/Libraries URL: http://www.libpng.org/pub/png/ @@ -10,6 +10,7 @@ URL: http://www.libpng.org/pub/png/ Source: ftp://ftp.simplesystems.org/pub/png/src/libpng-%{version}.tar.bz2 Patch0: libpng-multilib.patch Patch1: libpng-pngconf.patch +Patch2: libpng-trns-bug.patch Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: zlib-devel @@ -53,6 +54,7 @@ necessary for some boot packages. %patch0 -p1 %patch1 -p1 +%patch2 -p1 %build %configure @@ -91,6 +93,10 @@ rm -rf $RPM_BUILD_ROOT%{_libdir}/libpng12.la rm -rf $RPM_BUILD_ROOT %changelog +* Wed May 23 2007 Tom Lane 2:1.2.16-2 +- Add patch to fix CVE-2007-2445 +Related: #239542 + * Mon Feb 12 2007 Tom Lane 2:1.2.16-1 - Update to libpng 1.2.16 Resolves: #211705, #216706, #227334