Accepting request 159787 from home:pgajdos:libpng16
- allow zero length PLTE chunks (fixes GraphicsMagick testsuite) OBS-URL: https://build.opensuse.org/request/show/159787 OBS-URL: https://build.opensuse.org/package/show/graphics/libpng16?expand=0&rev=21
This commit is contained in:
parent
1ea63dd29f
commit
b47f310c18
@ -0,0 +1,57 @@
|
||||
http://sourceforge.net/mailarchive/forum.php?thread_name=20130219075910.GK27522%40danbala.tuwien.ac.at&forum_name=png-mng-implement
|
||||
|
||||
From 9ee585718b346d32767015152a728106922b49d1 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <9ee585718b346d32767015152a728106922b49d1.1361241956.git.jbowler@acm.org>
|
||||
From: John Bowler <jbowler@acm.org>
|
||||
Date: Mon, 18 Feb 2013 18:44:14 -0800
|
||||
Subject: [libpng16] Reenable code to allow zero length PLTE chunks for MNG
|
||||
support.
|
||||
|
||||
Signed-off-by: John Bowler <jbowler@acm.org>
|
||||
---
|
||||
pngset.c | 16 ++++++++++++++--
|
||||
1 file changed, 14 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/pngset.c b/pngset.c
|
||||
index ac39a44..f89861e 100644
|
||||
--- a/pngset.c
|
||||
+++ b/pngset.c
|
||||
@@ -514,7 +514,7 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
|
||||
|
||||
png_debug1(1, "in %s storage function", "PLTE");
|
||||
|
||||
- if (png_ptr == NULL || info_ptr == NULL || palette == NULL)
|
||||
+ if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
if (num_palette < 0 || num_palette > PNG_MAX_PALETTE_LENGTH)
|
||||
@@ -529,6 +529,17 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
+ if ((num_palette > 0 && palette == NULL) ||
|
||||
+ (num_palette == 0
|
||||
+# ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
+ && (png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) == 0
|
||||
+# endif
|
||||
+ ))
|
||||
+ {
|
||||
+ png_chunk_report(png_ptr, "Invalid palette", PNG_CHUNK_ERROR);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
/* It may not actually be necessary to set png_ptr->palette here;
|
||||
* we do it for backward compatibility with the way the png_handle_tRNS
|
||||
* function used to do the allocation.
|
||||
@@ -545,7 +556,8 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
|
||||
png_ptr->palette = png_voidcast(png_colorp, png_calloc(png_ptr,
|
||||
PNG_MAX_PALETTE_LENGTH * (sizeof (png_color))));
|
||||
|
||||
- memcpy(png_ptr->palette, palette, num_palette * (sizeof (png_color)));
|
||||
+ if (num_palette > 0)
|
||||
+ memcpy(png_ptr->palette, palette, num_palette * (sizeof (png_color)));
|
||||
info_ptr->palette = png_ptr->palette;
|
||||
info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
|
||||
|
||||
--
|
||||
1.8.1.2
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Mar 18 11:44:21 UTC 2013 - pgajdos@suse.com
|
||||
|
||||
- allow zero length PLTE chunks
|
||||
(fixes GraphicsMagick testsuite)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Mar 4 07:50:46 UTC 2013 - pgajdos@suse.com
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package libpng16
|
||||
#
|
||||
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -32,6 +32,8 @@ License: Zlib
|
||||
Group: System/Libraries
|
||||
Source: libpng-%{version}.tar.bz2
|
||||
Source2: baselibs.conf
|
||||
# will be upstreamed in 1.6.1
|
||||
Patch0: libpng16-0387-Reenable-code-to-allow-zero-length-PLTE-chunks-for-M.patch
|
||||
BuildRequires: libtool
|
||||
BuildRequires: pkg-config
|
||||
BuildRequires: zlib-devel
|
||||
@ -53,7 +55,10 @@ Provides: libpng = %{version}-%{release}
|
||||
%package devel
|
||||
Summary: Development Tools for applications which will use the Libpng
|
||||
Group: Development/Libraries/C and C++
|
||||
Requires: zlib-devel glibc-devel %{libname} = %{version} pkg-config
|
||||
Requires: %{libname} = %{version}
|
||||
Requires: glibc-devel
|
||||
Requires: pkg-config
|
||||
Requires: zlib-devel
|
||||
Recommends: libpng%{branch}-compat-devel
|
||||
# bug437293
|
||||
%ifarch ppc64
|
||||
@ -93,6 +98,7 @@ about libpng version.
|
||||
|
||||
%prep
|
||||
%setup -n libpng-%{version}
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
# We'll never use the old pgcc-2.95.1 with the buggy -O3, so having
|
||||
|
Loading…
Reference in New Issue
Block a user