summaryrefslogtreecommitdiffstats
path: root/source/ap/ghostscript/ghostscript-subclassing-devices-fix-put_image-method.patch
diff options
context:
space:
mode:
Diffstat (limited to 'source/ap/ghostscript/ghostscript-subclassing-devices-fix-put_image-method.patch')
-rw-r--r--source/ap/ghostscript/ghostscript-subclassing-devices-fix-put_image-method.patch28
1 files changed, 28 insertions, 0 deletions
diff --git a/source/ap/ghostscript/ghostscript-subclassing-devices-fix-put_image-method.patch b/source/ap/ghostscript/ghostscript-subclassing-devices-fix-put_image-method.patch
new file mode 100644
index 000000000..fadb948d5
--- /dev/null
+++ b/source/ap/ghostscript/ghostscript-subclassing-devices-fix-put_image-method.patch
@@ -0,0 +1,28 @@
+From fae21f1668d2b44b18b84cf0923a1d5f3008a696 Mon Sep 17 00:00:00 2001
+From: Ken Sharp <ken.sharp@artifex.com>
+Date: Tue, 4 Dec 2018 21:31:31 +0000
+Subject: subclassing devices - fix put_image method
+
+The subclassing devices need to change the 'memory device' parameter to
+be the child device, when its the same as the subclassing device.
+
+Otherwise we end up trying to access the child device's memory pointers
+in the subclassing device, which may not contain valid copies of
+those pointers.
+
+diff --git a/base/gdevsclass.c b/base/gdevsclass.c
+index d9c85d2e4..51092585a 100644
+--- a/base/gdevsclass.c
++++ b/base/gdevsclass.c
+@@ -797,7 +797,10 @@ int default_subclass_put_image(gx_device *dev, gx_device *mdev, const byte **buf
+ int alpha_plane_index, int tag_plane_index)
+ {
+ if (dev->child)
+- return dev_proc(dev->child, put_image)(dev->child, mdev, buffers, num_chan, x, y, width, height, row_stride, alpha_plane_index, tag_plane_index);
++ if (dev == mdev)
++ return dev_proc(dev->child, put_image)(dev->child, dev->child, buffers, num_chan, x, y, width, height, row_stride, alpha_plane_index, tag_plane_index);
++ else
++ return dev_proc(dev->child, put_image)(dev->child, mdev, buffers, num_chan, x, y, width, height, row_stride, alpha_plane_index, tag_plane_index);
+
+ return 0;
+ }