summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-11714.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/ghostscript/ghostscript/CVE-2017-11714.patch')
-rw-r--r--meta/recipes-extended/ghostscript/ghostscript/CVE-2017-11714.patch61
1 files changed, 61 insertions, 0 deletions
diff --git a/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-11714.patch b/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-11714.patch
new file mode 100644
index 0000000000..84983c5aea
--- /dev/null
+++ b/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-11714.patch
@@ -0,0 +1,61 @@
1From 671fd59eb657743aa86fbc1895cb15872a317caa Mon Sep 17 00:00:00 2001
2From: Chris Liddell <chris.liddell@artifex.com>
3Date: Thu, 6 Jul 2017 14:54:02 +0100
4Subject: [PATCH] Bug 698158: prevent trying to reloc a freed object
5
6In the token reader, we pass the scanner state structure around as a
7t_struct ref on the Postscript operand stack.
8
9But we explicitly free the scanner state when we're done, which leaves a
10dangling reference on the operand stack and, unless that reference gets
11overwritten before the next garbager run, we can end up with the garbager
12trying to deal with an already freed object - that can cause a crash, or
13memory corruption.
14---
15 psi/ztoken.c | 14 +++++++++++++-
16 1 file changed, 13 insertions(+), 1 deletion(-)
17
18--- end of original header
19
20CVE: CVE-2017-11714
21
22Upstream-Status: Backport [git://git.ghostscript.com/ghostpdl.git]
23
24Signed-off-by: Joe Slater <joe.slater@windriver.com>
25
26diff --git a/psi/ztoken.c b/psi/ztoken.c
27index 4dba7c5..af1ceeb 100644
28--- a/psi/ztoken.c
29+++ b/psi/ztoken.c
30@@ -107,6 +107,12 @@ token_continue(i_ctx_t *i_ctx_p, scanner_state * pstate, bool save)
31 int code;
32 ref token;
33
34+ /* Since we might free pstate below, and we're dealing with
35+ * gc memory referenced by the stack, we need to explicitly
36+ * remove the reference to pstate from the stack, otherwise
37+ * the garbager will fall over
38+ */
39+ make_null(osp);
40 /* Note that gs_scan_token may change osp! */
41 pop(1); /* remove the file or scanner state */
42 again:
43@@ -183,8 +189,14 @@ ztokenexec_continue(i_ctx_t *i_ctx_p)
44 static int
45 tokenexec_continue(i_ctx_t *i_ctx_p, scanner_state * pstate, bool save)
46 {
47- os_ptr op;
48+ os_ptr op = osp;
49 int code;
50+ /* Since we might free pstate below, and we're dealing with
51+ * gc memory referenced by the stack, we need to explicitly
52+ * remove the reference to pstate from the stack, otherwise
53+ * the garbager will fall over
54+ */
55+ make_null(osp);
56 /* Note that gs_scan_token may change osp! */
57 pop(1);
58 again:
59--
601.7.9.5
61