diff options
| author | Joe Slater <joe.slater@windriver.com> | 2023-04-24 14:04:10 -0700 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2023-05-03 04:17:12 -1000 |
| commit | 20e0e5ebfb4267d212a77ac414a53b0725c0e53e (patch) | |
| tree | 4ea3358fb6f1e2c1012d5bb96d93b8d2862bf863 | |
| parent | 6cff3875fe60802742937a5e562d5954f0eb50fe (diff) | |
| download | poky-20e0e5ebfb4267d212a77ac414a53b0725c0e53e.tar.gz | |
ghostscript: fix CVE-2023-29979
Backport from 10.02.0 (unreleased).
(From OE-Core rev: 6d5baff50aa83c663856cccc375c522add97625e)
Signed-off-by: Joe Slater <joe.slater@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
| -rw-r--r-- | meta/recipes-extended/ghostscript/ghostscript/cve-2023-28879.patch | 60 | ||||
| -rw-r--r-- | meta/recipes-extended/ghostscript/ghostscript_9.55.0.bb | 1 |
2 files changed, 61 insertions, 0 deletions
diff --git a/meta/recipes-extended/ghostscript/ghostscript/cve-2023-28879.patch b/meta/recipes-extended/ghostscript/ghostscript/cve-2023-28879.patch new file mode 100644 index 0000000000..9b057d609a --- /dev/null +++ b/meta/recipes-extended/ghostscript/ghostscript/cve-2023-28879.patch | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | From 37ed5022cecd584de868933b5b60da2e995b3179 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Ken Sharp <ken.sharp@artifex.com> | ||
| 3 | Date: Fri, 24 Mar 2023 13:19:57 +0000 | ||
| 4 | Subject: [PATCH] Graphics library - prevent buffer overrun in (T)BCP encoding | ||
| 5 | |||
| 6 | Bug #706494 "Buffer Overflow in s_xBCPE_process" | ||
| 7 | |||
| 8 | As described in detail in the bug report, if the write buffer is filled | ||
| 9 | to one byte less than full, and we then try to write an escaped | ||
| 10 | character, we overrun the buffer because we don't check before | ||
| 11 | writing two bytes to it. | ||
| 12 | |||
| 13 | This just checks if we have two bytes before starting to write an | ||
| 14 | escaped character and exits if we don't (replacing the consumed byte | ||
| 15 | of the input). | ||
| 16 | |||
| 17 | Up for further discussion; why do we even permit a BCP encoding filter | ||
| 18 | anyway ? I think we should remove this, at least when SAFER is true. | ||
| 19 | --- | ||
| 20 | CVE: CVE-2023-28879 | ||
| 21 | |||
| 22 | Upstream-Status: Backport [see text] | ||
| 23 | |||
| 24 | git://git.ghostscript.com/ghostpdl | ||
| 25 | cherry-pick | ||
| 26 | |||
| 27 | Signed-off-by: Joe Slater <joe.slater@windriver.com> | ||
| 28 | |||
| 29 | --- | ||
| 30 | base/sbcp.c | 10 +++++++++- | ||
| 31 | 1 file changed, 9 insertions(+), 1 deletion(-) | ||
| 32 | |||
| 33 | diff --git a/base/sbcp.c b/base/sbcp.c | ||
| 34 | index 979ae0992..47fc233ec 100644 | ||
| 35 | --- a/base/sbcp.c | ||
| 36 | +++ b/base/sbcp.c | ||
| 37 | @@ -1,4 +1,4 @@ | ||
| 38 | -/* Copyright (C) 2001-2021 Artifex Software, Inc. | ||
| 39 | +/* Copyright (C) 2001-2023 Artifex Software, Inc. | ||
| 40 | All Rights Reserved. | ||
| 41 | |||
| 42 | This software is provided AS-IS with no warranty, either express or | ||
| 43 | @@ -50,6 +50,14 @@ s_xBCPE_process(stream_state * st, stream_cursor_read * pr, | ||
| 44 | byte ch = *++p; | ||
| 45 | |||
| 46 | if (ch <= 31 && escaped[ch]) { | ||
| 47 | + /* Make sure we have space to store two characters in the write buffer, | ||
| 48 | + * if we don't then exit without consuming the input character, we'll process | ||
| 49 | + * that on the next time round. | ||
| 50 | + */ | ||
| 51 | + if (pw->limit - q < 2) { | ||
| 52 | + p--; | ||
| 53 | + break; | ||
| 54 | + } | ||
| 55 | if (p == rlimit) { | ||
| 56 | p--; | ||
| 57 | break; | ||
| 58 | -- | ||
| 59 | 2.25.1 | ||
| 60 | |||
diff --git a/meta/recipes-extended/ghostscript/ghostscript_9.55.0.bb b/meta/recipes-extended/ghostscript/ghostscript_9.55.0.bb index 365420fb64..f29c57beea 100644 --- a/meta/recipes-extended/ghostscript/ghostscript_9.55.0.bb +++ b/meta/recipes-extended/ghostscript/ghostscript_9.55.0.bb | |||
| @@ -34,6 +34,7 @@ SRC_URI_BASE = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/d | |||
| 34 | file://avoid-host-contamination.patch \ | 34 | file://avoid-host-contamination.patch \ |
| 35 | file://mkdir-p.patch \ | 35 | file://mkdir-p.patch \ |
| 36 | file://CVE-2022-2085.patch \ | 36 | file://CVE-2022-2085.patch \ |
| 37 | file://cve-2023-28879.patch \ | ||
| 37 | " | 38 | " |
| 38 | 39 | ||
| 39 | SRC_URI = "${SRC_URI_BASE} \ | 40 | SRC_URI = "${SRC_URI_BASE} \ |
