/[packages]/updates/5/ghostscript/current/SOURCES/ghostscript-9.20-cve-2016-10220.patch
ViewVC logotype

Contents of /updates/5/ghostscript/current/SOURCES/ghostscript-9.20-cve-2016-10220.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1097926 - (show annotations) (download)
Fri Apr 28 15:42:34 2017 UTC (6 years, 11 months ago) by neoclust
File size: 2323 byte(s)
- New version 9.20
- Fixes:
  - CVE-2016-10217
  - CVE-2016-10218
  - CVE-2016-10219
  - CVE-2016-10220
  - CVE-2017-5951
  - CVE-2017-8291
  - CVE-2016-9601
  - CVE-2017-7207 
  - CVE-2016-7976
  - CVE-2016-7977
  - CVE-2016-7978
  - CVE-2016-7979
  - CVE-2016-8602


1 From daf85701dab05f17e924a48a81edc9195b4a04e8 Mon Sep 17 00:00:00 2001
2 From: Ken Sharp <ken.sharp@artifex.com>
3 Date: Wed, 21 Dec 2016 16:54:14 +0000
4 Subject: [PATCH] fix crash with bad data supplied to makeimagedevice
5
6 Bug #697450 "Null pointer dereference in gx_device_finalize()"
7
8 The problem here is that the code to finalise a device unconditionally
9 frees the icc_struct member of the device structure. However this
10 particular (weird) device is not setup as a normal device, probably
11 because its very, very ancient. Its possible for the initialisation
12 of the device to abort with an error before calling gs_make_mem_device()
13 which is where the icc_struct member gets allocated (or set to NULL).
14
15 If that happens, then the cleanup code tries to free the device, which
16 calls finalize() which tries to free a garbage pointer.
17
18 Setting the device memory to 0x00 after we allocate it means that the
19 icc_struct member will be NULL< and our memory manager allows for that
20 happily enough, which avoids the problem.
21 ---
22 base/gsdevmem.c | 12 ++++++++++++
23 1 file changed, 12 insertions(+)
24
25 diff --git a/base/gsdevmem.c b/base/gsdevmem.c
26 index 97b9cf4..fe75bcc 100644
27 --- a/base/gsdevmem.c
28 +++ b/base/gsdevmem.c
29 @@ -225,6 +225,18 @@ gs_makewordimagedevice(gx_device ** pnew_dev, const gs_matrix * pmat,
30
31 if (pnew == 0)
32 return_error(gs_error_VMerror);
33 +
34 + /* Bug #697450 "Null pointer dereference in gx_device_finalize()"
35 + * If we have incorrect data passed to gs_initialise_wordimagedevice() then the
36 + * initialisation will fail, crucially it will fail *before* it calls
37 + * gs_make_mem_device() which initialises the device. This means that the
38 + * icc_struct member will be uninitialsed, but the device finalise method
39 + * will unconditionally free that memory. Since its a garbage pointer, bad things happen.
40 + * Apparently we do still need makeimagedevice to be available from
41 + * PostScript, so in here just zero the device memory, which means that
42 + * the finalise routine won't have a problem.
43 + */
44 + memset(pnew, 0x00, st_device_memory.ssize);
45 code = gs_initialize_wordimagedevice(pnew, pmat, width, height,
46 colors, num_colors, word_oriented,
47 page_device, mem);
48 --
49 2.9.3
50

  ViewVC Help
Powered by ViewVC 1.1.30