aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancesco Colista <fcolista@alpinelinux.org>2018-06-06 12:20:21 +0000
committerFrancesco Colista <fcolista@alpinelinux.org>2018-06-06 12:20:21 +0000
commit89fe29bbad9afaa38e91399e623b77a726e77594 (patch)
tree801b55ea61a8021d246613c0bc2819b0993c8a1e
parent4d3e21cd9e4a1ac17bd8582d2daf97d3e909b6c9 (diff)
downloadaports-89fe29bbad9afaa38e91399e623b77a726e77594.tar.bz2
aports-89fe29bbad9afaa38e91399e623b77a726e77594.tar.xz
main/openjpeg: security fix for CVE-2017-14039. Fixes #7829
-rw-r--r--main/openjpeg/APKBUILD20
-rw-r--r--main/openjpeg/CVE-2017-14039.patch72
2 files changed, 77 insertions, 15 deletions
diff --git a/main/openjpeg/APKBUILD b/main/openjpeg/APKBUILD
index 3c89a34529..a69b6d9de6 100644
--- a/main/openjpeg/APKBUILD
+++ b/main/openjpeg/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer:
pkgname=openjpeg
pkgver=2.2.0
-pkgrel=0
+pkgrel=1
pkgdesc="Open-source implementation of JPEG2000 image codec"
url="http://www.openjpeg.org/"
arch="all"
@@ -14,6 +14,7 @@ install=""
subpackages="$pkgname-dev $pkgname-tools"
source="$pkgname-$pkgver.tar.gz::https://github.com/uclouvain/openjpeg/archive/v$pkgver.tar.gz
CVE-2017-12982.patch
+ CVE-2017-14039.patch
CVE-2017-14040.patch
CVE-2017-14041.patch
CVE-2017-14151.patch
@@ -34,6 +35,8 @@ build() {
}
# secfixes:
+# 2.2.0-r1:
+# - CVE-2017-14039
# 2.2.0-r0:
# - CVE-2017-14040
# - CVE-2017-14041
@@ -57,22 +60,9 @@ tools() {
mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
}
-md5sums="269bb0b175476f3addcc0d03bd9a97b6 openjpeg-2.2.0.tar.gz
-8dac6b8c8cb72f43e59ce785ea07eb32 CVE-2017-12982.patch
-2f16d123a34518bd2d89020f1d7b5bfe CVE-2017-14040.patch
-f9eb736858243cef1e93479c9cb035a6 CVE-2017-14041.patch
-d181ddab2dfc27b025a79b4b0de05fbb CVE-2017-14151.patch
-77cadc5bc2891ed79669b330bf22c41e CVE-2017-14152.patch
-2a145c081ee1f02c97d68f469e9bbf14 CVE-2017-14164.patch"
-sha256sums="6fddbce5a618e910e03ad00d66e7fcd09cc6ee307ce69932666d54c73b7c6e7b openjpeg-2.2.0.tar.gz
-2693934f4e57a57ec28f9b4fa7664c79e8a200910ef7fbe41a72b8cf1e5b711f CVE-2017-12982.patch
-d3edf997981dade53f44fb0659eff297db4fb44d197ef1d3ad0861a061221995 CVE-2017-14040.patch
-62acd64dfb0aa17135b9b2fa7bdf032ab77524e29f3a817a8309a2fe04828593 CVE-2017-14041.patch
-c07fee74428ce8ced1de20785e20f26974f57cd75bb64d30e9534ed156e0004b CVE-2017-14151.patch
-7b8d8ed43cbf85331b876eea10263c8fbbbcb5bacc38ce014d3d859d095d8090 CVE-2017-14152.patch
-a764be45f861650c56fccca7bf74ae40329e6cdf1fe59be84bb0250f9e1dee94 CVE-2017-14164.patch"
sha512sums="20651c380bee582ab1950994c424cc00061ad852e9c5438fb32a9809e3f275571a4cc7e92589add0d91debf2394262e58f441c2dd918809fc1c602ed68396a3a openjpeg-2.2.0.tar.gz
0e0ce7bdf53c4b6f1b2e9e5f855186763a1bea39b70bdc1fd5b60a5516036a04562cb43030e9946972009e3733d0efadb8ba4825939e32ba6b9419d6428ee9ad CVE-2017-12982.patch
+15964d218c3f661a1b768fe6dca6bc42b733c2ec3de6eec9f4241a9ccb31a8ad097882d589af1ec8d951d85a6b12d8298e34dc60edc774932a4c0a0957c7e7a6 CVE-2017-14039.patch
532c268346ad6993d7085652fbebe65ec0412a8d12771b86c325ef9f1cb6e0f7252ac95dfb976fa00ecfffd7b140ddc74b2964b04764e0803fb7e8c344a2b58a CVE-2017-14040.patch
d22735e20c7b08bb292bfda03a659481466a152294c388854aed3623ff769aed6c6491a8e6286b4dfdc8212a465b1596232e51fe8e8ba3a608ebf27b32d33d56 CVE-2017-14041.patch
66019c7a30a6b6303992d518b8184e57b58824f8b63bc8857436aa404257bf1f1d64ab6100a5f0ed18fa1b41c09501e77230207ca028bc16db35fc2d834a6506 CVE-2017-14151.patch
diff --git a/main/openjpeg/CVE-2017-14039.patch b/main/openjpeg/CVE-2017-14039.patch
new file mode 100644
index 0000000000..b8fcea0bbb
--- /dev/null
+++ b/main/openjpeg/CVE-2017-14039.patch
@@ -0,0 +1,72 @@
+From c535531f03369623b9b833ef41952c62257b507e Mon Sep 17 00:00:00 2001
+From: Even Rouault <even.rouault@spatialys.com>
+Date: Wed, 16 Aug 2017 17:20:29 +0200
+Subject: [PATCH] opj_t2_encode_packet(): fix potential write heap buffer
+ overflow (#992)
+
+---
+ src/lib/openjp2/j2k.c | 7 ++++++-
+ src/lib/openjp2/t2.c | 18 ++++++++++++++++++
+ 2 files changed, 24 insertions(+), 1 deletion(-)
+
+diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c
+index 16915452e..6c1f55f47 100644
+--- a/src/lib/openjp2/j2k.c
++++ b/src/lib/openjp2/j2k.c
+@@ -4215,7 +4215,6 @@ static OPJ_BOOL opj_j2k_write_sot(opj_j2k_t *p_j2k,
+ assert(p_stream != 00);
+
+ OPJ_UNUSED(p_stream);
+- OPJ_UNUSED(p_manager);
+
+ if (p_total_data_size < 12) {
+ opj_event_msg(p_manager, EVT_ERROR,
+@@ -4617,6 +4616,12 @@ static OPJ_BOOL opj_j2k_write_sod(opj_j2k_t *p_j2k,
+
+ OPJ_UNUSED(p_stream);
+
++ if (p_total_data_size < 4) {
++ opj_event_msg(p_manager, EVT_ERROR,
++ "Not enough bytes in output buffer to write SOD marker\n");
++ return OPJ_FALSE;
++ }
++
+ opj_write_bytes(p_data, J2K_MS_SOD,
+ 2); /* SOD */
+ p_data += 2;
+diff --git a/src/lib/openjp2/t2.c b/src/lib/openjp2/t2.c
+index 9d31acda8..0fd5300c6 100644
+--- a/src/lib/openjp2/t2.c
++++ b/src/lib/openjp2/t2.c
+@@ -629,6 +629,15 @@ static OPJ_BOOL opj_t2_encode_packet(OPJ_UINT32 tileno,
+
+ /* <SOP 0xff91> */
+ if (tcp->csty & J2K_CP_CSTY_SOP) {
++ if (length < 6) {
++ if (p_t2_mode == FINAL_PASS) {
++ opj_event_msg(p_manager, EVT_ERROR,
++ "opj_t2_encode_packet(): only %u bytes remaining in "
++ "output buffer. %u needed.\n",
++ length, 6);
++ }
++ return OPJ_FALSE;
++ }
+ c[0] = 255;
+ c[1] = 145;
+ c[2] = 0;
+@@ -817,6 +826,15 @@ static OPJ_BOOL opj_t2_encode_packet(OPJ_UINT32 tileno,
+
+ /* <EPH 0xff92> */
+ if (tcp->csty & J2K_CP_CSTY_EPH) {
++ if (length < 2) {
++ if (p_t2_mode == FINAL_PASS) {
++ opj_event_msg(p_manager, EVT_ERROR,
++ "opj_t2_encode_packet(): only %u bytes remaining in "
++ "output buffer. %u needed.\n",
++ length, 2);
++ }
++ return OPJ_FALSE;
++ }
+ c[0] = 255;
+ c[1] = 146;
+ c += 2;