All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/3] package/jasper: Apply fix for CVE-2018-19541
@ 2019-12-02 11:59 Michael Vetter
  2019-12-02 11:59 ` [Buildroot] [PATCH 2/3] package/jasper: Apply fix for CVE-2018-19542 Michael Vetter
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Michael Vetter @ 2019-12-02 11:59 UTC (permalink / raw)
  To: buildroot

Add 0001-verify-data-range-CVE-2018-19541.patch:
We need to verify the data is in the expected range. Otherwise we get
problems later.

Patch was proposed upstream[1] but upstream is very inactive. Linux
distributions use the same fix to patch their packages.

1: https://github.com/mdadams/jasper/pull/211
Signed-off-by: Michael Vetter <jubalh@iodoru.org>
---
 .../0001-verify-data-range-CVE-2018-19541.patch    | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 package/jasper/0001-verify-data-range-CVE-2018-19541.patch

diff --git a/package/jasper/0001-verify-data-range-CVE-2018-19541.patch b/package/jasper/0001-verify-data-range-CVE-2018-19541.patch
new file mode 100644
index 0000000000..95812c4006
--- /dev/null
+++ b/package/jasper/0001-verify-data-range-CVE-2018-19541.patch
@@ -0,0 +1,35 @@
+From 24fc4d6f01d2d4c8297d1bebec02360f796e01c2 Mon Sep 17 00:00:00 2001
+From: Michael Vetter <jubalh@iodoru.org>
+Date: Mon, 4 Nov 2019 18:17:44 +0100
+Subject: [PATCH] Verify range data in jp2_pclr_getdata
+
+This fixes CVE-2018-19541.
+We need to verify the data is in the expected range. Otherwise we get
+problems later.
+
+This is a better fix for https://github.com/mdadams/jasper/pull/199
+which caused segfaults under certain circumstances.
+
+Patch by Adam Majer <adam.majer@suse.de>
+Signed-off-by: Michael Vetter <jubalh@iodoru.org>
+---
+ src/libjasper/jp2/jp2_cod.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/src/libjasper/jp2/jp2_cod.c b/src/libjasper/jp2/jp2_cod.c
+index 890e6ad..0f8d804 100644
+--- a/src/libjasper/jp2/jp2_cod.c
++++ b/src/libjasper/jp2/jp2_cod.c
+@@ -855,6 +855,12 @@ static int jp2_pclr_getdata(jp2_box_t *box, jas_stream_t *in)
+ 	  jp2_getuint8(in, &pclr->numchans)) {
+ 		return -1;
+ 	}
++
++    // verify in range data as per I.5.3.4 - Palette box
++    if (pclr->numchans < 1 || pclr->numlutents < 1 || pclr->numlutents > 1024) {
++        return -1;
++    }
++
+ 	lutsize = pclr->numlutents * pclr->numchans;
+ 	if (!(pclr->lutdata = jas_alloc2(lutsize, sizeof(int_fast32_t)))) {
+ 		return -1;
-- 
2.16.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [Buildroot] [PATCH 1/3] package/jasper: Apply fix for CVE-2018-19541
@ 2019-12-02  9:51 Michael Vetter
  2019-12-02 11:40 ` Peter Korsgaard
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Vetter @ 2019-12-02  9:51 UTC (permalink / raw)
  To: buildroot

Add 0001-verify-data-range-CVE-2018-19541.patch:
We need to verify the data is in the expected range. Otherwise we get
problems later.

Patch was proposed upstream[1] but upstream is very inactive. Linux
distributions use the same fix to patch their packages.

1: https://github.com/mdadams/jasper/pull/211
Signed-off-by: Michael Vetter <jubalh@iodoru.org>
---
 .../0001-verify-data-range-CVE-2018-19541.patch    | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 package/jasper/0001-verify-data-range-CVE-2018-19541.patch

diff --git a/package/jasper/0001-verify-data-range-CVE-2018-19541.patch b/package/jasper/0001-verify-data-range-CVE-2018-19541.patch
new file mode 100644
index 0000000000..95812c4006
--- /dev/null
+++ b/package/jasper/0001-verify-data-range-CVE-2018-19541.patch
@@ -0,0 +1,34 @@
+From 24fc4d6f01d2d4c8297d1bebec02360f796e01c2 Mon Sep 17 00:00:00 2001
+From: Michael Vetter <jubalh@iodoru.org>
+Date: Mon, 4 Nov 2019 18:17:44 +0100
+Subject: [PATCH] Verify range data in jp2_pclr_getdata
+
+This fixes CVE-2018-19541.
+We need to verify the data is in the expected range. Otherwise we get
+problems later.
+
+This is a better fix for https://github.com/mdadams/jasper/pull/199
+which caused segfaults under certain circumstances.
+
+Patch by Adam Majer <adam.majer@suse.de>
+---
+ src/libjasper/jp2/jp2_cod.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/src/libjasper/jp2/jp2_cod.c b/src/libjasper/jp2/jp2_cod.c
+index 890e6ad..0f8d804 100644
+--- a/src/libjasper/jp2/jp2_cod.c
++++ b/src/libjasper/jp2/jp2_cod.c
+@@ -855,6 +855,12 @@ static int jp2_pclr_getdata(jp2_box_t *box, jas_stream_t *in)
+ 	  jp2_getuint8(in, &pclr->numchans)) {
+ 		return -1;
+ 	}
++
++    // verify in range data as per I.5.3.4 - Palette box
++    if (pclr->numchans < 1 || pclr->numlutents < 1 || pclr->numlutents > 1024) {
++        return -1;
++    }
++
+ 	lutsize = pclr->numlutents * pclr->numchans;
+ 	if (!(pclr->lutdata = jas_alloc2(lutsize, sizeof(int_fast32_t)))) {
+ 		return -1;
-- 
2.16.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-12-06  8:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-02 11:59 [Buildroot] [PATCH 1/3] package/jasper: Apply fix for CVE-2018-19541 Michael Vetter
2019-12-02 11:59 ` [Buildroot] [PATCH 2/3] package/jasper: Apply fix for CVE-2018-19542 Michael Vetter
2019-12-02 12:42   ` Peter Korsgaard
2019-12-06  8:21   ` Peter Korsgaard
2019-12-02 11:59 ` [Buildroot] [PATCH 3/3] package/jasper: Apply fix for CVE-2018-19540 Michael Vetter
2019-12-02 12:43   ` Peter Korsgaard
2019-12-06  8:21   ` Peter Korsgaard
2019-12-02 12:42 ` [Buildroot] [PATCH 1/3] package/jasper: Apply fix for CVE-2018-19541 Peter Korsgaard
2019-12-06  8:21 ` Peter Korsgaard
2019-12-06  8:58 ` Peter Korsgaard
  -- strict thread matches above, loose matches on Subject: below --
2019-12-02  9:51 Michael Vetter
2019-12-02 11:40 ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.