Skip to contentSkip to conversation

ghostscript : CVE-2016-10219, CVE-2016-10220, CVE-2017-5951

PATCH New Catalin Enache 1 participant 1 message Apr 21, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ghostscript : CVE-2016-10219, CVE-2016-10220, CVE-2017-5951

The intersect function in base/gxfill.c in Artifex Software, Inc. Ghostscript 9.20 allows remote attackers to cause a denial of service (divide-by-zero error and application crash) via a crafted file.

The gs_makewordimagedevice function in base/gsdevmem.c in Artifex Software, Inc. Ghostscript 9.20 allows remote attackers to cause a denial of service (NULL pointer dereference and application crash) via a crafted file that is mishandled in the PDF Transparency module.

The mem_get_bits_rectangle function in base/gdevmem.c in Artifex Software, Inc. Ghostscript 9.20 allows remote attackers to cause a denial of service (NULL pointer dereference and application crash) via a crafted file.

References:
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10219
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10220
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-5951

Upstream patches:
http://git.ghostscript.com/?p=ghostpdl.git;h=4bef1a1d32e29b68855616020dbff574b9cda08f
http://git.ghostscript.com/?p=ghostpdl.git;h=daf85701dab05f17e924a48a81edc9195b4a04e8
http://git.ghostscript.com/?p=ghostpdl.git;h=bfa6b2ecbe48edc69a7d9d22a12419aed25960b8

---
 .../ghostscript/ghostscript/CVE-2016-10219.patch   | 49 +++++++++++++++++++
 .../ghostscript/ghostscript/CVE-2016-10220.patch   | 55 ++++++++++++++++++++++
 .../ghostscript/ghostscript/CVE-2017-5951.patch    | 44 +++++++++++++++++
 .../ghostscript/ghostscript_9.20.bb                |  3 ++
 4 files changed, 151 insertions(+)
 create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2016-10219.patch
 create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2016-10220.patch
 create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2017-5951.patch
meta/recipes-extended/ghostscript/ghostscript/CVE-2016-10219.patch new file +49 -0
new file mode 100644
index 0000000..574abe0
@@ -0,0 +1,49 @@
+From 4bef1a1d32e29b68855616020dbff574b9cda08f Mon Sep 17 00:00:00 2001
+From: Robin Watts <[email protected]>
+Date: Thu, 29 Dec 2016 15:57:43 +0000
+Subject: [PATCH] Bug 697453: Avoid divide by 0 in scan conversion code.
+
+Arithmetic overflow due to extreme values in the scan conversion
+code can cause a division by 0.
+
+Avoid this with a simple extra check.
+
+  dx_old=cf814d81
+  endp->x_next=b0e859b9
+  alp->x_next=8069a73a
+
+leads to dx_den = 0
+
+Upstream-Status: Backport
+CVE: CVE-2016-10219
+
+Signed-off-by: Catalin Enache <[email protected]>
+---
+ base/gxfill.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/base/gxfill.c b/base/gxfill.c
+index 99196c0..2f81bb0 100644
+--- a/base/gxfill.c
++++ b/base/gxfill.c
+@@ -1741,7 +1741,7 @@ intersect(active_line *endp, active_line *alp, fixed y, fixed y1, fixed *p_y_new
+     fixed dx_old = alp->x_current - endp->x_current;
+     fixed dx_den = dx_old + endp->x_next - alp->x_next;
+ 
+-    if (dx_den <= dx_old)
++    if (dx_den <= dx_old || dx_den == 0)
+         return false; /* Intersection isn't possible. */
+     dy = y1 - y;
+     if_debug3('F', "[F]cross: dy=%g, dx_old=%g, dx_new=%g\n",
+@@ -1750,7 +1750,7 @@ intersect(active_line *endp, active_line *alp, fixed y, fixed y1, fixed *p_y_new
+     /* Do the computation in single precision */
+     /* if the values are small enough. */
+     y_new =
+-        ((dy | dx_old) < 1L << (size_of(fixed) * 4 - 1) ?
++        (((ufixed)(dy | dx_old)) < (1L << (size_of(fixed) * 4 - 1)) ?
+          dy * dx_old / dx_den :
+          (INCR_EXPR(mq_cross), fixed_mult_quo(dy, dx_old, dx_den)))
+         + y;
+-- 
+2.10.2
+
meta/recipes-extended/ghostscript/ghostscript/CVE-2016-10220.patch new file +55 -0

55 lines not on this page · raw message

meta/recipes-extended/ghostscript/ghostscript/CVE-2017-5951.patch new file +44 -0

44 lines not on this page · raw message

meta/recipes-extended/ghostscript/ghostscript_9.20.bb +3 -0
index e8fc5df..3c8a2e6 100644
@@ -32,6 +32,9 @@ SRC_URI = "${SRC_URI_BASE} \
            file://objarch.h \
            file://cups-no-gcrypt.patch \
            file://CVE-2017-7207.patch \
+           file://CVE-2016-10219.patch \
+           file://CVE-2016-10220.patch \
+           file://CVE-2017-5951.patch \
            "
 
 SRC_URI_class-native = "${SRC_URI_BASE} \
Signature · 1 line
2.10.2