From b593632bc58a4355d1a21e8b1c3dbb8151e7be7d Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 6 Nov 2012 16:43:50 -0800 Subject: [PATCH] add packaging --- packaging/baselibs.conf | 6 ++ packaging/tiff-4.0.2-CVE-2012-3401.patch | 12 +++ packaging/tiff-4.0.2-dont-fancy-upsampling.patch | 11 +++ packaging/tiff-4.0.2-seek.patch | 13 ++++ packaging/tiff-4.0.2-tiff2pdf-colors.patch | 12 +++ packaging/tiff-bigendian.patch | 15 ++++ packaging/tiff.spec | 95 ++++++++++++++++++++++++ 7 files changed, 164 insertions(+) create mode 100644 packaging/baselibs.conf create mode 100644 packaging/tiff-4.0.2-CVE-2012-3401.patch create mode 100644 packaging/tiff-4.0.2-dont-fancy-upsampling.patch create mode 100644 packaging/tiff-4.0.2-seek.patch create mode 100644 packaging/tiff-4.0.2-tiff2pdf-colors.patch create mode 100644 packaging/tiff-bigendian.patch create mode 100644 packaging/tiff.spec diff --git a/packaging/baselibs.conf b/packaging/baselibs.conf new file mode 100644 index 0000000..dbe909a --- /dev/null +++ b/packaging/baselibs.conf @@ -0,0 +1,6 @@ +libtiff5 + obsoletes "libtiff- <= " + provides "libtiff- = " +libtiff-devel + requires -libtiff- + requires "libtiff5- = " diff --git a/packaging/tiff-4.0.2-CVE-2012-3401.patch b/packaging/tiff-4.0.2-CVE-2012-3401.patch new file mode 100644 index 0000000..c8f7642 --- /dev/null +++ b/packaging/tiff-4.0.2-CVE-2012-3401.patch @@ -0,0 +1,12 @@ +Index: tools/tiff2pdf.c +=================================================================== +--- tools/tiff2pdf.c.orig ++++ tools/tiff2pdf.c +@@ -1066,6 +1066,7 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* + "Can't set directory %u of input file %s", + i, + TIFFFileName(input)); ++ t2p->t2p_error = T2P_ERR_ERROR; + return; + } + if(TIFFGetField(input, TIFFTAG_PAGENUMBER, &pagen, &paged)){ diff --git a/packaging/tiff-4.0.2-dont-fancy-upsampling.patch b/packaging/tiff-4.0.2-dont-fancy-upsampling.patch new file mode 100644 index 0000000..62110f3 --- /dev/null +++ b/packaging/tiff-4.0.2-dont-fancy-upsampling.patch @@ -0,0 +1,11 @@ +diff -urN tiff-4.0.1.orig/libtiff/tif_jpeg.c tiff-4.0.1/libtiff/tif_jpeg.c +--- tiff-4.0.1.orig/libtiff/tif_jpeg.c 2012-03-29 01:03:15.680848289 +0800 ++++ tiff-4.0.1/libtiff/tif_jpeg.c 2012-03-29 01:09:09.212428534 +0800 +@@ -1175,6 +1175,7 @@ + if (downsampled_output) { + /* Need to use raw-data interface to libjpeg */ + sp->cinfo.d.raw_data_out = TRUE; ++ sp->cinfo.d.do_fancy_upsampling = FALSE; + tif->tif_decoderow = DecodeRowError; + tif->tif_decodestrip = JPEGDecodeRaw; + tif->tif_decodetile = JPEGDecodeRaw; diff --git a/packaging/tiff-4.0.2-seek.patch b/packaging/tiff-4.0.2-seek.patch new file mode 100644 index 0000000..db3e239 --- /dev/null +++ b/packaging/tiff-4.0.2-seek.patch @@ -0,0 +1,13 @@ +Index: tiff-4.0.1/libtiff/tiffiop.h +=================================================================== +--- tiff-4.0.1.orig/libtiff/tiffiop.h ++++ tiff-4.0.1/libtiff/tiffiop.h +@@ -213,7 +213,7 @@ struct tiff { + #define TIFFWriteFile(tif, buf, size) \ + ((*(tif)->tif_writeproc)((tif)->tif_clientdata,(buf),(size))) + #define TIFFSeekFile(tif, off, whence) \ +- ((*(tif)->tif_seekproc)((tif)->tif_clientdata,(off),(whence))) ++ ((tif)->tif_seekproc?((*(tif)->tif_seekproc)((tif)->tif_clientdata,(toff_t)(off),whence)):0) + #define TIFFCloseFile(tif) \ + ((*(tif)->tif_closeproc)((tif)->tif_clientdata)) + #define TIFFGetFileSize(tif) \ diff --git a/packaging/tiff-4.0.2-tiff2pdf-colors.patch b/packaging/tiff-4.0.2-tiff2pdf-colors.patch new file mode 100644 index 0000000..62f61d6 --- /dev/null +++ b/packaging/tiff-4.0.2-tiff2pdf-colors.patch @@ -0,0 +1,12 @@ +diff -urN tiff-4.0.1.orig/tools/tiff2pdf.c tiff-4.0.1/tools/tiff2pdf.c +--- tiff-4.0.1.orig/tools/tiff2pdf.c 2012-03-29 01:03:15.656848587 +0800 ++++ tiff-4.0.1/tools/tiff2pdf.c 2012-03-29 01:03:27.591699381 +0800 +@@ -4991,7 +4991,7 @@ + + if(t2p->tiff_photometric != PHOTOMETRIC_YCBCR) { + written += t2pWriteFile(output, (tdata_t) "/DecodeParms ", 13); +- written += t2pWriteFile(output, (tdata_t) "<< /ColorTransform 0 >>\n", 24); ++ written += t2pWriteFile(output, (tdata_t) "<< /ColorTransform 1 >>\n", 24); + } + break; + #endif diff --git a/packaging/tiff-bigendian.patch b/packaging/tiff-bigendian.patch new file mode 100644 index 0000000..68fc87a --- /dev/null +++ b/packaging/tiff-bigendian.patch @@ -0,0 +1,15 @@ +--- tiff-4.0.2/test/raw_decode.c.xx 2012-06-28 11:48:43.000000000 +0200 ++++ tiff-4.0.2/test/raw_decode.c 2012-06-28 12:15:46.000000000 +0200 +@@ -85,9 +85,9 @@ + static int check_rgba_pixel( int pixel, int red, int green, int blue, int alpha, unsigned char *buffer ) { + /* RGBA images are upside down - adjust for normal ordering */ + int adjusted_pixel = pixel % 128 + (127 - (pixel/128)) * 128; +- unsigned char *rgba = buffer + 4 * adjusted_pixel; +- +- if( rgba[0] == red && rgba[1] == green && rgba[2] == blue && rgba[3] == alpha ) { ++ unsigned int *rgba = (unsigned int*)(buffer + 4 * adjusted_pixel); ++ ++ if( TIFFGetR(*rgba) == red && TIFFGetG(*rgba) == green && TIFFGetB(*rgba) == blue && TIFFGetA(*rgba) == alpha ) { + return 0; + } + diff --git a/packaging/tiff.spec b/packaging/tiff.spec new file mode 100644 index 0000000..15bad59 --- /dev/null +++ b/packaging/tiff.spec @@ -0,0 +1,95 @@ +Name: tiff +#BuildRequires: libjbig-devel +Version: 4.0.2 +Release: 0 +License: HPND +Summary: Tools for Converting from and to the Tiff Format +Url: http://www.remotesensing.org/libtiff +Group: Productivity/Graphics/Convertors +Source: tiff-%{version}.tar.bz2 +Source3: baselibs.conf +Patch2: tiff-%{version}-seek.patch +Patch3: tiff-%{version}-tiff2pdf-colors.patch +Patch9: tiff-%{version}-dont-fancy-upsampling.patch +Patch10: tiff-bigendian.patch +Patch11: tiff-%{version}-CVE-2012-3401.patch +BuildRequires: gcc-c++ +BuildRequires: libjpeg8-devel +BuildRequires: libtool +BuildRequires: lzma-devel +BuildRequires: pkg-config +BuildRequires: pkgconfig(zlib) +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%description +This package contains the library and support programs for the TIFF +image format. + +%package -n libtiff +Summary: The Tiff Library (with JPEG and compression support) +Group: System/Libraries + +%description -n libtiff +This package includes the tiff libraries. To link a program with +libtiff, you will have to add -ljpeg and -lz to include the necessary +libjpeg and libz in the linking process. + +%package -n libtiff-devel +Summary: Development Tools for Programs which will use the libtiff Library +Group: Development/Libraries/C and C++ +Requires: glibc-devel +Requires: libstdc++-devel +Requires: libtiff = %{version} + +%description -n libtiff-devel +This package contains the header files and static libraries for +developing programs which will manipulate TIFF format image files using +the libtiff library. + +%prep +%setup -q +%patch2 -p1 +%patch3 -p1 +%patch9 -p1 +%patch10 -p1 +%patch11 + +%build +%configure --disable-static --with-pic +make %{?_smp_mflags} + +%install +mkdir -p %{buildroot}/{%{_mandir}/{man1,man3},usr/{bin,lib,include}} +%make_install +for f in `find %{buildroot}/%{_mandir} -type f -print ` ; do + if [ `wc -l <$f` -eq 1 ] && grep -q "^\.so " $f ; then + linkto=`sed -e "s|^\.so ||" $f` + [ -f "`dirname $f`/$linkto" ] && ln -sf "$linkto" $f + fi +done + +rm -rf %{buildroot}%{_datadir}/doc/tiff* +rm -f %{buildroot}/%{_libdir}/*.la +find html -name "Makefile*" | xargs rm + + +%docs_package + +%post -n libtiff -p /sbin/ldconfig + +%postun -n libtiff -p /sbin/ldconfig + +%files +%defattr(-,root,root) +%{_bindir}/* + +%files -n libtiff +%doc COPYRIGHT +%{_libdir}/*.so.* + +%files -n libtiff-devel +%{_includedir}/* +%{_libdir}/*.so +%{_libdir}/pkgconfig/*.pc + +%changelog -- 2.7.4