All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Vetter <jubalh@iodoru.org>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 3/3] package/jasper: Apply fix for CVE-2018-19540
Date: Mon,  2 Dec 2019 12:59:34 +0100	[thread overview]
Message-ID: <20191202115934.24216-3-jubalh@iodoru.org> (raw)
In-Reply-To: <20191202115934.24216-1-jubalh@iodoru.org>

Add 0003-test-asclen-CVE-2018-19540.patch:
If txtdesc->asclen is < 1, the array index of
txtdesc->ascdata will be negative which causes the heap based overflow.

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/198
Signed-off-by: Michael Vetter <jubalh@iodoru.org>
---
 .../jasper/0003-test-asclen-CVE-2018-19540.patch   | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 package/jasper/0003-test-asclen-CVE-2018-19540.patch

diff --git a/package/jasper/0003-test-asclen-CVE-2018-19540.patch b/package/jasper/0003-test-asclen-CVE-2018-19540.patch
new file mode 100644
index 0000000000..ea73d5d781
--- /dev/null
+++ b/package/jasper/0003-test-asclen-CVE-2018-19540.patch
@@ -0,0 +1,29 @@
+From e38454aa1a15b78c028a778fc8bfba3587e25c25 Mon Sep 17 00:00:00 2001
+From: Michael Vetter <jubalh@iodoru.org>
+Date: Fri, 15 Mar 2019 11:01:02 +0100
+Subject: [PATCH] Make sure asclen is at least 1
+
+If txtdesc->asclen is < 1, the array index of txtdesc->ascdata will be negative which causes the heap based overflow.
+
+Regards CVE-2018-19540.
+Regards https://github.com/mdadams/jasper/issues/182 bug#3
+Fix by Markus Koschany <apo@debian.org>.
+From https://gist.github.com/apoleon/13598a45bf6522f6a79b77a629205823
+Signed-off-by: Michael Vetter <jubalh@iodoru.org>
+---
+ src/libjasper/base/jas_icc.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/libjasper/base/jas_icc.c b/src/libjasper/base/jas_icc.c
+index 4607930..762c0e8 100644
+--- a/src/libjasper/base/jas_icc.c
++++ b/src/libjasper/base/jas_icc.c
+@@ -1104,6 +1104,8 @@ static int jas_icctxtdesc_input(jas_iccattrval_t *attrval, jas_stream_t *in,
+ 	if (jas_stream_read(in, txtdesc->ascdata, txtdesc->asclen) !=
+ 	  JAS_CAST(int, txtdesc->asclen))
+ 		goto error;
++	if (txtdesc->asclen < 1)
++		goto error;
+ 	txtdesc->ascdata[txtdesc->asclen - 1] = '\0';
+ 	if (jas_iccgetuint32(in, &txtdesc->uclangcode) ||
+ 	  jas_iccgetuint32(in, &txtdesc->uclen))
-- 
2.16.4

  parent reply	other threads:[~2019-12-02 11:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Michael Vetter [this message]
2019-12-02 12:43   ` [Buildroot] [PATCH 3/3] package/jasper: Apply fix for CVE-2018-19540 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  9:51 ` [Buildroot] [PATCH 3/3] package/jasper: Apply fix for CVE-2018-19540 Michael Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191202115934.24216-3-jubalh@iodoru.org \
    --to=jubalh@iodoru.org \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.