summaryrefslogtreecommitdiff
path: root/media-libs/jbig2dec
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-08-25 10:45:55 +0100
committerV3n3RiX <venerix@redcorelinux.org>2020-08-25 10:45:55 +0100
commit3cf7c3ef441822c889356fd1812ebf2944a59851 (patch)
treec513fe68548b40365c1c2ebfe35c58ad431cdd77 /media-libs/jbig2dec
parent05b8b0e0af1d72e51a3ee61522941bf7605cd01c (diff)
gentoo resync : 25.08.2020
Diffstat (limited to 'media-libs/jbig2dec')
-rw-r--r--media-libs/jbig2dec/Manifest9
-rw-r--r--media-libs/jbig2dec/files/jbig2dec-0.17-fix-test_jbig2dec.py.patch39
-rw-r--r--media-libs/jbig2dec/files/jbig2dec-0.18-extra-overflow-checks.patch51
-rw-r--r--media-libs/jbig2dec/files/jbig2dec-0.18-overflow-IAID.patch36
-rw-r--r--media-libs/jbig2dec/jbig2dec-0.14.ebuild44
-rw-r--r--media-libs/jbig2dec/jbig2dec-0.18.ebuild (renamed from media-libs/jbig2dec/jbig2dec-0.17-r1.ebuild)11
6 files changed, 99 insertions, 91 deletions
diff --git a/media-libs/jbig2dec/Manifest b/media-libs/jbig2dec/Manifest
index 57107a08f180..41092d4ce80c 100644
--- a/media-libs/jbig2dec/Manifest
+++ b/media-libs/jbig2dec/Manifest
@@ -1,7 +1,6 @@
-AUX jbig2dec-0.17-fix-test_jbig2dec.py.patch 1550 BLAKE2B 274b37da363b9d09ae98fdba32b9d319b8e8646cabbdcd2d48defecae6fe048dc0d909906fa6096b2c1934267c91e217d2cdd348368fadd4256801884f098acd SHA512 f098733ca2aed78f3f45b821b6eb21cf268d64e715169b2683419116f83cc293c3d38e364d8edb44db3f414e5c911d7b51af8231e332e423ac210b3b513c605f
+AUX jbig2dec-0.18-extra-overflow-checks.patch 2490 BLAKE2B 1a60208ec6b219c9735330d38cfd8ac1d5304e929c263caaf22957cdd659e8a22ed181da200cbbb13fd9c26629d952ea75fb1dd744fe996abc8f032c77dbc149 SHA512 1a4e03bec23cb06783a1ce3b239e7e026b0d637e297caac62702fd3e1e6b6c6c28c814b5253837e6cd8a4275a36e9db485893b435ecf2b46063be258713a60a7
+AUX jbig2dec-0.18-overflow-IAID.patch 1285 BLAKE2B d2733f588b57af91ea40844750a888003d14491dcf71123c9e36f2533189f906668eb1f583ad7ca8759215d772f06153f4ac0ff98b22d4e12540e55d8e32e580 SHA512 d78bac4088d6a0cff3965f16042a0993b10b281d8a03fe282cfc896fe4bdbb18e1aec6c60e245d3531ab95fde62991be98c56a2455c8a5fa38e78239092b527d
DIST jb2streams.zip 1285838 BLAKE2B 9a2b6047a7b970439693d6f5fdefb9488019a562e7f831288b27df09bb19dec2f84854cf7fea50b5b041d331e925145f37f2f89848058ecdc074e7d6c238033f SHA512 382890b36345b8aaebb3554e776a53f3276c6d835335ce41f3f41829ff62bba7ae646602544103ba8541a7a824dca92d682b682c254ab2918c7fe45b3e358b45
-DIST jbig2dec-0.14.tar.gz 463572 BLAKE2B 91351a3879bd1906fabe2620cf5379fbbc32eaae808a8c2754c661d6dc592d3c9da13c558c8f7ced30c48b73fbd9ed4631f2817298f959b59ad4dff5fce9ac1a SHA512 066bd880ac0665fc1e42b0ae0e481008b125aab6e173b7f82d61a2a30e72c90085cbded9b2a68c6836f92dea3d8d8d5c2228dba76e0d99c79c922197d215705b
-DIST jbig2dec-0.17.tar.gz 141195 BLAKE2B 858befb59c0b943cddbc4ae2e9ffc6cdb7e1dd2185cedbffb577f0152f27a548f565548b4b0a4867e3973692b8b019a565eabe2cf672334a6b2994fd7988dcaf SHA512 79b3957186a30fc304ecd571d31c5cc421364921eb4eba242c3ea941ea111f461773f86c975657fa2ce91f2f79ff9abf760ef9bed404c7a4f35c036e5642ba0f
-EBUILD jbig2dec-0.14.ebuild 1141 BLAKE2B 5bec117e5f087d42b74bc9e665ea82ef0091d93e7abaa0bebcbb6f48a7c56a4069858921a8f03955db98ad2c50074a9e977bc66d644b2cff6b897ba8e656eb57 SHA512 0fabea3ebe23edd6b29ab513f1e37de10b7c374fd27b098ea12ecdef583757779b384464c72323cd95d0125da0b04341bce8793c97efc8522f75359bf1e8de0a
-EBUILD jbig2dec-0.17-r1.ebuild 1615 BLAKE2B 0a67e44adf16face69d8a4eaa56fe437f40253cc49364c71d81d6c7dda4d0e71e53e299f71738d238cf7ed92130f72e9b6c0b5a137793566bd25961f366f1005 SHA512 8832d6c0b9d649e620950c5f348ecd59e488450cbd356c66ce49ff1f4447c3626b97140d24b5dae9fd5530b374ef9a4d4a27247c48c8974bb92e62c6faae9e57
+DIST jbig2dec-0.18.tar.gz 148563 BLAKE2B a864fd5b00abca3ae0f847c1d8fd537d92d68a3c042c851b6bebd51bb674f5bc4a36811f2b4fd7753db4d3641e544e03ec184cb90d43da0247d8affd7cf62c11 SHA512 5931530ee3b811f9009c95d08ad65701564ef8ebf6511145acb969cc7c99dab5028daaee580dd83358b6bdc477cffe347712b9c9768c9b1a63395e366046267d
+EBUILD jbig2dec-0.18.ebuild 1655 BLAKE2B d1039e26d0b0a7573b0a8c1c60b109a70d8d5e0d9aa2dd3918037405e6470ac3a6ff5d2b82fbb587526efd739bf55aad54a2c4314fb6a102a23537157b4452f1 SHA512 39af2ce59fe84344f6fc8a6b366af223a3c34d27e61e0bfa2b68081386c13fadc78311554a8ba404cab9ef0c16e4adf1ce56039c6e1bfe5e8c7d5de2e92215fc
MISC metadata.xml 347 BLAKE2B 6c6d66bb933731270b688e7f0d9174f3cac5e697d30af47398425b7f3789e6960f87a67c192d931603c0120622839a92ad93bb6154c1ceecf07ba2827488f001 SHA512 7472b2c0abdc9db46fc886ba58d9c9daf16efc76d306087b4ccec7bffdb1ddf034f433ede85681a7bb2b87d7959f7eef557743c9fbde7891efd4e3c5058aeda7
diff --git a/media-libs/jbig2dec/files/jbig2dec-0.17-fix-test_jbig2dec.py.patch b/media-libs/jbig2dec/files/jbig2dec-0.17-fix-test_jbig2dec.py.patch
deleted file mode 100644
index e99a298f5de9..000000000000
--- a/media-libs/jbig2dec/files/jbig2dec-0.17-fix-test_jbig2dec.py.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From c48d802aa6f65cc0284c8aa9824b6ae4e7dd5aa1 Mon Sep 17 00:00:00 2001
-From: Sebastian Rasmussen <sebras@gmail.com>
-Date: Fri, 14 Jun 2019 22:18:14 +0200
-Subject: [PATCH] jbig2dec: Make tests expect that some test files return white
- image.
-
-Previously these tests would just error out and jbig2dec would not
-return any output file at all. Now, jbig2dec parses as much as
-possible, while emitting warning/error messages. In the case of a
-few of the test files the end result is a white image.
----
- test_jbig2dec.py | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/test_jbig2dec.py b/test_jbig2dec.py
-index a841438..33008e5 100755
---- a/test_jbig2dec.py
-+++ b/test_jbig2dec.py
-@@ -60,6 +60,7 @@ class KnownFileHash(SelfTest):
-
- # hashes of known test inputs
- known_NOTHING_DECODED = "da39a3ee5e6b4b0d3255bfef95601890afd80709"
-+ known_WHITE_PAGE_DECODED = "28a6bd83a8a3a36910fbc1f5ce06c962e4332911"
- known_042_DECODED = "ebfdf6e2fc5ff3ee2271c2fa19de0e52712046e8"
- known_amb_DECODED = "3d4b7992d506894662b53415bd3d0d2a2f8b7953"
-
-@@ -103,10 +104,10 @@ class KnownFileHash(SelfTest):
- known_042_DECODED),
- ('../ubc/042_13.jb2',
- "7d428bd542f58591b254d9827f554b0552c950a7",
-- known_NOTHING_DECODED),
-+ known_WHITE_PAGE_DECODED),
- ('../ubc/042_14.jb2',
- "c40fe3a02acb6359baf9b40fc9c49bc0800be589",
-- known_NOTHING_DECODED),
-+ known_WHITE_PAGE_DECODED),
- ('../ubc/042_15.jb2',
- "a9e39fc1ecb178aec9f05039514d75ea3246246c",
- known_042_DECODED),
diff --git a/media-libs/jbig2dec/files/jbig2dec-0.18-extra-overflow-checks.patch b/media-libs/jbig2dec/files/jbig2dec-0.18-extra-overflow-checks.patch
new file mode 100644
index 000000000000..52a7f448e6f3
--- /dev/null
+++ b/media-libs/jbig2dec/files/jbig2dec-0.18-extra-overflow-checks.patch
@@ -0,0 +1,51 @@
+https://github.com/ArtifexSoftware/jbig2dec/commit/873694419b3498708b90c5c36ee0a73795a90c84
+----
+From 873694419b3498708b90c5c36ee0a73795a90c84 Mon Sep 17 00:00:00 2001
+From: Sebastian Rasmussen <sebras@gmail.com>
+Date: Sun, 15 Sep 2019 17:31:48 +0200
+Subject: [PATCH] jbig2dec: Handle under-/overflow detection and messaging
+ better.
+
+Previously SYMWIDTH was capped too early in order to prevent underflow
+Moreover TOTWIDTH was allowed to overflow.
+
+Now the value DW is checked compared to SYMWIDTH, preventing over
+underflow and overflow at the correct limits, and an overflow
+check has been added for TOTWIDTH.
+---
+ jbig2_symbol_dict.c | 18 ++++++++++++++----
+ 1 file changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/jbig2_symbol_dict.c b/jbig2_symbol_dict.c
+index e606529..bc6e98c 100644
+--- a/jbig2_symbol_dict.c
++++ b/jbig2_symbol_dict.c
+@@ -428,14 +428,24 @@ jbig2_decode_symbol_dict(Jbig2Ctx *ctx,
+ break;
+ }
+
++ if (DW < 0 && SYMWIDTH < (uint32_t) -DW) {
++ code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "DW value (%d) would make SYMWIDTH (%u) negative at symbol %u", DW, SYMWIDTH, NSYMSDECODED + 1);
++ goto cleanup;
++ }
++ if (DW > 0 && DW > UINT32_MAX - SYMWIDTH) {
++ code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "DW value (%d) would make SYMWIDTH (%u) too large at symbol %u", DW, SYMWIDTH, NSYMSDECODED + 1);
++ goto cleanup;
++ }
++
+ SYMWIDTH = SYMWIDTH + DW;
+- TOTWIDTH = TOTWIDTH + SYMWIDTH;
+- if ((int32_t) SYMWIDTH < 0) {
+- code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "invalid SYMWIDTH value (%d) at symbol %d", SYMWIDTH, NSYMSDECODED + 1);
++ if (SYMWIDTH > UINT32_MAX - TOTWIDTH) {
++ code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "SYMWIDTH value (%u) would make TOTWIDTH (%u) too large at symbol %u", SYMWIDTH, TOTWIDTH, NSYMSDECODED + 1);
+ goto cleanup;
+ }
++
++ TOTWIDTH = TOTWIDTH + SYMWIDTH;
+ #ifdef JBIG2_DEBUG
+- jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "SYMWIDTH = %d TOTWIDTH = %d", SYMWIDTH, TOTWIDTH);
++ jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "SYMWIDTH = %u TOTWIDTH = %u", SYMWIDTH, TOTWIDTH);
+ #endif
+ /* 6.5.5 (4c.ii) */
+ if (!params->SDHUFF || params->SDREFAGG) {
diff --git a/media-libs/jbig2dec/files/jbig2dec-0.18-overflow-IAID.patch b/media-libs/jbig2dec/files/jbig2dec-0.18-overflow-IAID.patch
new file mode 100644
index 000000000000..7205c980fc28
--- /dev/null
+++ b/media-libs/jbig2dec/files/jbig2dec-0.18-overflow-IAID.patch
@@ -0,0 +1,36 @@
+https://github.com/ArtifexSoftware/jbig2dec/commit/f6d326878893dc92b45cbd18e25ab4d2b3a8db73
+----
+From f6d326878893dc92b45cbd18e25ab4d2b3a8db73 Mon Sep 17 00:00:00 2001
+From: Sebastian Rasmussen <sebras@gmail.com>
+Date: Sun, 15 Sep 2019 18:12:31 +0200
+Subject: [PATCH] jbig2dec: Add overflow detection for IAID context size.
+
+---
+ jbig2_arith_iaid.c | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/jbig2_arith_iaid.c b/jbig2_arith_iaid.c
+index 78dc830..bbc38a0 100644
+--- a/jbig2_arith_iaid.c
++++ b/jbig2_arith_iaid.c
+@@ -44,9 +44,18 @@ struct _Jbig2ArithIaidCtx {
+ Jbig2ArithIaidCtx *
+ jbig2_arith_iaid_ctx_new(Jbig2Ctx *ctx, int SBSYMCODELEN)
+ {
+- Jbig2ArithIaidCtx *result = jbig2_new(ctx, Jbig2ArithIaidCtx, 1);
+- int ctx_size = 1 << SBSYMCODELEN;
++ Jbig2ArithIaidCtx *result;
++ size_t ctx_size;
+
++ if (sizeof(ctx_size) * 8 <= SBSYMCODELEN)
++ {
++ jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "requested IAID arithmetic coding state size too large");
++ return NULL;
++ }
++
++ ctx_size = 1 << SBSYMCODELEN;
++
++ result = jbig2_new(ctx, Jbig2ArithIaidCtx, 1);
+ if (result == NULL) {
+ jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to allocate IAID arithmetic coding state");
+ return NULL;
diff --git a/media-libs/jbig2dec/jbig2dec-0.14.ebuild b/media-libs/jbig2dec/jbig2dec-0.14.ebuild
deleted file mode 100644
index 4b9601c3e6c3..000000000000
--- a/media-libs/jbig2dec/jbig2dec-0.14.ebuild
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-DESCRIPTION="A decoder implementation of the JBIG2 image compression format"
-HOMEPAGE="http://ghostscript.com/jbig2dec.html"
-SRC_URI="http://downloads.ghostscript.com/public/${PN}/${P}.tar.gz
- test? ( http://jbig2dec.sourceforge.net/ubc/jb2streams.zip )"
-
-LICENSE="AGPL-3"
-SLOT="0"
-KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="png static-libs test"
-
-RDEPEND="png? ( media-libs/libpng:0= )"
-DEPEND="${RDEPEND}
- test? ( app-arch/unzip )"
-
-RESTRICT="test"
-# bug 324275
-
-DOCS=( CHANGES README )
-
-src_prepare() {
- default
-
- if use test; then
- mkdir "${WORKDIR}/ubc" || die
- mv -v "${WORKDIR}"/*.jb2 "${WORKDIR}/ubc/" || die
- mv -v "${WORKDIR}"/*.bmp "${WORKDIR}/ubc/" || die
- fi
-}
-
-src_configure() {
- econf \
- $(use_enable static-libs static) \
- $(use_with png libpng)
-}
-
-src_install() {
- default
- find "${ED}" -name '*.la' -exec rm {} + || die
-}
diff --git a/media-libs/jbig2dec/jbig2dec-0.17-r1.ebuild b/media-libs/jbig2dec/jbig2dec-0.18.ebuild
index 3eefc412058c..44a2bb95f724 100644
--- a/media-libs/jbig2dec/jbig2dec-0.17-r1.ebuild
+++ b/media-libs/jbig2dec/jbig2dec-0.18.ebuild
@@ -3,7 +3,7 @@
EAPI=7
-PYTHON_COMPAT=( python3_{6,7} )
+PYTHON_COMPAT=( python3_{7,8,9} )
inherit autotools python-any-r1
@@ -22,14 +22,18 @@ BDEPEND="
test? (
app-arch/unzip
${PYTHON_DEPS}
- )"
+ )
+"
RDEPEND="png? ( media-libs/libpng:0= )"
DEPEND="${RDEPEND}"
DOCS=( CHANGES README )
-PATCHES=( "${FILESDIR}"/${PN}-0.17-fix-test_jbig2dec.py.patch )
+PATCHES=(
+ "${FILESDIR}/${P}-extra-overflow-checks.patch"
+ "${FILESDIR}/${P}-overflow-IAID.patch"
+)
pkg_setup() {
use test && python-any-r1_pkg_setup
@@ -64,5 +68,6 @@ src_configure() {
src_install() {
default
+
find "${ED}" -name '*.la' -exec rm {} + || die
}