summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/ghostscript/ghostscript/CVE-2023-36664-pre1.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/ghostscript/ghostscript/CVE-2023-36664-pre1.patch')
-rw-r--r--meta/recipes-extended/ghostscript/ghostscript/CVE-2023-36664-pre1.patch62
1 files changed, 62 insertions, 0 deletions
diff --git a/meta/recipes-extended/ghostscript/ghostscript/CVE-2023-36664-pre1.patch b/meta/recipes-extended/ghostscript/ghostscript/CVE-2023-36664-pre1.patch
new file mode 100644
index 0000000000..662736bb3d
--- /dev/null
+++ b/meta/recipes-extended/ghostscript/ghostscript/CVE-2023-36664-pre1.patch
@@ -0,0 +1,62 @@
1From 4ceaf92815302863a8c86fcfcf2347e0118dd3a5 Mon Sep 17 00:00:00 2001
2From: Ray Johnston <ray.johnston@artifex.com>
3Date: Tue, 22 Sep 2020 13:10:04 -0700
4Subject: [PATCH] Fix gp_file allocations to use thread_safe_memory.
5
6The gpmisc.c does allocations for gp_file objects and buffers used by
7gp_fprintf, as well as gp_validate_path_len. The helgrind run with
8-dBGPrint -dNumRenderingThreads=4 and PCL input showed up the gp_fprintf
9problem since the clist rendering would call gp_fprintf using the same
10allocator (PCL's chunk allocator which is non_gc_memory). The chunk
11allocator is intentionally not thread safe (for performance).
12
13Upstream-Status: Backport [https://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=4ceaf92815302863a8c86fcfcf2347e0118dd3a5]
14CVE: CVE-2023-36664 #Dependency Patch1
15Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
16---
17 base/gpmisc.c | 8 ++++----
18 1 file changed, 4 insertions(+), 4 deletions(-)
19
20diff --git a/base/gpmisc.c b/base/gpmisc.c
21index 34cd71f..c4fffae 100644
22--- a/base/gpmisc.c
23+++ b/base/gpmisc.c
24@@ -435,7 +435,7 @@ generic_pwrite(gp_file *f, size_t count, gs_offset_t offset, const void *buf)
25
26 gp_file *gp_file_alloc(gs_memory_t *mem, const gp_file_ops_t *prototype, size_t size, const char *cname)
27 {
28- gp_file *file = (gp_file *)gs_alloc_bytes(mem->non_gc_memory, size, cname ? cname : "gp_file");
29+ gp_file *file = (gp_file *)gs_alloc_bytes(mem->thread_safe_memory, size, cname ? cname : "gp_file");
30 if (file == NULL)
31 return NULL;
32
33@@ -449,7 +449,7 @@ gp_file *gp_file_alloc(gs_memory_t *mem, const gp_file_ops_t *prototype, size_t
34 memset(((char *)file)+sizeof(*prototype),
35 0,
36 size - sizeof(*prototype));
37- file->memory = mem->non_gc_memory;
38+ file->memory = mem->thread_safe_memory;
39
40 return file;
41 }
42@@ -1047,7 +1047,7 @@ gp_validate_path_len(const gs_memory_t *mem,
43 prefix_len = 0;
44 }
45 rlen = len+1;
46- bufferfull = (char *)gs_alloc_bytes(mem->non_gc_memory, rlen + prefix_len, "gp_validate_path");
47+ bufferfull = (char *)gs_alloc_bytes(mem->thread_safe_memory, rlen + prefix_len, "gp_validate_path");
48 if (bufferfull == NULL)
49 return gs_error_VMerror;
50
51@@ -1093,7 +1093,7 @@ gp_validate_path_len(const gs_memory_t *mem,
52 break;
53 }
54
55- gs_free_object(mem->non_gc_memory, bufferfull, "gp_validate_path");
56+ gs_free_object(mem->thread_safe_memory, bufferfull, "gp_validate_path");
57 #ifdef EACCES
58 if (code == gs_error_invalidfileaccess)
59 errno = EACCES;
60--
612.25.1
62