Author: goetz
Date: Wed Nov 22 17:26:07 2006
New Revision: 86242
Added:
packages/cooker/libwmf/current/SOURCES/libwmf-0.2.7-libwmf-config.patch
packages/cooker/libwmf/current/SOURCES/libwmf-0.2.8.3-CAN-2004-0941.patch
packages/cooker/libwmf/current/SOURCES/libwmf-0.2.8.3-CAN-2004-0990.patch
packages/cooker/libwmf/current/SOURCES/libwmf-0.2.8.4-intoverflow.patch
Modified:
packages/cooker/libwmf/current/SPECS/libwmf.spec
Log:
- unpack patches
- fix postun script
- move gtk loader do the library package
Added: packages/cooker/libwmf/current/SOURCES/libwmf-0.2.7-libwmf-config.patch
==============================================================================
--- (empty file)
+++ packages/cooker/libwmf/current/SOURCES/libwmf-0.2.7-libwmf-config.patch
Wed Nov 22 17:26:07 2006
@@ -0,0 +1,19 @@
+--- libwmf-0.2.7/libwmf-config.in.fpons 2002-06-18 08:58:31.000000000
+0200
++++ libwmf-0.2.7/libwmf-config.in 2002-10-31 15:09:11.000000000 +0100
+@@ -95,9 +95,6 @@
+ if test "$lib_gd" = "yes"; then
+ includes="$includes [EMAIL PROTECTED]@/libwmf/gd"
+ fi
+- if test "$lib_wmf" = "yes"; then
+- includes="$includes [EMAIL PROTECTED]@"
+- fi
+ echo $includes
+ fi
+
+@@ -114,5 +111,5 @@
+ fi
+ done
+
+- echo $libdirs $my_wmf_libs
++ echo $my_wmf_libs
+ fi
Added: packages/cooker/libwmf/current/SOURCES/libwmf-0.2.8.3-CAN-2004-0941.patch
==============================================================================
--- (empty file)
+++ packages/cooker/libwmf/current/SOURCES/libwmf-0.2.8.3-CAN-2004-0941.patch
Wed Nov 22 17:26:07 2006
@@ -0,0 +1,142 @@
+--- libwmf-0.2.8.3/src/extra/gd/gd_security.c.can-2004-0941 2006-06-29
06:59:12.287496990 -0600
++++ libwmf-0.2.8.3/src/extra/gd/gd_security.c 2006-06-29 06:59:12.287496990
-0600
+@@ -0,0 +1,29 @@
++/*
++ * gd_security.c
++ *
++ * Implements buffer overflow check routines.
++ *
++ * Written 2004, Phil Knirsch.
++ * Based on netpbm fixes by Alan Cox.
++ *
++ */
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <limits.h>
++#include "gd.h"
++
++int overflow2(int a, int b)
++{
++ if(a < 0 || b < 0) {
++ fprintf(stderr, "gd warning: one parameter to a memory
allocation multiplication is negative, failing operation gracefully\n");
++ return 1;
++ }
++ if(b == 0)
++ return 0;
++ if(a > INT_MAX / b) {
++ fprintf(stderr, "gd warning: product of memory allocation
multiplication would exceed INT_MAX, failing operation gracefully\n");
++ return 1;
++ }
++ return 0;
++}
+--- libwmf-0.2.8.3/src/extra/gd/wbmp.c.can-2004-0941 2001-05-19
07:09:34.000000000 -0600
++++ libwmf-0.2.8.3/src/extra/gd/wbmp.c 2006-06-29 06:59:12.287496990 -0600
+@@ -116,6 +116,14 @@ createwbmp (int width, int height, int c
+ if ((wbmp = (Wbmp *) gdMalloc (sizeof (Wbmp))) == NULL)
+ return (NULL);
+
++ if (overflow2(sizeof (int), width)) {
++ gdFree(wbmp);
++ return (NULL);
++ }
++ if (overflow2(sizeof (int) * width, height)) {
++ gdFree(wbmp);
++ return (NULL);
++ }
+ if ((wbmp->bitmap = (int *) gdMalloc (sizeof (int) * width * height)) ==
NULL)
+ {
+ gdFree (wbmp);
+@@ -176,6 +184,12 @@ readwbmp (int (*getin) (void *in), void
+ printf ("W: %d, H: %d\n", wbmp->width, wbmp->height);
+ #endif
+
++ if (overflow2(sizeof (int), wbmp->width) ||
++ overflow2(sizeof (int) * wbmp->width, wbmp->height))
++ {
++ gdFree(wbmp);
++ return (-1);
++ }
+ if ((wbmp->bitmap = (int *) gdMalloc (sizeof (int) * wbmp->width *
wbmp->height)) == NULL)
+ {
+ gdFree (wbmp);
+--- libwmf-0.2.8.3/src/extra/gd/gd_topal.c.can-2004-0941 2001-05-19
07:09:34.000000000 -0600
++++ libwmf-0.2.8.3/src/extra/gd/gd_topal.c 2006-06-29 06:59:12.288496809
-0600
+@@ -669,6 +669,9 @@ select_colors (gdImagePtr im, my_cquanti
+ int i;
+
+ /* Allocate workspace for box list */
++ if (overflow2(desired_colors, sizeof (box))) {
++ return;
++ }
+ boxlist = (boxptr) gdMalloc (desired_colors * sizeof (box));
+ /* Initialize one box containing whole space */
+ numboxes = 1;
+--- libwmf-0.2.8.3/src/extra/gd/gd_io_dp.c.can-2004-0941 2001-05-19
07:09:34.000000000 -0600
++++ libwmf-0.2.8.3/src/extra/gd/gd_io_dp.c 2006-06-29 06:59:12.288496809
-0600
+@@ -185,6 +185,9 @@ dynamicSeek (struct gdIOCtx *ctx, const
+ bytesNeeded = pos;
+ if (bytesNeeded > dp->realSize)
+ {
++ if (overflow2(dp->realSize, 2)) {
++ return FALSE;
++ }
+ if (!gdReallocDynamic (dp, dp->realSize * 2))
+ {
+ dp->dataGood = FALSE;
+@@ -356,6 +359,9 @@ appendDynamic (dynamicPtr * dp, const vo
+
+ if (bytesNeeded > dp->realSize)
+ {
++ if (overflow2(dp->realSize, 2)) {
++ return FALSE;
++ }
+ if (!gdReallocDynamic (dp, bytesNeeded * 2))
+ {
+ dp->dataGood = FALSE;
+--- libwmf-0.2.8.3/src/extra/gd/Makefile.am.can-2004-0941 2006-06-29
07:06:37.525017191 -0600
++++ libwmf-0.2.8.3/src/extra/gd/Makefile.am 2006-06-29 07:07:12.413710434
-0600
+@@ -22,7 +22,7 @@ libgd_la_SOURCES = gd.c gd_gd.c gd_gd2.c
+ gd_io_file.c gd_ss.c gd_io_ss.c gd_png.c gd_jpeg.c gdxpm.c \
+ gdfontt.c gdfonts.c gdfontmb.c gdfontl.c gdfontg.c \
+ gdtables.c gdft.c gdcache.c gdkanji.c wbmp.c \
+- gd_wbmp.c gdhelpers.c gd_topal.c gd_clip.c
++ gd_wbmp.c gdhelpers.c gd_topal.c gd_clip.c gd_security.c
+
+ gddir = $(includedir)/libwmf/gd
+
+--- libwmf-0.2.8.3/src/extra/gd/gd.c.can-2004-0941 2002-12-05
13:09:11.000000000 -0700
++++ libwmf-0.2.8.3/src/extra/gd/gd.c 2006-06-29 06:59:12.289496628 -0600
+@@ -1865,6 +1865,12 @@ gdImageCopyResized (gdImagePtr dst, gdIm
+ int *sty;
+ /* We only need to use floating point to determine the correct
+ stretch vector for one line's worth. */
++ if (overflow2(sizeof (int), srcW)) {
++ return;
++ }
++ if (overflow2(sizeof (int), srcH)) {
++ return;
++ }
+ double accum;
+ stx = (int *) gdMalloc (sizeof (int) * srcW);
+ sty = (int *) gdMalloc (sizeof (int) * srcH);
+@@ -2277,6 +2283,9 @@ gdImageFilledPolygon (gdImagePtr im, gdP
+ }
+ if (!im->polyAllocated)
+ {
++ if (overflow2(sizeof (int), n)) {
++ return;
++ }
+ im->polyInts = (int *) gdMalloc (sizeof (int) * n);
+ im->polyAllocated = n;
+ }
+@@ -2371,6 +2380,9 @@ gdImageSetStyle (gdImagePtr im, int *sty
+ {
+ gdFree (im->style);
+ }
++ if (overflow2(sizeof (int), noOfPixels)) {
++ return;
++ }
+ im->style = (int *)
+ gdMalloc (sizeof (int) * noOfPixels);
+ memcpy (im->style, style, sizeof (int) * noOfPixels);
Added: packages/cooker/libwmf/current/SOURCES/libwmf-0.2.8.3-CAN-2004-0990.patch
==============================================================================
--- (empty file)
+++ packages/cooker/libwmf/current/SOURCES/libwmf-0.2.8.3-CAN-2004-0990.patch
Wed Nov 22 17:26:07 2006
@@ -0,0 +1,17 @@
+--- libwmf-0.2.8.3/src/extra/gd/gd_png.c.can-2004-0990 2001-05-19
07:09:34.000000000 -0600
++++ libwmf-0.2.8.3/src/extra/gd/gd_png.c 2006-06-29 06:08:34.961119463
-0600
+@@ -181,6 +181,14 @@ gdImageCreateFromPngCtx (gdIOCtx * infil
+
+ png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
+ &interlace_type, NULL, NULL);
++ if (overflow2(sizeof (int), width))
++ {
++ return NULL;
++ }
++ if (overflow2(sizeof (int) * width, height))
++ {
++ return NULL;
++ }
+ if ((color_type == PNG_COLOR_TYPE_RGB) ||
+ (color_type == PNG_COLOR_TYPE_RGB_ALPHA))
+ {
Added: packages/cooker/libwmf/current/SOURCES/libwmf-0.2.8.4-intoverflow.patch
==============================================================================
--- (empty file)
+++ packages/cooker/libwmf/current/SOURCES/libwmf-0.2.8.4-intoverflow.patch
Wed Nov 22 17:26:07 2006
@@ -0,0 +1,27 @@
+--- libwmf-0.2.8.4.orig/src/player.c 2002-12-10 19:30:26.000000000 +0000
++++ libwmf-0.2.8.4/src/player.c 2006-07-12 15:12:52.000000000 +0100
+@@ -42,6 +42,7 @@
+ #include "player/defaults.h" /* Provides: default settings */
+ #include "player/record.h" /* Provides: parameter mechanism */
+ #include "player/meta.h" /* Provides: record interpreters */
++#include <stdint.h>
+
+ /**
+ * @internal
+@@ -132,8 +134,14 @@
+ }
+ }
+
+-/* P->Parameters = (unsigned char*) wmf_malloc (API,(MAX_REC_SIZE(API)-3)
* 2 * sizeof (unsigned char));
+- */ P->Parameters = (unsigned char*) wmf_malloc (API,(MAX_REC_SIZE(API) )
* 2 * sizeof (unsigned char));
++ if (MAX_REC_SIZE(API) > SIZE_MAX / 2)
++ {
++ API->err = wmf_E_InsMem;
++ WMF_DEBUG (API,"bailing...");
++ return (API->err);
++ }
++
++ P->Parameters = (unsigned char*) wmf_malloc (API,(MAX_REC_SIZE(API) )
* 2);
+
+ if (ERR (API))
+ { WMF_DEBUG (API,"bailing...");
Modified: packages/cooker/libwmf/current/SPECS/libwmf.spec
==============================================================================
--- packages/cooker/libwmf/current/SPECS/libwmf.spec (original)
+++ packages/cooker/libwmf/current/SPECS/libwmf.spec Wed Nov 22 17:26:07 2006
@@ -1,8 +1,9 @@
%define name libwmf
%define version 0.2.8.4
-%define major 0.2_7
-%define release %mkrel 7
-%define libname %mklibname wmf %major
+%define api 0.2
+%define major 7
+%define release %mkrel 8
+%define libname %mklibname wmf%{api}_ %major
Summary: A library to convert wmf files
Name: %{name}
@@ -18,16 +19,12 @@
BuildRequires: libjpeg-devel
BuildRequires: libx11-devel
BuildRequires: libice-devel
-# we should probably split this package b/c of this:
-Requires(post): %{libname}
-Requires(post): gtk+2.0
-Requires(postun): gtk+2.0
URL: http://sourceforge.net/projects/wvware/
Source:
http://download.sourceforge.net/wvware/%{name}-%{version}.tar.bz2
-Patch: libwmf-0.2.7-libwmf-config.patch.bz2
-Patch1: libwmf-0.2.8.3-CAN-2004-0941.patch.bz2
-Patch2: libwmf-0.2.8.3-CAN-2004-0990.patch.bz2
-Patch3: libwmf-0.2.8.4-intoverflow.patch.bz2
+Patch: libwmf-0.2.7-libwmf-config.patch
+Patch1: libwmf-0.2.8.3-CAN-2004-0941.patch
+Patch2: libwmf-0.2.8.3-CAN-2004-0990.patch
+Patch3: libwmf-0.2.8.4-intoverflow.patch
BuildRoot: %{_tmppath}/%{name}-buildroot
%description
@@ -39,7 +36,9 @@
%package -n %libname
Summary: A library to convert wmf files. - library files
Group: System/Libraries
-Requires: urw-fonts libwmf = %{version}
+Requires: urw-fonts
+Requires(post): gtk+2.0
+Requires(postun): gtk+2.0
%description -n %libname
This package contains the library needed to run programs dynamically
@@ -81,14 +80,13 @@
make
%install
-rm -rf $RPM_BUILD_ROOT
+rm -rf $RPM_BUILD_ROOT installed-docs
make install DESTDIR=$RPM_BUILD_ROOT
-mkdir -p $RPM_BUILD_ROOT%{_docdir}
-mv $RPM_BUILD_ROOT%{_prefix}/share/doc/*
$RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
-cp COPYING CREDITS README NEWS $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
+mv $RPM_BUILD_ROOT%{_prefix}/share/doc/* installed-docs
+
#gw no windows line endings
-perl -pi -e 's/\r//' $(find $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version} -type
f )
+perl -pi -e 's/\r//' $(find installed-docs -type f )
# remove anything relevant to fonts.
rm -rf $RPM_BUILD_ROOT%{_bindir}/libwmf-fontmap
$RPM_BUILD_ROOT%{_datadir}/libwmf
@@ -101,43 +99,40 @@
%clean
rm -rf $RPM_BUILD_ROOT
-%post -n %libname -p /sbin/ldconfig
-
-%postun -n %libname -p /sbin/ldconfig
-
-%post
+%post -n %libname
+/sbin/ldconfig
%_bindir/gdk-pixbuf-query-loaders %_lib >
%{_sysconfdir}/gtk-2.0/gdk-pixbuf.loaders.%_lib
-%postun
-if [-x %_bindir/gdk-pixbuf-query-loaders ]; then
+%postun -n %libname
+/sbin/ldconfig
+if [ -x %_bindir/gdk-pixbuf-query-loaders ]; then
%_bindir/gdk-pixbuf-query-loaders %_lib >
%{_sysconfdir}/gtk-2.0/gdk-pixbuf.loaders.%_lib
fi
%files
# beware not to take gd files here!
%defattr(-,root,root)
-%docdir %{_docdir}/%{name}-%{version}
-%{_docdir}/%{name}-%{version}
+%docdir COPYING
%{_bindir}/wmf2*
-%{_libdir}/gtk-*
%files -n %libname
# beware not to take gd files here!
%defattr(-,root,root)
%doc COPYING
-%{_libdir}/libwmf-*so*
-%{_libdir}/libwmflite-*so*
+%{_libdir}/libwmf*-%{api}.so.%{major}*
+%_libdir/gtk-2.0/*/loaders/io-wmf.so
+%_libdir/gtk-2.0/*/loaders/io-wmf.la
%files -n %libname-devel
# beware not to take gd files here!
%defattr(-,root,root)
-%doc ChangeLog COPYING
+%doc COPYING CREDITS README NEWS
+%doc installed-docs/*
+%doc ChangeLog
%{_bindir}/libwmf-config
%multiarch %{multiarch_bindir}/libwmf-config
%{_libdir}/libwmf.la
%{_libdir}/libwmf.so
-#%{_libdir}/libwmf.a
%{_libdir}/libwmflite.la
%{_libdir}/libwmflite.so
-#%{_libdir}/libwmflite.a
%{_includedir}/libwmf