djvu, bump to 3.5.29 (#13342)

This commit is contained in:
Schrijvers Luc
2025-12-08 09:43:52 +01:00
committed by GitHub
parent 656f283eb6
commit a7b141da40
3 changed files with 69 additions and 341 deletions

View File

@@ -6,16 +6,16 @@ COPYRIGHT="2002 Leon Bottou and Yann Le Cun.
2001 AT&T
1999-2001 LizardTech, Inc."
LICENSE="GNU GPL v2"
REVISION="2"
REVISION="1"
SOURCE_URI="http://downloads.sourceforge.net/project/djvu/DjVuLibre/$portVersion/djvulibre-$portVersion.tar.gz"
CHECKSUM_SHA256="fcd009ea7654fde5a83600eb80757bd3a76998e47d13c66b54c8db849f8f2edc"
CHECKSUM_SHA256="d3b4b03ae2bdca8516a36ef6eb27b777f0528c9eda26745d9962824a3fdfeccf"
SOURCE_DIR="djvulibre-$portVersion"
PATCHES="djvu-$portVersion.patchset"
ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"
libVersion="21.7.0"
libVersion="21.8.0"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
PROVIDES="

View File

@@ -1,338 +0,0 @@
From d8b8661e465ee6b44776c34442d03659d4478f56 Mon Sep 17 00:00:00 2001
From: Sergei Reznikov <diver@gelios.net>
Date: Wed, 25 Mar 2015 10:35:25 +0300
Subject: Fix build
diff --git a/libdjvu/miniexp.cpp b/libdjvu/miniexp.cpp
index 1077cab..b066e3e 100644
--- a/libdjvu/miniexp.cpp
+++ b/libdjvu/miniexp.cpp
@@ -1300,7 +1300,7 @@ static int stdio_fputs(miniexp_io_t *io, const char *s) {
static int true_stdio_fgetc(miniexp_io_t *io) {
FILE *f = (io->data[0]) ? (FILE*)(io->data[0]) : stdin;
- return ::getc(f);
+ return getc(f);
}
static int compat_getc() {
return true_stdio_fgetc(&miniexp_io);
--
2.37.3
From a6882b34e0e38f4e91abfbaa2b4391287320172c Mon Sep 17 00:00:00 2001
From: Sergei Reznikov <diver@gelios.net>
Date: Wed, 25 Mar 2015 10:45:06 +0300
Subject: Haiku: gcc2 fix
diff --git a/libdjvu/JB2Image.h b/libdjvu/JB2Image.h
index a87a83b..86a8bfa 100644
--- a/libdjvu/JB2Image.h
+++ b/libdjvu/JB2Image.h
@@ -329,6 +329,7 @@ private:
int top,left,right,bottom;
void compute_bounding_box(const GBitmap &cbm);
};
+public:
GTArray<LibRect> boxes;
void get_bounding_box(int shapeno, LibRect &dest);
};
--
2.37.3
From f3013d06e4cb5e79fff0cb372e0165e3c594a43c Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Thu, 28 Sep 2023 07:52:07 +0200
Subject: drop-register-keyword-clang16.patch from Gentoo
diff --git a/libdjvu/GBitmap.h b/libdjvu/GBitmap.h
index ca89a19..b579f5d 100644
--- a/libdjvu/GBitmap.h
+++ b/libdjvu/GBitmap.h
@@ -620,7 +620,7 @@ GBitmap::euclidian_ratio(int a, int b, int &q, int &r)
inline int
GBitmap::read_run(unsigned char *&data)
{
- register int z=*data++;
+ int z=*data++;
return (z>=RUNOVERFLOWVALUE)?
((z&~RUNOVERFLOWVALUE)<<8)|(*data++):z;
}
@@ -628,7 +628,7 @@ GBitmap::read_run(unsigned char *&data)
inline int
GBitmap::read_run(const unsigned char *&data)
{
- register int z=*data++;
+ int z=*data++;
return (z>=RUNOVERFLOWVALUE)?
((z&~RUNOVERFLOWVALUE)<<8)|(*data++):z;
}
--
2.37.3
From 1fb610c5ec3fae88c4ad6d26215a5b621d7b437d Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Thu, 28 Sep 2023 10:49:10 +0200
Subject: applying patch
0001-djvulibre-fedora-Patch0-djvulibre-3.5.22-cdefs.patch.patch
diff --git a/libdjvu/GSmartPointer.h b/libdjvu/GSmartPointer.h
index 8a8bb8a..08540f7 100644
--- a/libdjvu/GSmartPointer.h
+++ b/libdjvu/GSmartPointer.h
@@ -62,6 +62,8 @@
# pragma interface
#endif
+#include <cstddef>
+
/** @name GSmartPointer.h
Files #"GSmartPointer.h"# and #"GSmartPointer.cpp"# define a smart-pointer
--
2.37.3
From 51a79d4bc698521d7ef336d24febce8689cd1e69 Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Thu, 28 Sep 2023 10:49:10 +0200
Subject: applying patch
0002-djvulibre-fedora-Patch6-djvulibre-3.5.27-export-file.patch
diff --git a/desktopfiles/Makefile.am b/desktopfiles/Makefile.am
index 9e952e1..5b8cae3 100644
--- a/desktopfiles/Makefile.am
+++ b/desktopfiles/Makefile.am
@@ -32,10 +32,9 @@ if HAVE_CONVERSION_INKSCAPE
convert_icons_process = \
s=`echo $@ | sed -e 's/[a-z]*\([0-9]*\).*/\1/'`; \
${INKSCAPE} \
---without-gui \
--export-width=$${s} \
--export-height=$${s} \
---export-png=$@ $<
+--export-filename=$@ $<
endif
if HAVE_CONVERSION_CONVERT
--
2.37.3
From a349e3aaa44cfbe958935cfb4f1bf1bcc6b6f686 Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Thu, 28 Sep 2023 10:49:10 +0200
Subject: applying patch
0003-djvulibre-fedora-Patch8-djvulibre-3.5.27-check-image.patch
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<short> gdata16(data16,sz);
+ if (data16 == NULL)
+ G_THROW("IW44Image: unable to allocate image data");
// Copy coefficients
int i;
short *p = data16;
--
2.37.3
From 7270e7a7842ce4b2c789453618b1fa0fcc425ecb Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Thu, 28 Sep 2023 10:49:10 +0200
Subject: applying patch
0004-djvulibre-fedora-Patch9-djvulibre-3.5.27-interger-ov.patch
diff --git a/tools/ddjvu.cpp b/tools/ddjvu.cpp
index 7109952..2f3e0f9 100644
--- a/tools/ddjvu.cpp
+++ b/tools/ddjvu.cpp
@@ -70,6 +70,7 @@
#include <locale.h>
#include <fcntl.h>
#include <errno.h>
+#include <stdint.h>
#ifdef UNIX
# include <sys/time.h>
@@ -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 */
--
2.37.3
From d3491c280a8f0bfb7476e2f8e1c01945efb26a8e Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Thu, 28 Sep 2023 10:49:10 +0200
Subject: applying patch
0005-djvulibre-fedora-Patch10-djvulibre-3.5.27-check-inpu.patch
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<DataPool> & 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<DataPool> retval=xpool;
xpool->init();
--
2.37.3
From 92327dab0211d31391c6bd474e7cede41868426d Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Thu, 28 Sep 2023 10:49:10 +0200
Subject: applying patch
0006-djvulibre-fedora-Patch11-djvulibre-3.5.27-djvuport-s.patch
diff --git a/libdjvu/DjVuPort.cpp b/libdjvu/DjVuPort.cpp
index 2b3e0d2..a377920 100644
--- a/libdjvu/DjVuPort.cpp
+++ b/libdjvu/DjVuPort.cpp
@@ -507,10 +507,19 @@ GP<DjVuFile>
DjVuPortcaster::id_to_file(const DjVuPort * source, const GUTF8String &id)
{
GPList<DjVuPort> 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<DjVuFile> 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<DjVuPort> &list,
bool sorted=false);
+ GUTF8String opening_id;
};
--
2.37.3
From 33af189611e1a1fc02382be5ca0a2c8771b4ecf9 Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Thu, 28 Sep 2023 10:49:10 +0200
Subject: applying patch
0007-djvulibre-fedora-Patch12-djvulibre-3.5.27-unsigned-s.patch
diff --git a/libdjvu/GBitmap.cpp b/libdjvu/GBitmap.cpp
index c2fdbe4..3d552a6 100644
--- a/libdjvu/GBitmap.cpp
+++ b/libdjvu/GBitmap.cpp
@@ -69,6 +69,7 @@
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
// - 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") );
--
2.37.3
From 4f7c6da73feddee68408b94004a80ceb03c055d6 Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Thu, 28 Sep 2023 10:49:10 +0200
Subject: applying patch
0008-djvulibre-fedora-Patch13-djvulibre-3.5.27-out-o-2.patch
diff --git a/libdjvu/DjVuText.cpp b/libdjvu/DjVuText.cpp
index 60a4f39..9d893c2 100644
--- a/libdjvu/DjVuText.cpp
+++ b/libdjvu/DjVuText.cpp
@@ -345,7 +345,8 @@ DjVuTXT::decode(const GP<ByteStream> &gbs)
int textsize = bs.read24();
char *buffer = textUTF8.getbuf(textsize);
int readsize = bs.read(buffer,textsize);
- buffer[readsize] = 0;
+ if (buffer)
+ buffer[readsize] = 0;
if (readsize < textsize)
G_THROW( ERR_MSG("DjVuText.corrupt_chunk") );
// Try reading zones
--
2.37.3
From ebe3c69481a8fd3928baf92f13ee5f0d1cb4b185 Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Thu, 28 Sep 2023 11:29:36 +0200
Subject: Use freshly build djvused to create the documentation
diff --git a/doc/make-djvulibre-book-en.sh b/doc/make-djvulibre-book-en.sh
index bc56e53..673adcf 100755
--- a/doc/make-djvulibre-book-en.sh
+++ b/doc/make-djvulibre-book-en.sh
@@ -56,6 +56,6 @@ echo ")" >> $tmpdir/outline.txt
## plug outline
-djvused $book -e "set-outline $tmpdir/outline.txt" -s
+../tools/djvused $book -e "set-outline $tmpdir/outline.txt" -s
--
2.37.3

View File

@@ -0,0 +1,66 @@
From 36484ecaf926414f3fa4ae1095c25eaec5e491eb Mon Sep 17 00:00:00 2001
From: Sergei Reznikov <diver@gelios.net>
Date: Wed, 25 Mar 2015 10:35:25 +0300
Subject: Fix build
diff --git a/libdjvu/miniexp.cpp b/libdjvu/miniexp.cpp
index 644bc91..8b4c115 100644
--- a/libdjvu/miniexp.cpp
+++ b/libdjvu/miniexp.cpp
@@ -1326,7 +1326,7 @@ static int stdio_fputs(miniexp_io_t *io, const char *s) {
static int true_stdio_fgetc(miniexp_io_t *io) {
FILE *f = (io->data[0]) ? (FILE*)(io->data[0]) : stdin;
- return ::getc(f);
+ return getc(f);
}
static int compat_getc() {
return true_stdio_fgetc(&miniexp_io);
--
2.51.0
From 91924c1e7c912f4ea9de064d619ea56f639cefc8 Mon Sep 17 00:00:00 2001
From: Sergei Reznikov <diver@gelios.net>
Date: Wed, 25 Mar 2015 10:45:06 +0300
Subject: Haiku: gcc2 fix
diff --git a/libdjvu/JB2Image.h b/libdjvu/JB2Image.h
index a87a83b..86a8bfa 100644
--- a/libdjvu/JB2Image.h
+++ b/libdjvu/JB2Image.h
@@ -329,6 +329,7 @@ private:
int top,left,right,bottom;
void compute_bounding_box(const GBitmap &cbm);
};
+public:
GTArray<LibRect> boxes;
void get_bounding_box(int shapeno, LibRect &dest);
};
--
2.51.0
From 6ddaf52655597d552580b7df9dadbd32ad542172 Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Thu, 28 Sep 2023 11:29:36 +0200
Subject: Use freshly build djvused to create the documentation
diff --git a/doc/make-djvulibre-book-en.sh b/doc/make-djvulibre-book-en.sh
index bc56e53..673adcf 100755
--- a/doc/make-djvulibre-book-en.sh
+++ b/doc/make-djvulibre-book-en.sh
@@ -56,6 +56,6 @@ echo ")" >> $tmpdir/outline.txt
## plug outline
-djvused $book -e "set-outline $tmpdir/outline.txt" -s
+../tools/djvused $book -e "set-outline $tmpdir/outline.txt" -s
--
2.51.0