# ChangeLog for kde-base/kdegraphics-kfile-plugins
# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/kde-base/kdegraphics-kfile-plugins/ChangeLog,v 1.61 2006/11/26 23:46:59 corsair Exp $
+# $Header: /var/cvsroot/gentoo-x86/kde-base/kdegraphics-kfile-plugins/ChangeLog,v 1.62 2006/12/05 14:54:00 flameeyes Exp $
+
+*kdegraphics-kfile-plugins-3.5.5-r1 (05 Dec 2006)
+
+ 05 Dec 2006; Diego Pettenò <flameeyes@gentoo.org>
+ +files/post-3.5.5-kdegraphics.diff,
+ +kdegraphics-kfile-plugins-3.5.5-r1.ebuild:
+ Add patch to fix bug #155949.
26 Nov 2006; Markus Rothe <corsair@gentoo.org>
kdegraphics-kfile-plugins-3.5.5.ebuild:
--- /dev/null
+MD5 cdbe15afc01c5da7af9557e803bbb7e6 kdegraphics-3.5.5.tar.bz2 7334117
+RMD160 c6febdf8ebd67110be3f27ada4c00e148403217f kdegraphics-3.5.5.tar.bz2 7334117
+SHA256 b6706d37568686e1ca4b4bb2cf1f79c027b94a512f6fe1156b7c7b7f79336f16 kdegraphics-3.5.5.tar.bz2 7334117
--- /dev/null
+--- kfile-plugins/jpeg/exif.h
++++ kfile-plugins/jpeg/exif.h
+@@ -72,7 +72,8 @@
+ int Get32s(void * Long);
+ unsigned Get32u(void * Long);
+ double ConvertAnyFormat(void * ValuePtr, int Format);
+- void ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBase, unsigned ExifLength);
++ void ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBase, unsigned ExifLength,
++ unsigned NestingLevel);
+ void process_COM (const uchar * Data, int length);
+ void process_SOFn (const uchar * Data, int marker);
+ int Get16m(const void * Short);
+--- kfile-plugins/jpeg/exif.cpp
++++ kfile-plugins/jpeg/exif.cpp
+@@ -446,7 +446,7 @@
+ //--------------------------------------------------------------------------
+ // Process one of the nested EXIF directories.
+ //--------------------------------------------------------------------------
+-void ExifData::ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBase, unsigned ExifLength)
++void ExifData::ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBase, unsigned ExifLength, unsigned NestingLevel)
+ {
+ int de;
+ int a;
+@@ -454,6 +454,9 @@
+ unsigned ThumbnailOffset = 0;
+ unsigned ThumbnailSize = 0;
+
++ if ( NestingLevel > 4)
++ throw FatalError("Maximum directory nesting exceeded (corrupt exif header)");
++
+ NumDirEntries = Get16u(DirStart);
+ #define DIR_ENTRY_ADDR(Start, Entry) (Start+2+12*(Entry))
+
+@@ -476,7 +479,7 @@
+ for (de=0;de<NumDirEntries;de++){
+ int Tag, Format, Components;
+ unsigned char * ValuePtr;
+- int ByteCount;
++ unsigned ByteCount;
+ char * DirEntry;
+ DirEntry = (char *)DIR_ENTRY_ADDR(DirStart, de);
+
+@@ -489,6 +492,11 @@
+ throw FatalError("Illegal format code in EXIF dir");
+ }
+
++ if ((unsigned)Components > 0x10000) {
++ throw FatalError("Illegal number of components for tag");
++ continue;
++ }
++
+ ByteCount = Components * BytesPerFormat[Format];
+
+ if (ByteCount > 4){
+@@ -517,11 +525,11 @@
+ switch(Tag){
+
+ case TAG_MAKE:
+- ExifData::CameraMake = QString((char*)ValuePtr);
++ ExifData::CameraMake = QString::fromLatin1((const char*)ValuePtr, 31);
+ break;
+
+ case TAG_MODEL:
+- ExifData::CameraModel = QString((char*)ValuePtr);
++ ExifData::CameraModel = QString::fromLatin1((const char*)ValuePtr, 39);
+ break;
+
+ case TAG_ORIENTATION:
+@@ -529,7 +537,7 @@
+ break;
+
+ case TAG_DATETIME_ORIGINAL:
+- DateTime = QString((char*)ValuePtr);
++ DateTime = QString::fromLatin1((const char*)ValuePtr, 19);
+ break;
+
+ case TAG_USERCOMMENT:
+@@ -550,14 +558,12 @@
+ int c;
+ c = (ValuePtr)[a];
+ if (c != '\0' && c != ' '){
+- //strncpy(ImageInfo.Comments, (const char*)(a+ValuePtr), 199);
+- UserComment.sprintf("%s", (const char*)(a+ValuePtr));
++ UserComment = QString::fromLatin1((const char*)(a+ValuePtr), 199);
+ break;
+ }
+ }
+ }else{
+- //strncpy(ImageInfo.Comments, (const char*)ValuePtr, 199);
+- UserComment.sprintf("%s", (const char*)ValuePtr);
++ UserComment = QString::fromLatin1((const char*)ValuePtr, 199);
+ }
+ break;
+
+@@ -676,10 +682,10 @@
+ if (Tag == TAG_EXIF_OFFSET || Tag == TAG_INTEROP_OFFSET){
+ unsigned char * SubdirStart;
+ SubdirStart = OffsetBase + Get32u(ValuePtr);
+- if (SubdirStart < OffsetBase || SubdirStart > OffsetBase+ExifLength){
++ if (SubdirStart <= OffsetBase || SubdirStart >= OffsetBase+ExifLength){
+ throw FatalError("Illegal subdirectory link");
+ }
+- ProcessExifDir(SubdirStart, OffsetBase, ExifLength);
++ ProcessExifDir(SubdirStart, OffsetBase, ExifLength, NestingLevel+1);
+ continue;
+ }
+ }
+@@ -709,7 +715,7 @@
+ }
+ }else{
+ if (SubdirStart <= OffsetBase+ExifLength){
+- ProcessExifDir(SubdirStart, OffsetBase, ExifLength);
++ ProcessExifDir(SubdirStart, OffsetBase, ExifLength, NestingLevel+1);
+ }
+ }
+ }
+@@ -719,7 +725,7 @@
+ }
+
+ if (ThumbnailSize && ThumbnailOffset){
+- if (ThumbnailSize + ThumbnailOffset <= ExifLength){
++ if (ThumbnailSize + ThumbnailOffset < ExifLength){
+ // The thumbnail pointer appears to be valid. Store it.
+ Thumbnail.loadFromData(OffsetBase + ThumbnailOffset, ThumbnailSize, "JPEG");
+ }
+@@ -810,7 +816,7 @@
+ LastExifRefd = CharBuf;
+
+ // First directory starts 16 bytes in. Offsets start at 8 bytes in.
+- ProcessExifDir(CharBuf+16, CharBuf+8, length-6);
++ ProcessExifDir(CharBuf+16, CharBuf+8, length-6, 0);
+
+ // This is how far the interesting (non thumbnail) part of the exif went.
+ ExifSettingsLength = LastExifRefd - CharBuf;
--- /dev/null
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/kde-base/kdegraphics-kfile-plugins/kdegraphics-kfile-plugins-3.5.5-r1.ebuild,v 1.1 2006/12/05 14:54:00 flameeyes Exp $
+
+KMNAME=kdegraphics
+KMMODULE=kfile-plugins
+MAXKDEVER=$PV
+KM_DEPRANGE="$PV $MAXKDEVER"
+inherit kde-meta eutils
+
+DESCRIPTION="kfile plugins from kdegraphics"
+KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
+IUSE="openexr"
+DEPEND="media-libs/tiff
+ openexr? ( media-libs/openexr )"
+
+# compilation of the tiff plugin depends on the check in acinclude.m4.in,
+# which doesn't have a switch.
+
+# ps installed with kghostview, pdf installed with kpdf
+KMEXTRACTONLY="kfile-plugins/ps kfile-plugins/pdf"
+
+PATCHES="${FILESDIR}/post-3.5.5-kdegraphics.diff"
+
+src_compile() {
+ myconf="$myconf $(use_with openexr)"
+ kde-meta_src_compile
+}
# ChangeLog for kde-base/kdegraphics
# Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/kde-base/kdegraphics/ChangeLog,v 1.275 2006/12/03 19:31:40 corsair Exp $
+# $Header: /var/cvsroot/gentoo-x86/kde-base/kdegraphics/ChangeLog,v 1.276 2006/12/05 14:51:51 flameeyes Exp $
+
+*kdegraphics-3.5.5-r1 (05 Dec 2006)
+
+ 05 Dec 2006; Diego Pettenò <flameeyes@gentoo.org>
+ +files/post-3.5.5-kdegraphics.diff, +kdegraphics-3.5.5-r1.ebuild:
+ Add patch to fix bug #155949.
03 Dec 2006; Markus Rothe <corsair@gentoo.org> kdegraphics-3.5.5.ebuild:
Stable on ppc64
--- /dev/null
+MD5 cdbe15afc01c5da7af9557e803bbb7e6 kdegraphics-3.5.5.tar.bz2 7334117
+RMD160 c6febdf8ebd67110be3f27ada4c00e148403217f kdegraphics-3.5.5.tar.bz2 7334117
+SHA256 b6706d37568686e1ca4b4bb2cf1f79c027b94a512f6fe1156b7c7b7f79336f16 kdegraphics-3.5.5.tar.bz2 7334117
+MD5 6bffd8365786b79b10db269588a8a281 kpdf-3.5.3-poppler-bis.patch.bz2 6283
+RMD160 b4d4bffd22a67cfdb86cf9c4614d31e56ed01757 kpdf-3.5.3-poppler-bis.patch.bz2 6283
+SHA256 08ea2cda6088ec33da22f0fbb2046de08bc6e26167b8373bbc22f891ed021a02 kpdf-3.5.3-poppler-bis.patch.bz2 6283
--- /dev/null
+--- kfile-plugins/jpeg/exif.h
++++ kfile-plugins/jpeg/exif.h
+@@ -72,7 +72,8 @@
+ int Get32s(void * Long);
+ unsigned Get32u(void * Long);
+ double ConvertAnyFormat(void * ValuePtr, int Format);
+- void ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBase, unsigned ExifLength);
++ void ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBase, unsigned ExifLength,
++ unsigned NestingLevel);
+ void process_COM (const uchar * Data, int length);
+ void process_SOFn (const uchar * Data, int marker);
+ int Get16m(const void * Short);
+--- kfile-plugins/jpeg/exif.cpp
++++ kfile-plugins/jpeg/exif.cpp
+@@ -446,7 +446,7 @@
+ //--------------------------------------------------------------------------
+ // Process one of the nested EXIF directories.
+ //--------------------------------------------------------------------------
+-void ExifData::ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBase, unsigned ExifLength)
++void ExifData::ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBase, unsigned ExifLength, unsigned NestingLevel)
+ {
+ int de;
+ int a;
+@@ -454,6 +454,9 @@
+ unsigned ThumbnailOffset = 0;
+ unsigned ThumbnailSize = 0;
+
++ if ( NestingLevel > 4)
++ throw FatalError("Maximum directory nesting exceeded (corrupt exif header)");
++
+ NumDirEntries = Get16u(DirStart);
+ #define DIR_ENTRY_ADDR(Start, Entry) (Start+2+12*(Entry))
+
+@@ -476,7 +479,7 @@
+ for (de=0;de<NumDirEntries;de++){
+ int Tag, Format, Components;
+ unsigned char * ValuePtr;
+- int ByteCount;
++ unsigned ByteCount;
+ char * DirEntry;
+ DirEntry = (char *)DIR_ENTRY_ADDR(DirStart, de);
+
+@@ -489,6 +492,11 @@
+ throw FatalError("Illegal format code in EXIF dir");
+ }
+
++ if ((unsigned)Components > 0x10000) {
++ throw FatalError("Illegal number of components for tag");
++ continue;
++ }
++
+ ByteCount = Components * BytesPerFormat[Format];
+
+ if (ByteCount > 4){
+@@ -517,11 +525,11 @@
+ switch(Tag){
+
+ case TAG_MAKE:
+- ExifData::CameraMake = QString((char*)ValuePtr);
++ ExifData::CameraMake = QString::fromLatin1((const char*)ValuePtr, 31);
+ break;
+
+ case TAG_MODEL:
+- ExifData::CameraModel = QString((char*)ValuePtr);
++ ExifData::CameraModel = QString::fromLatin1((const char*)ValuePtr, 39);
+ break;
+
+ case TAG_ORIENTATION:
+@@ -529,7 +537,7 @@
+ break;
+
+ case TAG_DATETIME_ORIGINAL:
+- DateTime = QString((char*)ValuePtr);
++ DateTime = QString::fromLatin1((const char*)ValuePtr, 19);
+ break;
+
+ case TAG_USERCOMMENT:
+@@ -550,14 +558,12 @@
+ int c;
+ c = (ValuePtr)[a];
+ if (c != '\0' && c != ' '){
+- //strncpy(ImageInfo.Comments, (const char*)(a+ValuePtr), 199);
+- UserComment.sprintf("%s", (const char*)(a+ValuePtr));
++ UserComment = QString::fromLatin1((const char*)(a+ValuePtr), 199);
+ break;
+ }
+ }
+ }else{
+- //strncpy(ImageInfo.Comments, (const char*)ValuePtr, 199);
+- UserComment.sprintf("%s", (const char*)ValuePtr);
++ UserComment = QString::fromLatin1((const char*)ValuePtr, 199);
+ }
+ break;
+
+@@ -676,10 +682,10 @@
+ if (Tag == TAG_EXIF_OFFSET || Tag == TAG_INTEROP_OFFSET){
+ unsigned char * SubdirStart;
+ SubdirStart = OffsetBase + Get32u(ValuePtr);
+- if (SubdirStart < OffsetBase || SubdirStart > OffsetBase+ExifLength){
++ if (SubdirStart <= OffsetBase || SubdirStart >= OffsetBase+ExifLength){
+ throw FatalError("Illegal subdirectory link");
+ }
+- ProcessExifDir(SubdirStart, OffsetBase, ExifLength);
++ ProcessExifDir(SubdirStart, OffsetBase, ExifLength, NestingLevel+1);
+ continue;
+ }
+ }
+@@ -709,7 +715,7 @@
+ }
+ }else{
+ if (SubdirStart <= OffsetBase+ExifLength){
+- ProcessExifDir(SubdirStart, OffsetBase, ExifLength);
++ ProcessExifDir(SubdirStart, OffsetBase, ExifLength, NestingLevel+1);
+ }
+ }
+ }
+@@ -719,7 +725,7 @@
+ }
+
+ if (ThumbnailSize && ThumbnailOffset){
+- if (ThumbnailSize + ThumbnailOffset <= ExifLength){
++ if (ThumbnailSize + ThumbnailOffset < ExifLength){
+ // The thumbnail pointer appears to be valid. Store it.
+ Thumbnail.loadFromData(OffsetBase + ThumbnailOffset, ThumbnailSize, "JPEG");
+ }
+@@ -810,7 +816,7 @@
+ LastExifRefd = CharBuf;
+
+ // First directory starts 16 bytes in. Offsets start at 8 bytes in.
+- ProcessExifDir(CharBuf+16, CharBuf+8, length-6);
++ ProcessExifDir(CharBuf+16, CharBuf+8, length-6, 0);
+
+ // This is how far the interesting (non thumbnail) part of the exif went.
+ ExifSettingsLength = LastExifRefd - CharBuf;
--- /dev/null
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/kde-base/kdegraphics/kdegraphics-3.5.5-r1.ebuild,v 1.1 2006/12/05 14:51:51 flameeyes Exp $
+
+inherit kde-dist eutils
+
+DESCRIPTION="KDE graphics-related apps"
+
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+IUSE="gphoto2 imlib openexr opengl pdf povray scanner tetex"
+
+DEPEND="~kde-base/kdebase-${PV}
+ >=media-libs/freetype-2
+ media-libs/fontconfig
+ gphoto2? ( media-libs/libgphoto2 )
+ scanner? ( media-gfx/sane-backends )
+ media-libs/libart_lgpl
+ media-libs/lcms
+ dev-libs/fribidi
+ imlib? ( media-libs/imlib )
+ virtual/ghostscript
+ media-libs/tiff
+ openexr? ( >=media-libs/openexr-1.2 )
+ povray? ( media-gfx/povray
+ virtual/opengl )
+ pdf? ( >=app-text/poppler-0.5.1
+ >=app-text/poppler-bindings-0.5.1 )"
+
+RDEPEND="${DEPEND}
+ tetex? (
+ || ( >=app-text/tetex-2
+ app-text/ptex
+ app-text/cstetex
+ app-text/dvipdfm ) )"
+
+DEPEND="${DEPEND}
+ dev-util/pkgconfig"
+
+SRC_URI="${SRC_URI}
+ mirror://gentoo/kpdf-3.5.3-poppler-bis.patch.bz2"
+
+PATCHES="${DISTDIR}/kpdf-3.5.3-poppler-bis.patch.bz2
+ ${FILESDIR}/post-3.5.5-kdegraphics.diff"
+
+pkg_setup() {
+ kde_pkg_setup
+ for ghostscript in app-text/ghostscript-{gnu,esp,afpl}; do
+ if has_version ${ghostscript} && ! built_with_use ${ghostscript} X; then
+ eerror "This package requires ${ghostscript} compiled with X11 support."
+ eerror "Please reemerge ${ghostscript} with USE=\"X\"."
+ die "Please reemerge ${ghostscript} with USE=\"X\"."
+ fi
+ done
+ if use pdf && ! built_with_use app-text/poppler-bindings qt3; then
+ eerror "This package requires app-text/poppler-bindings compiled with Qt 3.x support."
+ eerror "Please reemerge app-text/poppler-bindings with USE=\"qt3\"."
+ die "Please reemerge app-text/poppler-bindings with USE=\"qt3\"."
+ fi
+}
+
+src_compile() {
+ local myconf="$(use_with openexr) $(use_with pdf poppler)
+ $(use_with gphoto2 kamera)"
+
+ use imlib || export DO_NOT_COMPILE="${DO_NOT_COMPILE} kuickshow"
+ use scanner || export DO_NOT_COMPILE="${DO_NOT_COMPILE} kooka libkscan"
+ use povray || export DO_NOT_COMPILE="${DO_NOT_COMPILE} kpovmodeler"
+ use pdf || export DO_NOT_COMPILE="${DO_NOT_COMPILE} kpdf"
+
+ rm -f ${S}/configure # ask rebuilding
+ kde_src_compile
+}