1c07afbc5a
Resolves: #1589467
61 lines
2.5 KiB
Diff
61 lines
2.5 KiB
Diff
From da3810ce626a1c5dca856a7bac757bf254761f69 Mon Sep 17 00:00:00 2001
|
|
From: Ken Sharp <ken.sharp@artifex.com>
|
|
Date: Thu, 28 Jun 2018 16:44:41 +0100
|
|
Subject: [PATCH] pdfwrite - create GC desscriptors for JPEG Passthrough stream
|
|
|
|
Bug #699427 " Shrinking PDF is causing SIGSEGV"
|
|
|
|
Its not absolutely clear that this is the same problem, but I'm
|
|
reasonably confident. When passing JPEG data through untouched, we
|
|
copied the stream pointer for the uncompressed data into the device
|
|
structure (because the image enumerator isn't available at that time)
|
|
but if the stream should be relocated after the copy is taken, then the
|
|
old stream might not be valid any more.
|
|
|
|
This commit adds a GC descriptor for the copied stream pointer to the
|
|
PDF device structure. For me this solves the problem, but the nature
|
|
of these kinds of problems means that *any* change which affects memory
|
|
layout will affect the execution, so I'm not 100% certain this is the
|
|
problem.
|
|
---
|
|
devices/vector/gdevpdf.c | 2 ++
|
|
devices/vector/gdevpdfx.h | 2 +-
|
|
2 files changed, 3 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/devices/vector/gdevpdf.c b/devices/vector/gdevpdf.c
|
|
index 5c1079e15..544259fbf 100644
|
|
--- a/devices/vector/gdevpdf.c
|
|
+++ b/devices/vector/gdevpdf.c
|
|
@@ -118,6 +118,7 @@ ENUM_PTRS_WITH(device_pdfwrite_enum_ptrs, gx_device_pdf *pdev)
|
|
ENUM_PTR(39, gx_device_pdf, EmbeddedFiles);
|
|
ENUM_PTR(40, gx_device_pdf, pdf_font_dir);
|
|
ENUM_PTR(41, gx_device_pdf, ExtensionMetadata);
|
|
+ ENUM_PTR(42, gx_device_pdf, PassThroughWriter);
|
|
#define e1(i,elt) ENUM_PARAM_STRING_PTR(i + gx_device_pdf_num_ptrs, gx_device_pdf, elt);
|
|
gx_device_pdf_do_param_strings(e1)
|
|
#undef e1
|
|
@@ -170,6 +171,7 @@ static RELOC_PTRS_WITH(device_pdfwrite_reloc_ptrs, gx_device_pdf *pdev)
|
|
RELOC_PTR(gx_device_pdf, EmbeddedFiles);
|
|
RELOC_PTR(gx_device_pdf, pdf_font_dir);
|
|
RELOC_PTR(gx_device_pdf, ExtensionMetadata);
|
|
+ RELOC_PTR(gx_device_pdf, PassThroughWriter);
|
|
#define r1(i,elt) RELOC_PARAM_STRING_PTR(gx_device_pdf,elt);
|
|
gx_device_pdf_do_param_strings(r1)
|
|
#undef r1
|
|
diff --git a/devices/vector/gdevpdfx.h b/devices/vector/gdevpdfx.h
|
|
index f06eb16a6..1aa2a9d71 100644
|
|
--- a/devices/vector/gdevpdfx.h
|
|
+++ b/devices/vector/gdevpdfx.h
|
|
@@ -927,7 +927,7 @@ struct gx_device_pdf_s {
|
|
m(39, gx_device_pdf, EmbeddedFiles);
|
|
m(40, gx_device_pdf, pdf_font_dir);
|
|
m(41, gx_device_pdf, Extension_Metadata);*/
|
|
-#define gx_device_pdf_num_ptrs 42
|
|
+#define gx_device_pdf_num_ptrs 43
|
|
#define gx_device_pdf_do_param_strings(m)\
|
|
m(0, OwnerPassword) m(1, UserPassword) m(2, NoEncrypt)\
|
|
m(3, DocumentUUID) m(4, InstanceUUID)
|
|
--
|
|
2.14.4
|
|
|