Blame SOURCES/ghostscript-cve-2017-7207.patch
|
|
cd3fc1 |
From 309eca4e0a31ea70dcc844812691439312dad091 Mon Sep 17 00:00:00 2001
|
|
|
cd3fc1 |
From: Ken Sharp <ken.sharp@artifex.com>
|
|
|
cd3fc1 |
Date: Mon, 20 Mar 2017 09:34:11 +0000
|
|
|
cd3fc1 |
Subject: [PATCH] Ensure a device has raster memory, before trying to read it.
|
|
|
cd3fc1 |
|
|
|
cd3fc1 |
Bug #697676 "Null pointer dereference in mem_get_bits_rectangle()"
|
|
|
cd3fc1 |
|
|
|
cd3fc1 |
This is only possible by abusing/mis-using Ghostscript-specific
|
|
|
cd3fc1 |
language extensions, so cannot happen in a general PostScript program.
|
|
|
cd3fc1 |
|
|
|
cd3fc1 |
Nevertheless, Ghostscript should not crash. So this commit checks the
|
|
|
cd3fc1 |
memory device to see if raster memory has been allocated, before trying
|
|
|
cd3fc1 |
to read from it.
|
|
|
cd3fc1 |
---
|
|
|
cd3fc1 |
base/gdevmem.c | 2 ++
|
|
|
cd3fc1 |
1 file changed, 2 insertions(+)
|
|
|
cd3fc1 |
|
|
|
cd3fc1 |
diff --git a/base/gdevmem.c b/base/gdevmem.c
|
|
|
cd3fc1 |
index afd05bd..d52d684 100644
|
|
|
cd3fc1 |
--- a/base/gdevmem.c
|
|
|
cd3fc1 |
+++ b/base/gdevmem.c
|
|
|
cd3fc1 |
@@ -606,6 +606,8 @@ mem_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
|
|
|
cd3fc1 |
GB_PACKING_CHUNKY | GB_COLORS_NATIVE | GB_ALPHA_NONE;
|
|
|
cd3fc1 |
return_error(gs_error_rangecheck);
|
|
|
cd3fc1 |
}
|
|
|
cd3fc1 |
+ if (mdev->line_ptrs == 0x00)
|
|
|
cd3fc1 |
+ return_error(gs_error_rangecheck);
|
|
|
cd3fc1 |
if ((w <= 0) | (h <= 0)) {
|
|
|
cd3fc1 |
if ((w | h) < 0)
|
|
|
cd3fc1 |
return_error(gs_error_rangecheck);
|
|
|
cd3fc1 |
--
|
|
|
cd3fc1 |
2.9.3
|
|
|
cd3fc1 |
|