ghostscript/CVE-2017-7207.patch
Johannes Meixner 404156ec6d Accepting request 501324 from home:dmolkentin:branches:Printing
- CVE-2017-7207.patch fixes a NULL pointer dereference in mem_get_bits_rectangle
  see https://bugs.ghostscript.com/show_bug.cgi?id=697676
  (bsc#1030263)
- CVE-2017-9216.patch fixes a NULL pointer dereference in jbig2_huffman_get
  see https://bugs.ghostscript.com/show_bug.cgi?id=697934
  (bsc#1040643)

OBS-URL: https://build.opensuse.org/request/show/501324
OBS-URL: https://build.opensuse.org/package/show/Printing/ghostscript?expand=0&rev=79
2017-06-06 09:08:41 +00:00

31 lines
1.2 KiB
Diff

From 309eca4e0a31ea70dcc844812691439312dad091 Mon Sep 17 00:00:00 2001
From: Ken Sharp <ken.sharp@artifex.com>
Date: Mon, 20 Mar 2017 09:34:11 +0000
Subject: [PATCH] Ensure a device has raster memory, before trying to read it.
Bug #697676 "Null pointer dereference in mem_get_bits_rectangle()"
This is only possible by abusing/mis-using Ghostscript-specific
language extensions, so cannot happen in a general PostScript program.
Nevertheless, Ghostscript should not crash. So this commit checks the
memory device to see if raster memory has been allocated, before trying
to read from it.
---
base/gdevmem.c | 2 ++
1 file changed, 2 insertions(+)
Index: ghostscript-9.15/base/gdevmem.c
===================================================================
--- ghostscript-9.15.orig/base/gdevmem.c 2014-09-22 12:17:33.000000000 +0200
+++ ghostscript-9.15/base/gdevmem.c 2017-04-28 10:55:17.479490151 +0200
@@ -590,6 +590,8 @@ mem_get_bits_rectangle(gx_device * dev,
GB_PACKING_CHUNKY | GB_COLORS_NATIVE | GB_ALPHA_NONE;
return_error(gs_error_rangecheck);
}
+ if (mdev->line_ptrs == 0x00)
+ return_error(gs_error_rangecheck);
if ((w <= 0) | (h <= 0)) {
if ((w | h) < 0)
return_error(gs_error_rangecheck);