SHA256
6
0
forked from pool/wv

Accepting request 202663 from devel:libraries:c_c++

- Fix Source URL 

- Update to 1.2.4 (no changelog available)
  * bump soname to libwv-1.2.so.3
- Dropped wv-1.2.2-overflow.patch, fixed upstream
- Reformat spec file, added Source url and URL, use  more macros
  and use pkgconfig() based BuildRequires

OBS-URL: https://build.opensuse.org/request/show/202663
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/wv?expand=0&rev=19
This commit is contained in:
Tomáš Chvátal 2013-10-09 12:19:20 +00:00 committed by Git OBS Bridge
commit ba4fd41fac
4 changed files with 65 additions and 121 deletions

View File

@ -1,70 +0,0 @@
Index: lfo.c
===================================================================
--- lfo.c.orig
+++ lfo.c
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include <limits.h>
#include "wv.h"
/*
@@ -32,6 +33,16 @@ one has (LFO.clfolvl), and writes out, i
followed by its corresponding LVL structure (if LFOLVL.fFormatting is set).
*/
+static int
+multiplication_will_overflow(U32 a, U32 b)
+{
+ if((a > 0) && (b > 0) && (UINT_MAX / a) >= b) {
+ return 0;
+ }
+
+ return 1;
+}
+
int
wvGetLFO_records (LFO ** lfo, LFOLVL ** lfolvl, LVL ** lvl, U32 * nolfo,
U32 * nooflvl, U32 offset, U32 len, wvStream * fd)
@@ -49,7 +60,9 @@ wvGetLFO_records (LFO ** lfo, LFOLVL **
wvTrace (("pos %x %d\n", wvStream_tell (fd), *nooflvl));
wvTrace (("nolfo is %d nooflvl is %d\n", *nolfo, *nooflvl));
- if (*nooflvl == 0)
+ if ((*nooflvl == 0) ||
+ multiplication_will_overflow(sizeof (LFOLVL), *nooflvl) ||
+ multiplication_will_overflow(sizeof (LVL), *nooflvl))
{
*lfolvl = NULL;
*lvl = NULL;
@@ -101,16 +114,22 @@ wvGetLFO_PLF (LFO ** lfo, U32 * nolfo, U
*nolfo = read_32ubit (fd);
wvTrace (("%d\n", *nolfo));
- *lfo = (LFO *) wvMalloc (*nolfo * sizeof (LFO));
- if (*lfo == NULL)
- {
- wvError (
- ("NO MEM 1, failed to alloc %d bytes\n",
+ /* check for integer overflow */
+ if (multiplication_will_overflow(*nolfo, sizeof(LFO))) {
+ wvError (("Malicious document!\n"));
+ *nolfo = 0;
+ return (1);
+ } else {
+ *lfo = (LFO *) wvMalloc (*nolfo * sizeof(LFO));
+ if (*lfo == NULL)
+ {
+ wvError (("NO MEM 1, failed to alloc %d bytes\n",
*nolfo * sizeof (LFO)));
return (1);
- }
- for (i = 0; i < *nolfo; i++)
+ }
+ for (i = 0; i < *nolfo; i++)
wvGetLFO (&((*lfo)[i]), fd);
+ }
}
return (0);
}

3
wv-1.2.4.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:673109910e22d4cf94cc8be4dcb9a0c41b5fbdb1736d4b7bdc7778894d57c2d6
size 629554

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Tue Oct 8 09:45:30 UTC 2013 - mvyskocil@suse.com
- Fix Source URL
-------------------------------------------------------------------
Fri Oct 4 09:52:08 UTC 2013 - mvyskocil@suse.com
- Update to 1.2.4 (no changelog available)
* bump soname to libwv-1.2.so.3
- Dropped wv-1.2.2-overflow.patch, fixed upstream
- Reformat spec file, added Source url and URL, use more macros
and use pkgconfig() based BuildRequires
-------------------------------------------------------------------
Wed Aug 28 02:50:03 UTC 2013 - crrodriguez@opensuse.org

99
wv.spec
View File

@ -16,44 +16,38 @@
#
%global lname libwv-1_2-3
Name: wv
%define lname libwv-1_2-1
BuildRequires: glib2-devel
BuildRequires: libgsf-devel
BuildRequires: libtool
BuildRequires: libwmf-devel
BuildRequires: libxml2-devel
BuildRequires: pkgconfig
BuildRequires: zlib-devel
Version: 1.2.2
Version: 1.2.4
Release: 0
Summary: Tools for Importing Microsoft Word (tm) Documents
License: GPL-2.0+
Group: Productivity/Publishing/Word
Url: http://wvWare.sourceforge.net/
Source: wv-%{version}.tar.gz
Patch: wv-1.2.2-automake.patch
Url: http://wvware.sourceforge.net/
Source0: http://prdownloads.sourceforge.net/wvware/%{name}-%{version}.tar.gz
Patch0: wv-1.2.2-automake.patch
Patch5: wv-1.0.3-wvText.patch
Patch7: wv-1.0.3-pc.patch
Patch8: wv-1.2.2-overflow.patch
Patch9: %{name}-1.2.2-fiximplicit.patch
Patch9: wv-1.2.2-fiximplicit.patch
Patch10: wv-strcasecmp.patch
Patch11: wv-gsf.patch
Patch12: wv-noansi.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires: w3m
BuildRequires: libtool
BuildRequires: libwmf-devel
BuildRequires: pkgconfig
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(libgsf-1)
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(zlib)
%description
WV is a program that can understand the Microsoft Word 8 binary file
format (Office97). It currently converts Word into HTML, which can then
be read with a web browser.
Authors:
--------
Caolan McNamara <Caolan.McNamara@ul.ie>
%package -n %lname
Summary: Library for importing Microsoft Word documents
Group: System/Libraries
@ -71,69 +65,72 @@ Group: Development/Libraries/C and C++
%description devel
Static Libraries and Header Files for wv.
Authors:
--------
Caolan McNamara <Caolan.McNamara@ul.ie>
%prep
%setup -q
%patch
%patch0
%patch5
%patch7
%patch8
%patch9 -p1
%patch10 -p1
%if 0%{?suse_version} > 1230
%patch11 -p1
%endif
%patch12 -p1
%build
autoreconf -f -i --verbose
%define warn_flags -Wall -Wstrict-prototypes -Wpointer-arith -Wformat -Wformat-security
CFLAGS="$RPM_OPT_FLAGS %{warn_flags} -fno-strict-aliasing -fstack-protector" \
%configure --with-libwmf --with-expat --disable-dependency-tracking --disable-static --with-pic
%configure \
--with-libwmf \
--with-expat \
--disable-dependency-tracking \
--disable-static \
--with-pic
make %{?_smp_mflags}
%install
make DESTDIR=$RPM_BUILD_ROOT manonedir=%{_mandir}/man1 install
rm -f %{buildroot}%{_libdir}/*.la
%check
make check
%post -n %lname -p /sbin/ldconfig
%postun -n %lname -p /sbin/ldconfig
%files
%defattr(-,root,root)
/usr/bin/wvAbw
/usr/bin/wvCleanLatex
/usr/bin/wvConvert
/usr/bin/wvDVI
/usr/bin/wvHtml
/usr/bin/wvLatex
/usr/bin/wvMime
/usr/bin/wvPDF
/usr/bin/wvPS
/usr/bin/wvRTF
/usr/bin/wvSummary
/usr/bin/wvText
/usr/bin/wvVersion
/usr/bin/wvWare
/usr/bin/wvWml
/usr/bin/wvDocBook
/usr/share/wv
%doc %{_mandir}/*/*
%doc COPYING README
%{_bindir}/wvAbw
%{_bindir}/wvCleanLatex
%{_bindir}/wvConvert
%{_bindir}/wvDVI
%{_bindir}/wvHtml
%{_bindir}/wvLatex
%{_bindir}/wvMime
%{_bindir}/wvPDF
%{_bindir}/wvPS
%{_bindir}/wvRTF
%{_bindir}/wvSummary
%{_bindir}/wvText
%{_bindir}/wvVersion
%{_bindir}/wvWare
%{_bindir}/wvWml
%{_bindir}/wvDocBook
%{_datadir}/wv
%doc %{_mandir}/*/*
%files -n %lname
%defattr(-,root,root)
%_libdir/libwv-1.2.so.1*
%_libdir/libwv-1.2.so.*
%files devel
%defattr(-,root,root)
%_libdir/pkgconfig/*
/usr/include/wv
%{_libdir}/*.so
%{_includedir}/wv
%{_libdir}/libwv.so
%{_libdir}/pkgconfig/%{name}-1.0.pc
%changelog