# ChangeLog for app-office/koffice-libs
# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-office/koffice-libs/ChangeLog,v 1.60 2006/10/24 15:20:04 blubb Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-office/koffice-libs/ChangeLog,v 1.61 2006/11/30 09:40:48 flameeyes Exp $
+
+*koffice-libs-1.6.0-r1 (30 Nov 2006)
+*koffice-libs-1.4.2-r1 (30 Nov 2006)
+
+ 30 Nov 2006; Diego Pettenò <flameeyes@gentoo.org>
+ +files/koffice-ole-filter.patch, +koffice-libs-1.4.2-r1.ebuild,
+ +koffice-libs-1.6.0-r1.ebuild:
+ Add patch to fix OLE filters, see bug #155914.
24 Oct 2006; Simon Stelling <blubb@gentoo.org> koffice-libs-1.5.2.ebuild:
stable on amd64
--- /dev/null
+MD5 6b456fb7d54c84b11396b27a96ae0cf8 koffice-1.4.2.tar.bz2 19486852
+RMD160 117d5c50aa81d669002005f39fc03bc3f999b62c koffice-1.4.2.tar.bz2 19486852
+SHA256 c9d5ba0bbd008ebfc40500b0d69335d94ad9657cb58c5f2d939179de8d23d361 koffice-1.4.2.tar.bz2 19486852
--- /dev/null
+MD5 e669cf19b2e1c7db7029c0772c527c0d koffice-1.6.0.tar.bz2 56718478
+RMD160 be09c18005eb33f6dc35ab0359cc97a8a658ce7c koffice-1.6.0.tar.bz2 56718478
+SHA256 9eddaae640ada9bd184f001e2489854daf7094b73e5f15b0b8deffb4cc654ae2 koffice-1.6.0.tar.bz2 56718478
--- /dev/null
+diff -uNrp koffice-1.4.1/filters/olefilters/lib/klaola.cc koffice-1.4.1-kees/filters/olefilters/lib/klaola.cc
+--- koffice-1.4.1/filters/olefilters/lib/klaola.cc 2005-07-19 07:09:30.000000000 -0700
++++ koffice-1.4.1-kees/filters/olefilters/lib/klaola.cc 2006-11-21 16:02:08.000000000 -0800
+@@ -197,11 +197,21 @@ bool KLaola::parseHeader() {
+ num_of_bbd_blocks=read32(0x2c);
+ root_startblock=read32(0x30);
+ sbd_startblock=read32(0x3c);
++
++ if (num_of_bbd_blocks >= 0x800000) {
++ kdError(s_area) << "KLaola::parseHeader(): Too many bbd blocks found in header!" << endl;
++ return false;
++ }
+ bbd_list=new unsigned int[num_of_bbd_blocks];
+
+ unsigned int i, j;
+- for(i=0, j=0; i<num_of_bbd_blocks; ++i, j=j+4)
++ for(i=0, j=0; i<num_of_bbd_blocks; ++i, j=j+4) {
+ bbd_list[i]=read32(0x4c+j);
++ if (bbd_list[i] >= (0x800000 - 1)) {
++ kdError(s_area) << "KLaola::parseHeader(): bbd " << i << " offset (" << bbd_list[i] << ") too large" << endl;
++ return false;
++ }
++ }
+ return true;
+ }
+
+@@ -283,7 +293,8 @@ const unsigned char *KLaola::readBBStrea
+ unsigned char *p=0;
+
+ tmp=start;
+- while(tmp!=-2 && tmp>=0 && tmp<=static_cast<int>(maxblock)) {
++ /* 0x10000 chosen as arbitrary "too many blocks" limit to not loop forver */
++ while(tmp!=-2 && tmp>=0 && i<0x10000 && tmp<=static_cast<int>(maxblock)) {
+ ++i;
+ tmp=nextBigBlock(tmp);
+ }
+@@ -293,7 +304,7 @@ const unsigned char *KLaola::readBBStrea
+ maxSblock=i*8-1;
+ i=0;
+ tmp=start;
+- while(tmp!=-2 && tmp>=0 && tmp<=static_cast<int>(maxblock)) {
++ while(tmp!=-2 && tmp>=0 && i<0x10000 && tmp<=static_cast<int>(maxblock)) {
+ memcpy(&p[i*0x200], &m_file.data[(tmp+1)*0x200], 0x200);
+ tmp=nextBigBlock(tmp);
+ ++i;
+@@ -308,7 +319,8 @@ const unsigned char *KLaola::readSBStrea
+ unsigned char *p=0;
+
+ tmp=start;
+- while(tmp!=-2 && tmp>=0 && tmp<=static_cast<int>(maxSblock)) {
++ /* 0x10000 chosen as arbitrary "too many blocks" limit to not loop forver */
++ while(tmp!=-2 && tmp>=0 && i<0x10000 && tmp<=static_cast<int>(maxSblock)) {
+ ++i;
+ tmp=nextSmallBlock(tmp);
+ }
+@@ -316,7 +328,7 @@ const unsigned char *KLaola::readSBStrea
+ p=new unsigned char[i*0x40];
+ i=0;
+ tmp=start;
+- while(tmp!=-2 && tmp>=0 && tmp<=static_cast<int>(maxSblock)) {
++ while(tmp!=-2 && tmp>=0 && i<0x10000 && tmp<=static_cast<int>(maxSblock)) {
+ memcpy(&p[i*0x40], &smallBlockFile[tmp*0x40], 0x40);
+ tmp=nextSmallBlock(tmp);
+ ++i;
+@@ -326,10 +338,20 @@ const unsigned char *KLaola::readSBStrea
+ }
+
+ void KLaola::readBigBlockDepot() {
++ if (num_of_bbd_blocks >= 0x800000)
++ return;
+
+ bigBlockDepot=new unsigned char[0x200*num_of_bbd_blocks];
+- for(unsigned int i=0; i<num_of_bbd_blocks; ++i)
+- memcpy(&bigBlockDepot[i*0x200], &m_file.data[(bbd_list[i]+1)*0x200], 0x200);
++ for(unsigned int i=0; i<num_of_bbd_blocks; ++i) {
++ unsigned int offset = (bbd_list[i]+1)*0x200;
++ if (offset > m_file.length - 0x200) {
++ /* attempting to read past end of file */
++ memset(&bigBlockDepot[i*0x200], 0, 0x200);
++ }
++ else {
++ memcpy(&bigBlockDepot[i*0x200], &m_file.data[offset], 0x200);
++ }
++ }
+ }
+
+ void KLaola::readSmallBlockDepot() {
--- /dev/null
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-office/koffice-libs/koffice-libs-1.4.2-r1.ebuild,v 1.1 2006/11/30 09:40:48 flameeyes Exp $
+
+MAXKOFFICEVER=${PV}
+KMNAME=koffice
+KMMODULE=lib
+inherit kde-meta eutils
+
+DESCRIPTION="Shared KOffice libraries."
+HOMEPAGE="http://www.koffice.org/"
+LICENSE="GPL-2 LGPL-2"
+
+SLOT="0"
+KEYWORDS="alpha amd64 ia64 ppc ppc64 sparc x86"
+IUSE="doc"
+
+RDEPEND="$(deprange $PV $MAXKOFFICEVER app-office/koffice-data)"
+
+DEPEND="${RDEPEND}
+ doc? ( app-doc/doxygen )
+ dev-util/pkgconfig"
+
+KMEXTRA="
+ interfaces/
+ plugins/
+ tools/
+ filters/olefilters/
+ filters/xsltfilter/
+ filters/generic_wrapper/
+ kounavail/
+ doc/api/
+ doc/koffice/
+ doc/thesaurus/"
+
+KMEXTRACTONLY="
+ kchart/kdchart/"
+
+PATCHES="${FILESDIR}/koffice-ole-filter.patch"
+
+need-kde 3.3
+
+src_unpack() {
+ kde-meta_src_unpack unpack
+
+ # Force the compilation of libkopainter.
+ sed -i 's:$(KOPAINTERDIR):kopainter:' $S/lib/Makefile.am
+
+ kde-meta_src_unpack makefiles
+}
+
+src_compile() {
+ kde-meta_src_compile
+ if use doc; then
+ make apidox || die
+ fi
+}
+
+src_install() {
+ kde-meta_src_install
+ if use doc; then
+ make DESTDIR=${D} install-apidox || die
+ fi
+}
--- /dev/null
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-office/koffice-libs/koffice-libs-1.6.0-r1.ebuild,v 1.1 2006/11/30 09:40:48 flameeyes Exp $
+
+MAXKOFFICEVER=${PV}
+KMNAME=koffice
+KMMODULE=lib
+inherit kde-meta eutils
+
+DESCRIPTION="Shared KOffice libraries."
+HOMEPAGE="http://www.koffice.org/"
+LICENSE="GPL-2 LGPL-2"
+
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
+IUSE="doc"
+
+RDEPEND="$(deprange $PV $MAXKOFFICEVER app-office/koffice-data)
+ virtual/python
+ dev-lang/ruby"
+
+DEPEND="${RDEPEND}
+ doc? ( app-doc/doxygen )
+ dev-util/pkgconfig"
+
+KMEXTRA="interfaces/
+ plugins/
+ tools/
+ filters/olefilters/
+ filters/xsltfilter/
+ filters/generic_wrapper/
+ kounavail/
+ doc/api/
+ doc/koffice/
+ doc/thesaurus/"
+
+KMEXTRACTONLY="
+ kchart/kdchart/"
+
+PATCHES="${FILESDIR}/koffice-ole-filter.patch"
+
+need-kde 3.4
+
+src_unpack() {
+ kde-meta_src_unpack unpack
+
+ # Force the compilation of libkopainter.
+ sed -i 's:$(KOPAINTERDIR):kopainter:' $S/lib/Makefile.am
+
+ kde-meta_src_unpack makefiles
+}
+
+src_compile() {
+ local myconf="--enable-scripting --with-pythonfir=${ROOT}/usr/$(get_libdir)/python${PYVER}/site-packages"
+ kde-meta_src_compile
+ if use doc; then
+ make apidox || die
+ fi
+}
+
+src_install() {
+ kde-meta_src_install
+ if use doc; then
+ make DESTDIR=${D} install-apidox || die
+ fi
+}
# ChangeLog for app-office/koffice
# Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-office/koffice/ChangeLog,v 1.196 2006/11/23 19:34:31 vivo Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-office/koffice/ChangeLog,v 1.197 2006/11/30 09:43:40 flameeyes Exp $
+
+*koffice-1.6.0-r3 (30 Nov 2006)
+*koffice-1.4.2-r8 (30 Nov 2006)
+
+ 30 Nov 2006; Diego Pettenò <flameeyes@gentoo.org>
+ +files/koffice-ole-filter.patch, +koffice-1.4.2-r8.ebuild,
+ +koffice-1.6.0-r3.ebuild:
+ Add patch to fix OLE filters, see bug #155914.
23 Nov 2006; Francesco Riosa <vivo@gentoo.org> koffice-1.4.2-r6.ebuild,
koffice-1.4.2-r7.ebuild, koffice-1.5.1-r1.ebuild, koffice-1.5.2.ebuild,
--- /dev/null
+MD5 6b456fb7d54c84b11396b27a96ae0cf8 koffice-1.4.2.tar.bz2 19486852
+RMD160 117d5c50aa81d669002005f39fc03bc3f999b62c koffice-1.4.2.tar.bz2 19486852
+SHA256 c9d5ba0bbd008ebfc40500b0d69335d94ad9657cb58c5f2d939179de8d23d361 koffice-1.4.2.tar.bz2 19486852
--- /dev/null
+MD5 e669cf19b2e1c7db7029c0772c527c0d koffice-1.6.0.tar.bz2 56718478
+RMD160 be09c18005eb33f6dc35ab0359cc97a8a658ce7c koffice-1.6.0.tar.bz2 56718478
+SHA256 9eddaae640ada9bd184f001e2489854daf7094b73e5f15b0b8deffb4cc654ae2 koffice-1.6.0.tar.bz2 56718478
--- /dev/null
+diff -uNrp koffice-1.4.1/filters/olefilters/lib/klaola.cc koffice-1.4.1-kees/filters/olefilters/lib/klaola.cc
+--- koffice-1.4.1/filters/olefilters/lib/klaola.cc 2005-07-19 07:09:30.000000000 -0700
++++ koffice-1.4.1-kees/filters/olefilters/lib/klaola.cc 2006-11-21 16:02:08.000000000 -0800
+@@ -197,11 +197,21 @@ bool KLaola::parseHeader() {
+ num_of_bbd_blocks=read32(0x2c);
+ root_startblock=read32(0x30);
+ sbd_startblock=read32(0x3c);
++
++ if (num_of_bbd_blocks >= 0x800000) {
++ kdError(s_area) << "KLaola::parseHeader(): Too many bbd blocks found in header!" << endl;
++ return false;
++ }
+ bbd_list=new unsigned int[num_of_bbd_blocks];
+
+ unsigned int i, j;
+- for(i=0, j=0; i<num_of_bbd_blocks; ++i, j=j+4)
++ for(i=0, j=0; i<num_of_bbd_blocks; ++i, j=j+4) {
+ bbd_list[i]=read32(0x4c+j);
++ if (bbd_list[i] >= (0x800000 - 1)) {
++ kdError(s_area) << "KLaola::parseHeader(): bbd " << i << " offset (" << bbd_list[i] << ") too large" << endl;
++ return false;
++ }
++ }
+ return true;
+ }
+
+@@ -283,7 +293,8 @@ const unsigned char *KLaola::readBBStrea
+ unsigned char *p=0;
+
+ tmp=start;
+- while(tmp!=-2 && tmp>=0 && tmp<=static_cast<int>(maxblock)) {
++ /* 0x10000 chosen as arbitrary "too many blocks" limit to not loop forver */
++ while(tmp!=-2 && tmp>=0 && i<0x10000 && tmp<=static_cast<int>(maxblock)) {
+ ++i;
+ tmp=nextBigBlock(tmp);
+ }
+@@ -293,7 +304,7 @@ const unsigned char *KLaola::readBBStrea
+ maxSblock=i*8-1;
+ i=0;
+ tmp=start;
+- while(tmp!=-2 && tmp>=0 && tmp<=static_cast<int>(maxblock)) {
++ while(tmp!=-2 && tmp>=0 && i<0x10000 && tmp<=static_cast<int>(maxblock)) {
+ memcpy(&p[i*0x200], &m_file.data[(tmp+1)*0x200], 0x200);
+ tmp=nextBigBlock(tmp);
+ ++i;
+@@ -308,7 +319,8 @@ const unsigned char *KLaola::readSBStrea
+ unsigned char *p=0;
+
+ tmp=start;
+- while(tmp!=-2 && tmp>=0 && tmp<=static_cast<int>(maxSblock)) {
++ /* 0x10000 chosen as arbitrary "too many blocks" limit to not loop forver */
++ while(tmp!=-2 && tmp>=0 && i<0x10000 && tmp<=static_cast<int>(maxSblock)) {
+ ++i;
+ tmp=nextSmallBlock(tmp);
+ }
+@@ -316,7 +328,7 @@ const unsigned char *KLaola::readSBStrea
+ p=new unsigned char[i*0x40];
+ i=0;
+ tmp=start;
+- while(tmp!=-2 && tmp>=0 && tmp<=static_cast<int>(maxSblock)) {
++ while(tmp!=-2 && tmp>=0 && i<0x10000 && tmp<=static_cast<int>(maxSblock)) {
+ memcpy(&p[i*0x40], &smallBlockFile[tmp*0x40], 0x40);
+ tmp=nextSmallBlock(tmp);
+ ++i;
+@@ -326,10 +338,20 @@ const unsigned char *KLaola::readSBStrea
+ }
+
+ void KLaola::readBigBlockDepot() {
++ if (num_of_bbd_blocks >= 0x800000)
++ return;
+
+ bigBlockDepot=new unsigned char[0x200*num_of_bbd_blocks];
+- for(unsigned int i=0; i<num_of_bbd_blocks; ++i)
+- memcpy(&bigBlockDepot[i*0x200], &m_file.data[(bbd_list[i]+1)*0x200], 0x200);
++ for(unsigned int i=0; i<num_of_bbd_blocks; ++i) {
++ unsigned int offset = (bbd_list[i]+1)*0x200;
++ if (offset > m_file.length - 0x200) {
++ /* attempting to read past end of file */
++ memset(&bigBlockDepot[i*0x200], 0, 0x200);
++ }
++ else {
++ memcpy(&bigBlockDepot[i*0x200], &m_file.data[offset], 0x200);
++ }
++ }
+ }
+
+ void KLaola::readSmallBlockDepot() {
--- /dev/null
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-office/koffice/koffice-1.4.2-r8.ebuild,v 1.1 2006/11/30 09:43:40 flameeyes Exp $
+
+inherit kde
+
+DESCRIPTION="An integrated office suite for KDE, the K Desktop Environment."
+HOMEPAGE="http://www.koffice.org/"
+SRC_URI="mirror://kde/stable/koffice-${PV}/src/${P}.tar.bz2"
+LICENSE="GPL-2 LGPL-2"
+
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~ppc64 ~sparc ~x86"
+IUSE="doc javascript mysql postgres"
+
+RDEPEND=">=media-gfx/imagemagick-5.5.2
+ >=app-text/wv2-0.1.9
+ >=media-libs/freetype-2
+ media-libs/fontconfig
+ media-libs/libart_lgpl
+ dev-libs/libxml2
+ dev-libs/libxslt
+ sys-libs/readline
+ mysql? ( dev-db/mysql )
+ postgres? ( dev-libs/libpqxx )
+ dev-lang/python
+ >=media-libs/lcms-1.12
+ !ia64? ( !alpha? ( !sparc? ( javascript? ( kde-base/kjsembed ) ) ) )
+ >=app-text/libwpd-0.8.2"
+
+DEPEND="${RDEPEND}
+ doc? ( app-doc/doxygen )
+ dev-util/pkgconfig"
+
+# add blockers on split packages derived from this one
+for x in $(get-child-packages ${CATEGORY}/${PN}); do
+ DEPEND="${DEPEND} !${x}"
+ RDEPEND="${RDEPEND} !${x}"
+done
+
+need-kde 3.3
+
+# TODO: kword sql plugin needs Qt compiled with sql support
+# the dependency on python is needed for scripting support in kexi
+# and for kivio/kiviopart/kiviosdk.
+
+PATCHES="${FILESDIR}/kspread-1.4.2-gcc41.patch
+ ${FILESDIR}/kexi-1.4.2-gcc41.patch
+ ${FILESDIR}/krita-1.4.2-gcc41.patch
+ ${FILESDIR}/post-1.3-koffice-CAN-2005-3193.diff
+ ${FILESDIR}/koffice-ole-filter.patch"
+
+src_compile() {
+ local myconf="$(use_enable mysql) $(use_enable postgres pgsql)"
+
+ kde_src_compile
+ if use doc; then
+ make apidox || die
+ fi
+}
+
+src_install() {
+ kde_src_install
+ if use doc; then
+ make DESTDIR="${D}" install-apidox || die
+ fi
+
+ dodoc changes-*
+}
--- /dev/null
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-office/koffice/koffice-1.6.0-r3.ebuild,v 1.1 2006/11/30 09:43:40 flameeyes Exp $
+
+inherit kde
+
+RV="${PV}"
+MY_P="koffice-${RV}"
+S="${WORKDIR}/${MY_P}"
+
+DESCRIPTION="KOffice is an integrated office suite for KDE, the K Desktop Environment."
+HOMEPAGE="http://www.koffice.org/"
+SRC_URI="mirror://kde/stable/koffice-${PV}/src/${P}.tar.bz2"
+#SRC_URI="mirror://kde/unstable/koffice-${PV/_/-}/src/${MY_P}.tar.bz2"
+LICENSE="GPL-2 LGPL-2"
+
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86"
+
+# See bug #130442.
+#IUSE="doc mysql opengl postgres"
+IUSE="doc mysql postgres"
+
+RDEPEND=">=media-libs/freetype-2
+ media-libs/fontconfig
+ media-libs/libart_lgpl
+ dev-libs/libxml2
+ dev-libs/libxslt
+ sys-libs/readline
+ mysql? ( dev-db/mysql )
+ postgres? ( dev-libs/libpqxx )
+ virtual/python
+ dev-lang/ruby
+ >=app-text/wv2-0.1.9
+ >=app-text/libwpd-0.8.2
+ >=media-gfx/imagemagick-6.2.5.5
+ >=media-libs/lcms-1.15
+ media-libs/tiff
+ media-libs/jpeg
+ >=media-libs/openexr-1.2.2-r2
+ media-libs/libpng
+ >=media-libs/libexif-0.6.13-r1
+ virtual/opengl
+ virtual/glu"
+# opengl? ( virtual/opengl virtual/glu )"
+
+DEPEND="${RDEPEND}
+ doc? ( app-doc/doxygen )"
+
+# add blockers on split packages derived from this one
+for x in $(get-child-packages ${CATEGORY}/${PN}); do
+ DEPEND="${DEPEND} !${x}"
+ RDEPEND="${RDEPEND} !${x}"
+done
+
+need-kde 3.4
+
+# TODO: kword sql plugin needs Qt compiled with sql support
+# the dependency on python is needed for scripting support in kexi
+# and for kivio/kiviopart/kiviosdk.
+
+PATCHES="${FILESDIR}/krita-1.6.0-corrupt_png_save.diff
+ ${FILESDIR}/koffice-ole-filter.patch"
+
+pkg_setup() {
+ # use opengl &&
+ if ! built_with_use =x11-libs/qt-3* opengl ; then
+ eerror "You need to build x11-libs/qt with opengl use flag enabled."
+ die
+ fi
+}
+
+src_unpack() {
+ kde_src_unpack
+ # FIXME - disable broken tests for now
+ sed -i -e "s:TESTSDIR =.*:TESTSDIR=:" ${S}/krita/core/Makefile.am \
+ `ls ${S}/krita/colorspaces/*/Makefile.am`
+ sed -i -e "s:toolbar tests:toolbar:" ${S}/kplato/Makefile.am
+}
+
+src_compile() {
+ local myconf="$(use_enable mysql) $(use_enable postgres pgsql)"
+ # $(use_enable opengl gl)"
+
+ kde_src_compile
+ if use doc; then
+ make apidox || die
+ fi
+}
+
+src_install() {
+ kde_src_install
+ if use doc; then
+ make DESTDIR="${D}" install-apidox || die
+ fi
+
+ dodoc changes-*
+}