Skip to contentSkip to conversation

ghostscript: backport fix for CVE-2023-38559

PATCH New [email protected] 1 participant 2 messages Aug 7, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ghostscript: backport fix for CVE-2023-38559

From: Ross Burton <[email protected]>

---
 ...pcx-buffer-overrun-fix-from-devices-.patch | 31 +++++++++++++++++++
 .../ghostscript/ghostscript_10.01.2.bb        |  1 +
 2 files changed, 32 insertions(+)
 create mode 100644 meta/recipes-extended/ghostscript/ghostscript/0001-Bug-706897-Copy-pcx-buffer-overrun-fix-from-devices-.patch
meta/recipes-extended/ghostscript/ghostscript/0001-Bug-706897-Copy-pcx-buffer-overrun-fix-from-devices-.patch new file +31 -0
new file mode 100644
index 00000000000..b29212fbc6c
@@ -0,0 +1,31 @@
+From d81b82c70bc1fb9991bb95f1201abb5dea55f57f Mon Sep 17 00:00:00 2001
+From: Chris Liddell <[email protected]>
+Date: Mon, 17 Jul 2023 14:06:37 +0100
+Subject: [PATCH] Bug 706897: Copy pcx buffer overrun fix from
+ devices/gdevpcx.c
+
+Bounds check the buffer, before dereferencing the pointer.
+
+CVE: CVE-2023-38559
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <[email protected]>
+---
+ base/gdevdevn.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/base/gdevdevn.c b/base/gdevdevn.c
+index 7b14d9c71..6351fb77a 100644
+--- a/base/gdevdevn.c
++++ b/base/gdevdevn.c
+@@ -1983,7 +1983,7 @@ devn_pcx_write_rle(const byte * from, const byte * end, int step, gp_file * file
+         byte data = *from;
+ 
+         from += step;
+-        if (data != *from || from == end) {
++        if (from >= end || data != *from) {
+             if (data >= 0xc0)
+                 gp_fputc(0xc1, file);
+         } else {
+-- 
+2.34.1
+
meta/recipes-extended/ghostscript/ghostscript_10.01.2.bb +1 -0
index fdbdfb6502f..6b5f443db06 100644
@@ -25,6 +25,7 @@ def gs_verdir(v):
 SRC_URI = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs${@gs_verdir("${PV}")}/${BPN}-${PV}.tar.gz \
            file://ghostscript-9.16-Werror-return-type.patch \
            file://avoid-host-contamination.patch \
+           file://0001-Bug-706897-Copy-pcx-buffer-overrun-fix-from-devices-.patch \
 "
 
 SRC_URI[sha256sum] = "a4cd61a07fec161bee35da0211a5e5cde8ff8a0aaf942fc0176715e499d21661"
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 ghostscript: ignore CVE-2023-38560

From: Ross Burton <[email protected]>

The ghostscript recipe isn't vulnerable to CVE-2023-38560, as this is an issue in the GhostPCL release, whereas this recipe is the Ghostscript release.

---
 meta/recipes-extended/ghostscript/ghostscript_10.01.2.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-extended/ghostscript/ghostscript_10.01.2.bb +2 -0
index 6b5f443db06..0ddf708f936 100644
@@ -67,3 +67,5 @@ COMPATIBLE_HOST = "^(?!arc).*"
 
 # some entries in NVD uses gpl_ghostscript
 CVE_PRODUCT = "ghostscript gpl_ghostscript"
+
+CVE_STATUS[CVE-2023-38560] = "not-applicable-config: PCL isn't part of the Ghostscript release"
Signature · 1 line
2.34.1