/[pkg-src]/trunk/ghostscript-gpl/patches/ghostscript-gpl-9.18-fix-devijs-account-for-device-subclassing.patch |
Contents of /trunk/ghostscript-gpl/patches/ghostscript-gpl-9.18-fix-devijs-account-for-device-subclassing.patch
Parent Directory | Revision Log
Revision 2734 -
(show annotations)
(download)
Thu Dec 3 12:55:33 2015 UTC (8 years, 11 months ago) by niro
File size: 7291 byte(s)
Thu Dec 3 12:55:33 2015 UTC (8 years, 11 months ago) by niro
File size: 7291 byte(s)
-serveral fixes for 9.18
1 | From: Chris Liddell <chris.liddell@artifex.com> |
2 | Date: Fri, 9 Oct 2015 09:54:10 +0000 (+0100) |
3 | Subject: Bug 696246: devijs account for device sublassing. |
4 | X-Git-Url: http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff_plain;h=b68e05c3 |
5 | |
6 | Bug 696246: devijs account for device sublassing. |
7 | |
8 | The IJS device wasn't coping with the possibility it had been subclassed. |
9 | |
10 | No cluster differences |
11 | --- |
12 | |
13 | diff --git a/devices/gdevijs.c b/devices/gdevijs.c |
14 | index 5520716..a2e21ea 100644 |
15 | --- a/devices/gdevijs.c |
16 | +++ b/devices/gdevijs.c |
17 | @@ -827,6 +827,10 @@ gsijs_open(gx_device *dev) |
18 | if (code < 0) |
19 | return code; |
20 | |
21 | + while (dev->child) |
22 | + dev = dev->child; |
23 | + ijsdev = (gx_device_ijs *)dev; |
24 | + |
25 | if (use_outputfd) { |
26 | /* Note: dup() may not be portable to all interesting IJS |
27 | platforms. In that case, this branch should be #ifdef'ed out. |
28 | From: Chris Liddell <chris.liddell@artifex.com> |
29 | Date: Fri, 9 Oct 2015 11:54:44 +0000 (+0100) |
30 | Subject: Bug 696246: patch the memory manager fields for sublassed devices. |
31 | X-Git-Url: http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff_plain;h=95553954 |
32 | |
33 | Bug 696246: patch the memory manager fields for sublassed devices. |
34 | |
35 | When we subclass a device, we were patching the "visible" type field - that is, |
36 | the one referenced directly in the device structure. We were not patching |
37 | the type information in the memory object header so, in particular, the |
38 | garbage collector could end up calling the wrong methods for the subclassed |
39 | device. |
40 | |
41 | No cluster differences. |
42 | --- |
43 | |
44 | diff --git a/base/gdevdflt.c b/base/gdevdflt.c |
45 | index 5768937..305f89d 100644 |
46 | --- a/base/gdevdflt.c |
47 | +++ b/base/gdevdflt.c |
48 | @@ -17,6 +17,8 @@ |
49 | #include "math_.h" |
50 | #include "memory_.h" |
51 | #include "gx.h" |
52 | +#include "gsstruct.h" |
53 | +#include "gxobj.h" |
54 | #include "gserrors.h" |
55 | #include "gsropt.h" |
56 | #include "gxcomp.h" |
57 | @@ -26,6 +28,7 @@ |
58 | #include "gstrans.h" /* For gs_pdf14trans_t */ |
59 | #include "gxistate.h" /* for gs_image_state_s */ |
60 | |
61 | + |
62 | /* defined in gsdpram.c */ |
63 | int gx_default_get_param(gx_device *dev, char *Param, void *list); |
64 | |
65 | @@ -1294,6 +1297,11 @@ int gx_device_subclass(gx_device *dev_to_subclass, gx_device *new_prototype, uns |
66 | ptr1 = ((char *)new_prototype) + sizeof(gx_device); |
67 | memcpy(ptr, ptr1, new_prototype->params_size - sizeof(gx_device)); |
68 | |
69 | + /* We have to patch up the "type" parameters that the memory manage/garbage |
70 | + * collector will use, as well. |
71 | + */ |
72 | + (((obj_header_t *)dev_to_subclass) - 1)->o_type = new_prototype->stype; |
73 | + |
74 | /* If the original device's stype structure was dynamically allocated, we need |
75 | * to 'fixup' the contents, it's procs need to point to the new device's procs |
76 | * for instance. |
77 | diff --git a/base/lib.mak b/base/lib.mak |
78 | index de78333..09b70e5 100644 |
79 | --- a/base/lib.mak |
80 | +++ b/base/lib.mak |
81 | @@ -1210,7 +1210,7 @@ $(GLOBJ)gdevdsha.$(OBJ) : $(GLSRC)gdevdsha.c $(AK) $(gx_h)\ |
82 | |
83 | $(GLOBJ)gdevdflt.$(OBJ) : $(GLSRC)gdevdflt.c $(AK) $(gx_h)\ |
84 | $(gserrors_h) $(gsropt_h) $(gxcomp_h) $(gxdevice_h) $(gxdevsop_h) $(math__h)\ |
85 | - $(MAKEDIRS) |
86 | + $(gsstruct_h) $(gxobj_h) $(MAKEDIRS) |
87 | $(GLCC) $(GLO_)gdevdflt.$(OBJ) $(C_) $(GLSRC)gdevdflt.c |
88 | |
89 | $(GLOBJ)gdevdgbr.$(OBJ) : $(GLSRC)gdevdgbr.c $(AK) $(gx_h)\ |
90 | From 007bd77d08d800e6b07274d62e3c91be7c4a3f47 Mon Sep 17 00:00:00 2001 |
91 | From: Ken Sharp <ken.sharp@artifex.com> |
92 | Date: Mon, 12 Oct 2015 16:36:11 +0100 |
93 | Subject: [PATCH] Guard against NULL 'base' for non-clist devices |
94 | |
95 | Bug #696246 "Ghostscript 9.18 with -dFirstPage/-dLastPage fails for ijs and some x11 devices" |
96 | |
97 | This is actually for the plib device. This device is currently (this will |
98 | change in the next commit) set to BandingAuto, despite the fact that the |
99 | device only works in banding mode. |
100 | |
101 | This can lead to use arriving in gdev_mem_open_scan_lines with all of |
102 | mdev->bitmap_memory, mdev->line_pointers_memory and mdev->base being set to |
103 | NULL. The code didn't check and assumed that mdev->base was valid, which |
104 | led to a later seg fault. |
105 | |
106 | Here we just check to make sure it isn't NULL and return an error if it is. |
107 | This doesn't prevent the possibility of garbage uninitialised values, but |
108 | there's not much we can do to check that at this stage, devices are supposed |
109 | to be initialised to 0 so this 'shouldn't' happen. |
110 | |
111 | No differences expected. |
112 | --- |
113 | base/gdevmem.c | 3 +++ |
114 | 1 file changed, 3 insertions(+) |
115 | |
116 | diff --git a/base/gdevmem.c b/base/gdevmem.c |
117 | index 3019451f..507fa19 100644 |
118 | --- a/base/gdevmem.c |
119 | +++ b/base/gdevmem.c |
120 | @@ -471,6 +471,9 @@ gdev_mem_open_scan_lines(gx_device_memory *mdev, int setup_height) |
121 | line_pointers_adjacent = false; |
122 | } |
123 | if (line_pointers_adjacent) { |
124 | + if (mdev->base == 0) |
125 | + return_error(gs_error_rangecheck); |
126 | + |
127 | gdev_mem_bits_size(mdev, mdev->width, mdev->height, &size); |
128 | mdev->line_ptrs = (byte **)(mdev->base + size); |
129 | } |
130 | -- |
131 | 2.5.1 |
132 | |
133 | From 1bdbe4f87dc57648821e613ebcc591b84e8b35b3 Mon Sep 17 00:00:00 2001 |
134 | From: Ken Sharp <ken.sharp@artifex.com> |
135 | Date: Mon, 12 Oct 2015 16:38:09 +0100 |
136 | Subject: [PATCH] Ensure plib devices always use the clist |
137 | |
138 | Bug #696246 "Ghostscript 9.18 with -dFirstPage/-dLastPage fails for ijs and some x11 devices" |
139 | |
140 | the plib* class of devices only work if clist is present, but previously |
141 | they left the banding_type set to 'auto', which meant that under some |
142 | conditions we did not use the clist, leading to a seg fault. |
143 | |
144 | This commit simply forces banding_type to be 'BandingAlways'. |
145 | |
146 | No differences expected. |
147 | --- |
148 | devices/gdevplib.c | 2 ++ |
149 | 1 file changed, 2 insertions(+) |
150 | |
151 | diff --git a/devices/gdevplib.c b/devices/gdevplib.c |
152 | index 51bd7ea..87c6f46 100644 |
153 | --- a/devices/gdevplib.c |
154 | +++ b/devices/gdevplib.c |
155 | @@ -691,6 +691,8 @@ plib_open(gx_device * pdev) |
156 | bdev->printer_procs.buf_procs.size_buf_device = plib_size_buf_device; |
157 | pdev->is_planar = 1; |
158 | |
159 | + bdev->space_params.banding_type = BandingAlways; |
160 | + |
161 | /* You might expect us to call gdev_prn_open_planar rather than |
162 | * gdev_prn_open, but if we do that, it overwrites the 2 function |
163 | * pointers we've just overwritten! */ |
164 | -- |
165 | 2.5.1 |
166 | |
167 | From 5571ddfa377c5d7d98f55af40e693814ac287ae4 Mon Sep 17 00:00:00 2001 |
168 | From: Ken Sharp <ken.sharp@artifex.com> |
169 | Date: Mon, 12 Oct 2015 16:40:10 +0100 |
170 | Subject: [PATCH] prevent rinkj device crash when misconfigured (no SetupFile) |
171 | |
172 | Bug #696246 "Ghostscript 9.18 with -dFirstPage/-dLastPage fails for ijs and some x11 devices" |
173 | |
174 | The rinkj device requires a SetupFile to be given as a device parameter, |
175 | however it doesn't actually check to see if one is given, and just tries |
176 | to open the filename, with a predictable crash when none is given. |
177 | |
178 | Here we check the filename and attempt to ensure it is both present and |
179 | minimally valid. |
180 | |
181 | No differences expected. |
182 | --- |
183 | devices/gdevrinkj.c | 4 ++++ |
184 | 1 file changed, 4 insertions(+) |
185 | |
186 | diff --git a/devices/gdevrinkj.c b/devices/gdevrinkj.c |
187 | index f55bc60..12c396a 100644 |
188 | --- a/devices/gdevrinkj.c |
189 | +++ b/devices/gdevrinkj.c |
190 | @@ -1193,6 +1193,10 @@ rinkj_print_page(gx_device_printer *pdev, FILE *file) |
191 | int code = 0; |
192 | RinkjDevice *cmyk_dev; |
193 | |
194 | + if (rdev->setup_fn == 0 || rdev->setup_fn[0] == 0) { |
195 | + emprintf(rdev->memory, "Error, SetupFile not defined, output aborted\n"); |
196 | + return 0; |
197 | + } |
198 | cmyk_dev = rinkj_init(rdev, file); |
199 | if (cmyk_dev == 0) |
200 | return gs_note_error(gs_error_ioerror); |
201 | -- |
202 | 2.5.1 |
203 |