diff --git a/office/misc/djvu/actions.py b/office/misc/djvu/actions.py index 82b91a4274..db29776703 100644 --- a/office/misc/djvu/actions.py +++ b/office/misc/djvu/actions.py @@ -2,24 +2,23 @@ # -*- coding: utf-8 -*- # # Licensed under the GNU General Public License, version 3. -# See the file http://www.gnu.org/licenses/gpl.txt +# See the file https://www.gnu.org/licenses/gpl-3.0.txt -from pisi.actionsapi import autotools -from pisi.actionsapi import pisitools -from pisi.actionsapi import get +from pisi.actionsapi import autotools, pisitools, get -WorkDir = "djvulibre-%s" % get.srcVERSION() if len(get.srcVERSION().split(".")) < 4 else "djvulibre-%s" % get.srcVERSION()[:get.srcVERSION().rfind(".")] +j = ''.join([ + ' --enable-xmltools', + ' --disable-desktopfiles', + ' --with-jpeg', + ' --with-tiff ' + ]) def setup(): autotools.aclocal("-I config") autotools.autoconf("-f") - autotools.configure("--enable-threads \ - --disable-desktopfiles \ - --enable-xmltools \ - --enable-i18n \ - --with-jpeg \ - --with-tiff") + autotools.configure(j) + def build(): autotools.make() @@ -31,4 +30,4 @@ def install(): for size in ["22", "32", "48", "64"]: pisitools.insinto("/usr/share/icons/hicolor/%sx%s/mimetypes" %(size, size), "desktopfiles/prebuilt-hi%s-djvu.png" % size, "image-vnd.djvu.png") - pisitools.dodoc("COPY*", "README", "NEWS") + pisitools.dodoc("NEWS") diff --git a/office/misc/djvu/comar/package.py b/office/misc/djvu/comar/package.py new file mode 100644 index 0000000000..a61a859486 --- /dev/null +++ b/office/misc/djvu/comar/package.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import os + +def postInstall(fromVersion, fromRelease, toVersion, toRelease): + os.system("/usr/bin/update-mime-database /usr/share/mime") diff --git a/office/misc/djvu/comar/pakhandler.py b/office/misc/djvu/comar/pakhandler.py new file mode 100644 index 0000000000..0343fa78d2 --- /dev/null +++ b/office/misc/djvu/comar/pakhandler.py @@ -0,0 +1,8 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +import os + +def updateData(filepath): + os.system("rm /usr/share/mime/version") +# os.system("update-mime-database /usr/share/mime") diff --git a/office/misc/djvu/files/djvulibre-3.5.22-cdefs.patch b/office/misc/djvu/files/djvulibre-3.5.22-cdefs.patch deleted file mode 100644 index d62ef08eab..0000000000 --- a/office/misc/djvu/files/djvulibre-3.5.22-cdefs.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up djvulibre-3.5.22/libdjvu/GSmartPointer.h.cdefs djvulibre-3.5.22/libdjvu/GSmartPointer.h ---- djvulibre-3.5.22/libdjvu/GSmartPointer.h.cdefs 2008-03-05 01:44:20.000000000 +0000 -+++ djvulibre-3.5.22/libdjvu/GSmartPointer.h 2011-01-31 13:43:37.595917364 +0000 -@@ -65,6 +65,8 @@ - # pragma interface - #endif - -+#include -+ - /** @name GSmartPointer.h - - Files #"GSmartPointer.h"# and #"GSmartPointer.cpp"# define a smart-pointer diff --git a/office/misc/djvu/files/djvulibre-3.5.27-check-image-size.patch b/office/misc/djvu/files/djvulibre-3.5.27-check-image-size.patch new file mode 100644 index 0000000000..9d0d5b8799 --- /dev/null +++ b/office/misc/djvu/files/djvulibre-3.5.27-check-image-size.patch @@ -0,0 +1,16 @@ +diff --git a/libdjvu/IW44Image.cpp b/libdjvu/IW44Image.cpp +index e8d4b44..aa3d554 100644 +--- a/libdjvu/IW44Image.cpp ++++ b/libdjvu/IW44Image.cpp +@@ -678,7 +678,11 @@ IW44Image::Map::image(signed char *img8, int rowsize, int pixsep, int fast) + size_t sz = bw * bh; + if (sz / (size_t)bw != (size_t)bh) // multiplication overflow + G_THROW("IW44Image: image size exceeds maximum (corrupted file?)"); ++ if (sz == 0) ++ G_THROW("IW44Image: zero size image (corrupted file?)"); + GPBuffer gdata16(data16,sz); ++ if (data16 == NULL) ++ G_THROW("IW44Image: unable to allocate image data"); + // Copy coefficients + int i; + short *p = data16; diff --git a/office/misc/djvu/files/djvulibre-3.5.27-check-input-pool.patch b/office/misc/djvu/files/djvulibre-3.5.27-check-input-pool.patch new file mode 100644 index 0000000000..26e08e980d --- /dev/null +++ b/office/misc/djvu/files/djvulibre-3.5.27-check-input-pool.patch @@ -0,0 +1,13 @@ +diff --git a/libdjvu/DataPool.cpp b/libdjvu/DataPool.cpp +index 5fcbedf..4c2eaf0 100644 +--- a/libdjvu/DataPool.cpp ++++ b/libdjvu/DataPool.cpp +@@ -791,6 +791,8 @@ DataPool::create(const GP & pool, int start, int length) + DEBUG_MSG("DataPool::DataPool: pool=" << (void *)((DataPool *)pool) << " start=" << start << " length= " << length << "\n"); + DEBUG_MAKE_INDENT(3); + ++ if (!pool) G_THROW( ERR_MSG("DataPool.zero_DataPool") ); ++ + DataPool *xpool=new DataPool(); + GP retval=xpool; + xpool->init(); diff --git a/office/misc/djvu/files/djvulibre-3.5.27-djvuport-stack-overflow.patch b/office/misc/djvu/files/djvulibre-3.5.27-djvuport-stack-overflow.patch new file mode 100644 index 0000000000..e7bc643ee6 --- /dev/null +++ b/office/misc/djvu/files/djvulibre-3.5.27-djvuport-stack-overflow.patch @@ -0,0 +1,36 @@ +diff --git a/libdjvu/DjVuPort.cpp b/libdjvu/DjVuPort.cpp +index 2b3e0d2..ede7f6b 100644 +--- a/libdjvu/DjVuPort.cpp ++++ b/libdjvu/DjVuPort.cpp +@@ -507,10 +507,19 @@ GP + DjVuPortcaster::id_to_file(const DjVuPort * source, const GUTF8String &id) + { + GPList list; ++ ++ if (!!opening_id && opening_id == id) ++ G_THROW("DjVuPortcaster: recursive opening of the same file (corrupted file?)"); ++ else ++ opening_id = id; ++ + compute_closure(source, list, true); + GP file; + for(GPosition pos=list;pos;++pos) + if ((file=list[pos]->id_to_file(source, id))) break; ++ ++ opening_id = GUTF8String(); ++ + return file; + } + +diff --git a/libdjvu/DjVuPort.h b/libdjvu/DjVuPort.h +index e2b3125..313dc2b 100644 +--- a/libdjvu/DjVuPort.h ++++ b/libdjvu/DjVuPort.h +@@ -484,6 +484,7 @@ private: + const DjVuPort *dst, int distance); + void compute_closure(const DjVuPort *src, GPList &list, + bool sorted=false); ++ GUTF8String opening_id; + }; + + diff --git a/office/misc/djvu/files/djvulibre-3.5.27-integer-overflow.patch b/office/misc/djvu/files/djvulibre-3.5.27-integer-overflow.patch new file mode 100644 index 0000000000..279a038315 --- /dev/null +++ b/office/misc/djvu/files/djvulibre-3.5.27-integer-overflow.patch @@ -0,0 +1,23 @@ +diff --git a/tools/ddjvu.cpp b/tools/ddjvu.cpp +index 7109952..b41f7d2 100644 +--- a/tools/ddjvu.cpp ++++ b/tools/ddjvu.cpp +@@ -70,6 +70,7 @@ + #include + #include + #include ++#include + + #ifdef UNIX + # include +@@ -394,7 +395,9 @@ render(ddjvu_page_t *page, int pageno) + rowsize = rrect.w; + else + rowsize = rrect.w * 3; +- if (! (image = (char*)malloc(rowsize * rrect.h))) ++ if ((size_t)rowsize > SIZE_MAX / rrect.h) ++ die(i18n("Integer overflow when allocating image buffer for page %d"), pageno); ++ if (! (image = (char*)malloc((size_t)rowsize * rrect.h))) + die(i18n("Cannot allocate image buffer for page %d"), pageno); + + /* Render */ diff --git a/office/misc/djvu/files/djvulibre-3.5.27-unsigned-short-overflow.patch b/office/misc/djvu/files/djvulibre-3.5.27-unsigned-short-overflow.patch new file mode 100644 index 0000000000..c7a6f3a78e --- /dev/null +++ b/office/misc/djvu/files/djvulibre-3.5.27-unsigned-short-overflow.patch @@ -0,0 +1,21 @@ +diff --git a/libdjvu/GBitmap.cpp b/libdjvu/GBitmap.cpp +index c2fdbe4..e271a1d 100644 +--- a/libdjvu/GBitmap.cpp ++++ b/libdjvu/GBitmap.cpp +@@ -69,6 +69,7 @@ + #include + #include + #include ++#include + + // - Author: Leon Bottou, 05/1997 + +@@ -1284,6 +1285,8 @@ GBitmap::decode(unsigned char *runs) + // initialize pixel array + if (nrows==0 || ncolumns==0) + G_THROW( ERR_MSG("GBitmap.not_init") ); ++ if (ncolumns > USHRT_MAX - border) ++ G_THROW("GBitmap: row size exceeds maximum (corrupted file?)"); + bytes_per_row = ncolumns + border; + if (runs==0) + G_THROW( ERR_MSG("GBitmap.null_arg") ); diff --git a/office/misc/djvu/files/no-pthread.diff b/office/misc/djvu/files/no-pthread.patch similarity index 70% rename from office/misc/djvu/files/no-pthread.diff rename to office/misc/djvu/files/no-pthread.patch index b9845b23be..00ab571b1f 100644 --- a/office/misc/djvu/files/no-pthread.diff +++ b/office/misc/djvu/files/no-pthread.patch @@ -1,7 +1,5 @@ -Index: djvulibre-3.5.22/config/acinclude.m4 -=================================================================== ---- djvulibre-3.5.22.orig/config/acinclude.m4 -+++ djvulibre-3.5.22/config/acinclude.m4 +--- a/config/acinclude.m4 ++++ b/config/acinclude.m4 @@ -408,7 +408,7 @@ case "${host_os}-${GCC}" in # On Linux/GCC, libtool uses -nostdlib for linking, which cancel part # of the -pthread flag effect (libpthread is not automatically linked). diff --git a/office/misc/djvu/files/out_of_bounce_write_in_function.patch b/office/misc/djvu/files/out_of_bounce_write_in_function.patch new file mode 100644 index 0000000000..07e74d39ed --- /dev/null +++ b/office/misc/djvu/files/out_of_bounce_write_in_function.patch @@ -0,0 +1,14 @@ +--- a/libdjvu/DjVuText.cpp ++++ b/libdjvu/DjVuText.cpp +@@ -345,9 +345,9 @@ + int textsize = bs.read24(); + char *buffer = textUTF8.getbuf(textsize); + int readsize = bs.read(buffer,textsize); ++ if (readsize < textsize || textsize <= 0) ++ G_THROW( ERR_MSG("DjVuText.corrupt_chunk") ); + buffer[readsize] = 0; +- if (readsize < textsize) +- G_THROW( ERR_MSG("DjVuText.corrupt_chunk") ); + // Try reading zones + unsigned char version; + if ( bs.read( (void*) &version, 1 ) == 1) diff --git a/office/misc/djvu/pspec.xml b/office/misc/djvu/pspec.xml index 6da6ace4a4..a40cd16be2 100644 --- a/office/misc/djvu/pspec.xml +++ b/office/misc/djvu/pspec.xml @@ -1,19 +1,19 @@ - + djvu - http://djvu.sourceforge.net + https://djvu.sourceforge.net/ PisiLinux Community admins@pisilinux.org - GPLv2 + GPL-2 app:gui library - DjVu viewers, encoders and utilities + DjVu viewers, encoders and utilities. DjVu is a web-centric format and software platform to distribute documents and images. - mirrors://sourceforge/djvu/djvulibre-3.5.27.tar.gz + mirrors://sourceforge/djvu/djvulibre-3.5.28.tar.gz libjpeg-turbo-devel tiff-devel @@ -21,8 +21,13 @@ libXt-devel - no-pthread.diff - djvulibre-3.5.22-cdefs.patch + no-pthread.patch + out_of_bounce_write_in_function.patch + djvulibre-3.5.27-check-image-size.patch + djvulibre-3.5.27-check-input-pool.patch + djvulibre-3.5.27-djvuport-stack-overflow.patch + djvulibre-3.5.27-integer-overflow.patch + djvulibre-3.5.27-unsigned-short-overflow.patch @@ -32,6 +37,7 @@ shared-mime-info libjpeg-turbo tiff + libgcc /usr/bin @@ -44,6 +50,9 @@ /usr/share/doc /usr/share/man + + System.Package + @@ -59,6 +68,13 @@ + + 2022-11-10 + 3.5.28 + Version bump. + fury + uglyside@yandex.ru + 2018-08-08 3.5.27