summaryrefslogtreecommitdiff
path: root/base/sdctd.c
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2018-05-22 14:47:54 +0100
committerKen Sharp <ken.sharp@artifex.com>2018-05-22 14:47:54 +0100
commitb61071c9411c3f6aa0dd594da2c5a20ff4ecd914 (patch)
tree07f543978007243fe69d7ccfc156a22fef7f30c3 /base/sdctd.c
parent4a288cb8678517c578b336b3d26e5c4115906624 (diff)
downloadghostpdl-b61071c9411c3f6aa0dd594da2c5a20ff4ecd914.tar.gz
Replace EOI marker in JPEG passthrough
Bug #699216 " JPEG passthrough appears to truncate JPEGs in some cases" The IJG JPEG implementation consumes the EOI marker before the JPEG passthrough code gets to see it (in general). Most PDF consumers don't care, but some seem to, so when we terminate the DCT decompression send the EOI marker to the passthrough code.
Diffstat (limited to 'base/sdctd.c')
-rw-r--r--base/sdctd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/base/sdctd.c b/base/sdctd.c
index 75750f43e..b687054c1 100644
--- a/base/sdctd.c
+++ b/base/sdctd.c
@@ -73,12 +73,16 @@ dctd_skip_input_data(j_decompress_ptr dinfo, long num_bytes)
static void
dctd_term_source(j_decompress_ptr dinfo)
{
+ char EOI[2] = {0xff, 0xD9};
+
jpeg_decompress_data *jddp =
(jpeg_decompress_data *) ((char *)dinfo -
offset_of(jpeg_decompress_data, dinfo));
- if (jddp->PassThrough && jddp->PassThroughfn)
+ if (jddp->PassThrough && jddp->PassThroughfn) {
+ (jddp->PassThroughfn)(jddp->device, (byte *)EOI, 2);
(jddp->PassThroughfn)(jddp->device, NULL, 0);
+ }
return;
}