History of Ghostscript versions 9.xx

Table of contents

This document is a record of changes in Ghostscript releases numbered 9.xx. For earlier versions, see the the history documents:

History of Ghostscript versions 8.n
History of Ghostscript versions 7.n
History of Ghostscript versions 6.n
History of Ghostscript versions 5.n
History of Ghostscript versions 4.n
History of Ghostscript versions 3.n
History of Ghostscript versions 2.n
History of Ghostscript versions 1.n

For other information, see the Ghostscript overview.


Version 9.22 (2017-10-04)

This is the sixteeth full release in the stable 9.x series.

Highlights in this release include:

For a list of open issues, or to report problems, please visit bugs.ghostscript.com.

Incompatible changes

Changelog

2017-10-03 10:01:14 +0100
Chris Liddell <chris.liddell@artifex.com>
dcba89978e3cd6e8e55b44e0830594a385a8e07e

Bug 698615: pdf_add_ToUnicode() correct size of buffer

We allocate a buffer to store the Unicode value, but failing to account for
the fact that the Unicode value is two bytes, rather than a byte

devices/vector/gdevpdte.c


2017-10-02 16:32:25 +0100
Ken Sharp <ken.sharp@artifex.com>
5751e508f72238c1fcaad1a4c284aa875542dd70

PDF interpreter - fix default /Decode for Lab images

When we get an image with no /Decode array we create a default one for
it by looking at the image colour space.

For Lab we use the /Range array, but unfortunately this only covers the
a and b channels, not the L. However, L always ranges from 0 - 100 so
here we just pull the Range array apart, add in that range, and create
a new array for the /Decode.

Resource/Init/pdf_draw.ps


2017-09-28 18:04:20 -0600
Henry Stiles <henry.stiles@artifex.com>
3c2974bcd2e638be13c0ec814342a1a35ca0872b

Fix buffer overflow regression.

The commit to address 694653 (3749bc274) was incorrect, the
font_data_size variable is not necessarily the size of the buffer.

pcl/pcl/pcsfont.c


2017-09-28 11:35:58 +0100
Chris Liddell <chris.liddell@artifex.com>
b1eda05a9fa7327e76b9a4af980d05da9e926e7f

Update dates/product for 9.22rc2

base/gscdef.c
base/version.mak
doc/API.htm
doc/C-style.htm
doc/Commprod.htm
doc/DLL.htm
doc/Deprecated.htm
doc/Details8.htm
doc/Details9.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/Helpers.htm
doc/History1.htm
doc/History2.htm
doc/History3.htm
doc/History4.htm
doc/History5.htm
doc/History6.htm
doc/History7.htm
doc/History8.htm
doc/History9.htm
doc/Install.htm
doc/Issues.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.htm
doc/Projects.htm
doc/Ps-style.htm
doc/Ps2epsi.htm
doc/Psfiles.htm
doc/Readme.htm
doc/Release.htm
doc/SavedPages.htm
doc/Source.htm
doc/Unix-lpr.htm
doc/Use.htm
doc/VectorDevices.htm
doc/WhatIsGS.htm
doc/Xfonts.htm
doc/gs-vms.hlp
doc/sample_downscale_device.htm
doc/thirdparty.htm
man/dvipdf.1
man/gs.1
man/gslp.1
man/gsnd.1
man/pdf2dsc.1
man/pdf2ps.1
man/pf2afm.1
man/pfbtopfa.1
man/printafm.1
man/ps2ascii.1
man/ps2epsi.1
man/ps2pdf.1
man/ps2pdfwr.1
man/ps2ps.1


2017-09-28 10:08:16 +0100
Ken Sharp <ken.sharp@artifex.com>
d59e4b57e1807e934ed1dde51e628f84dfb8caa7

Documentation - spruce up WhatIsGS.htm

Remove references to the obselete GhostSVG

Remove references to MuPDF and MuXPS, MuPDF can easily stand alone now
and its not really part of the Ghostscript family.

doc/WhatIsGS.htm


2017-09-27 08:34:10 -0700
Ray Johnston <ray.johnston@artifex.com>
a6830a293f9a69caf50777bb6ee7b553589c0a08

Revert commit a5a2862d

Even though the commit fixed bug 695280, we noticed that it caused PS
and PDF clist image logic to sometimes take the slow "default" handling
instead of the high-level image path.

To restore the fix for PCL, we could remove the rop3_uses_T altogether,
but we don't know if this will impact PCL performance.

Re-opening bug 695280.

base/gxclimag.c


2017-09-27 16:35:18 +0100
Ken Sharp <ken.sharp@artifex.com>
c10d5ada53245dac13436d663d3dbe265bc9e11a

Documentation - remove reference to obselete switch

Missed this when removing the implementation, PDFDontUseObjectNum is no
longer supported, so remove it from the documentation.

doc/VectorDevices.htm


2017-09-26 13:30:16 -0700
Ray Johnston <ray.johnston@artifex.com>
ccaaa1fd02f1cedf221bd6a34e5eb0ef64ef8f3f

Fix bug 698560. Transparent pattern-clist playback affected target device

If a transparent pattern was stored as a pattern-clist, changes to the
pdf14_device during playback were applied to the upper level device, but
not restored after the playback. This fixes a long standing problem with
Bug692217.pdf (ELEMENTARY card was to light gray).

base/gdevp14.c


2017-09-22 16:06:18 +0100
Ken Sharp <ken.sharp@artifex.com>
c470609a95c3ba5d531da463df7a98da01998452

PDF interpreter - clamp Box to MediaBox, even when MediaBox is negative

When applying the various 'Box' values from a PDF file, we need to clamp
them to the MediaBox values, so that we don't try and extend the final
output to be larger than the Media (this appears to be Acotbat's
behaviour).

But we also need to account for the fact that the media (and therefore
the content) may not lie up and right. Its possible for the media to
be defined with negative height or width.

We deal with that by scaling/translating the CTM, but we weren't
taking it into account when calculating the actual media size, which led
to us calculating the wrong size.

This is more complicated, but we only do it once per page, so the
performance penalty is insignificant.

Resource/Init/pdf_main.ps


2017-09-22 12:36:22 +0100
Chris Liddell <chris.liddell@artifex.com>
ad87c56e9e88907854d4c37f1a80d8f5d06fb8a7

Bug 698581: Pscript5Idiom: add missing conditional (and bind)

One of the procedures which Pscript5Idiom "patches" was missing an ifelse
meaning, when that idiom was hit, an unexecuted procedure was left on
the stack.

For efficiency and consistency, also bind the entire procedure.

Resource/IdiomSet/Pscript5Idiom


2017-09-22 10:55:10 +0100
Chris Liddell <chris.liddell@artifex.com>
9ae11d7a06c216eae554bcc7696028e69c4bc7ee

Simpify confusing stack manipulations

The existing code was not wrong, but did several unnecessary stack manipulations
that made it less efficient but, more importantly, confusing.

Also, remove trailing whitespace.

Resource/Init/pdf_ops.ps


2017-09-21 11:27:37 +0100
Chris Liddell <chris.liddell@artifex.com>
d644437adb7833a2c511d143c13e757383106378

Remove pointless free

In an error condition, we were freeing the object that had failed to allocate.

Not a problem with our memory manager, but might cause confusion reading the
code (it did for me!).

base/gdevp14.c


2017-09-21 18:34:32 +0100
Chris Liddell <chris.liddell@artifex.com>
8760a38e4ca49ce403cb362ecb4d6b4d247587f1

Fix errors with 6b06b8c854

The stack manipulations with the previous commit were not quite right.

Resource/Init/pdf_ops.ps


2017-09-19 10:41:21 -0700
Michael Vrhel <michael.vrhel@artifex.com>
cc966e7f9029c27abc896431a3c4910b40d915ef

Bug 698559 avoid double alpha application

When we have a softmask present in the graphic state, we
wrap up the fill or stroke with an isolated transparency
group in the interpreter. After the group is pushed we
should set the opacityalpha and the shapealpha to 1 to
avoid a double application of alpha at the rect-fill level and
the group composition level.

Resource/Init/pdf_ops.ps
base/gxblend1.c


2017-09-21 10:13:16 +0100
Ken Sharp <ken.sharp@artifex.com>
c03add9e9caaa4958928f74a6ca4f2b71915063c

pdfwrite - fix compiler warnign

Cast a pointer correctly to avoid a compiler warning.

devices/vector/gdevpdfe.c


2017-09-20 16:48:27 +0100
Robin Watts <robin.watts@artifex.com>
2285580852e74940a4596b754739ba45a03b40d0

Fix stroke/fill mismatches in 09-37.PS

When 'accurate curves' are requested, ensure we use the same
curve -> line decomposition for both strokes and fills.

base/gxfill.c


2017-09-20 18:33:52 +0100
Robin Watts <robin.watts@artifex.com>
0803369908a0b4b24b215881e4c4a4ecc5de61c2

Fix new scan converter glitch with CATX4547.pdf

Page 11 of this file contains details on the revolvers cylinder
rendered by filling zero width vertical lines. For example:

0.165 0.068 0 0.187 scn
506.47 162.99 m
506.47 167.99 l
506.47 162.99 l
f

The new scan converter was incorrectly eliding this. Fixed by
tweaking the edgebuffer filtering logic for any-part-of-a-pixel
mode.

base/gxscanc.c


2017-09-19 18:01:27 +0100
Robin Watts <robin.watts@artifex.com>
03ac50df18eb12d40de1615d18730fdd077f605b

Fix in*fill etc test files.

The new scan converter has been assuming that anything with an
x coord < 0 is off screen. While this is true for almost every
device I can think of, it need not be true for the hit detection
device used for infill/instroke operations.

Fixed to use INT_MIN here.

base/gxscanc.c


2017-09-20 15:37:19 +0100
Ken Sharp <ken.sharp@artifex.com>
4bb7249ce9320c566da5dac3901c41c7965d37d8

pdfwrite - fix UTF16 to UTF8 conversion

There was a signed/unsigned error in the arguments to this routine,
which meant that bytes with the top bit set caused the whole UTF16
short to become negative as well.

Fixed here.

devices/vector/gdevpdfe.c


2017-09-19 17:43:25 +0100
Chris Liddell <chris.liddell@artifex.com>
f2f9ed2897a4cf166c1df50422b2e82ad2422947

Write initial device error to stderr

As the "Unable to open the initial device, quitting." occurs outside the
Postscript error handling auspices, and causes Ghostscript to quit in a
possibly unexpected way, write it to stderr rather than stdout.

Resource/Init/gs_init.ps


2017-09-19 13:59:56 +0100
Ken Sharp <ken.sharp@artifex.com>
5fc5b64a6cd3917326479d3d3a0546dca0feef3c

PS interpreter - set EPSCrop when EPSFitPage is set

Bug #698555 "using DEVICE[WIDTH|HEIGHT]POINTS results in blank image"

The reporter had not set -dEPSCrop which resulted in no PageSize
request being sent to the interpreter (because EPS files are note
permitted to set PageSize). Which defeats the use of PageSize Policy
13 to scale the page.

Since anyone using EPSFitPage clearly wants to scale the page to the EPS
BoundingBox, we may as well set EPSCrop in case they don't.

NB the original reporter had not set -dFIXEDMEDIA either...

Resource/Init/gs_init.ps


2017-09-17 18:34:59 +0100
Ken Sharp <ken.sharp@artifex.com>
6e317f178c7fe7c81b573598f848acf8487e4e45

pdfwrite - properly process Octal 134 '\' in pdfmark UTF16 string

Bug #698552 "Some PDF outline UTF-16 text is broken"

The escape processing wasn't catering for an escaped escape '\\' which
led to us writing the escaped escape direclty and corrupted the remainder
of the string. We normaly don't use short escapes but write ocral,
because some versions of Acrobat can't handle the short escapes.

This commit just processes the '\\' properly, as per the other
escapes.

devices/vector/gdevpdfm.c


2017-09-17 11:46:03 +0100
Ken Sharp <ken.sharp@artifex.com>
122808aa46118d483c2fe431d5382c88cdd6e735

Coverity ID 172798

We hadn't assigned the return value to the variable 'code' but were
using it (asigned earlier in the code) to action a return.

Fixed by actually assigning the value to the variable.

base/gxshade1.c


2017-09-16 23:34:04 +0100
Ken Sharp <ken.sharp@artifex.com>
087abbc55390499ca27823afbe7d1b62b4ff4f8e

PDF interpreter - more work on images with invalid /Mask

Commit 119ec77d4e44e3861a376323ed14466b28b2f4bf fixed one case of a
/Mask array with invalid values by treating DeviceGray the same as
/Indexed. However, while that worked for the particular file in question
(Bug #697919) it caused a regression with Bug689717 which I somehow
missed at the time.

This commit treats DeviceGray differently to Indexed spaces and
clamps the value to either 0 or 1 for 1 BPC images. This seems to work
as per Acrobat for both files.

Resource/Init/pdf_draw.ps


2017-09-15 18:24:44 -0500
Robin Watts <Robin.Watts@artifex.com>
f1ccd5e2c82eb137abb7af000e93447653093a4d

Bug 696399: Fix buffer overflow in image scaling.

Patch calculation that overflows when x_extent is very
negative.

base/gxifast.c


2017-09-15 14:28:28 -0700
Robin Watts <Robin.Watts@artifex.com>
a768ec17b12e44b20d555f3c2fc2c5dcde3d9f0b

Remove stray memsets left in from previous commit.

The "Bug 698427: Fix ignoring errors that lead to division by
zero." commit contained stray memsets.

base/gxshade1.c


2017-09-15 13:04:06 -0700
Robin Watts <Robin.Watts@artifex.com>
45e4bcf4992c6c22e942730f5df393fc6b4cab63

Bug 698427: Fix ignoring errors that lead to division by zero.

By ignoring error return values, we continue running with
uninitialised data, leading to division by zero.

base/gxshade1.c


2017-09-15 10:58:11 -0500
Robin Watts <Robin.Watts@artifex.com>
1b18e15f10532d584c6fc2191e1b2a3f8e5ba7e5

Coverity #135034: Simplify code.

The while loop is not strictly required (but it does match
the other cases). Simplified here.

base/gxscanc.c


2017-09-15 10:47:54 -0500
Robin Watts <Robin.Watts@artifex.com>
6fb9174c1517143158781ed37e0c6d6eb9321808

Coverity #135037: Fix unused variable.

Don't read a value we don't use.

base/gxscanc.c


2017-09-05 14:52:07 +0100
Chris Liddell <chris.liddell@artifex.com>
228ac64b768ac3df1bcd5f63e3f353f8fd01e372

Coverity ID# 135035

Remove pointless "upgraded_copypage" code properly.

The previous commit for this removed code that it should not have done

base/gdevprn.c


2017-09-15 13:42:00 +0100
Chris Liddell <chris.liddell@artifex.com>
3f9d3e1392236fef4658c8dcad15385670d6831e

Revert "Coverity ID# 135035"

This reverts commit 05c3de8915fafb65b96ba0860523a7a79e2577e2.

base/gdevprn.c


2017-09-14 22:40:30 +0100
Chris Liddell <chris.liddell@artifex.com>
12ff84c1ff077c737b0a194761a370de079943fd

Remove man pages for removed (obsolete) tools

(Reported against 9.22 rc1)

doc/gs-vms.hlp
man/de/font2c.1
man/de/wftopfa.1
man/font2c.1
man/gs.1
man/wftopfa.1


2017-09-14 07:01:32 +0100
Chris Liddell <chris.liddell@artifex.com>
7df9b3d9b0dabd9854731fab796d5d458cf743f7

White space issues reported against 9.22 rc1

It seems newer gcc versions (6.4.x and later) report indentation "problems".

Also, add a cast to ensure bitshift op is done on an unsigned value.

base/gsbitops.c
base/gsicc_create.c
base/gxclread.c
contrib/gdevbjca.c
contrib/gdevdj9.c
devices/gdevepsc.c
pcl/pxl/pxpaint.c
psi/dscparse.c
psi/zcrd.c


2017-09-14 06:41:33 +0100
Chris Liddell <chris.liddell@artifex.com>
9e56aafaf2fc8fe3ffeefc0d13fa8c1b033ddec8

Bug 698532: replace ijs/ltmain.sh symlink with file

ijs/ltmain.sh


2017-09-13 08:43:38 +0100
Chris Liddell <chris.liddell@artifex.com>
98e115748ec4b16c610396b9444c1d82d263a30c

Remove reference to old wisc site in Readme.htm
S

doc/Readme.htm


2017-09-12 11:17:15 +0100
Ken Sharp <ken.sharp@artifex.com>
4241a4b3a7099cddac36d13f6c67054483eb7511

Remove unused variable 'pdev' to silence compiler warning

base/gdevp14.c


2017-09-12 10:32:51 +0100
Chris Liddell <chris.liddell@artifex.com>
85e04afbc2c80c8c6b129aff2741cbdf4d41ff67

Update docs dates etc for release

doc/API.htm
doc/C-style.htm
doc/Commprod.htm
doc/DLL.htm
doc/Deprecated.htm
doc/Details8.htm
doc/Details9.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/Helpers.htm
doc/History1.htm
doc/History2.htm
doc/History3.htm
doc/History4.htm
doc/History5.htm
doc/History6.htm
doc/History7.htm
doc/History8.htm
doc/History9.htm
doc/Install.htm
doc/Issues.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.htm
doc/Projects.htm
doc/Ps-style.htm
doc/Ps2epsi.htm
doc/Psfiles.htm
doc/Readme.htm
doc/Release.htm
doc/SavedPages.htm
doc/Source.htm
doc/Unix-lpr.htm
doc/Use.htm
doc/VectorDevices.htm
doc/WhatIsGS.htm
doc/Xfonts.htm
doc/gs-vms.hlp
doc/sample_downscale_device.htm
doc/thirdparty.htm
man/dvipdf.1
man/font2c.1
man/gs.1
man/gslp.1
man/gsnd.1
man/pdf2dsc.1
man/pdf2ps.1
man/pf2afm.1
man/pfbtopfa.1
man/printafm.1
man/ps2ascii.1
man/ps2epsi.1
man/ps2pdf.1
man/ps2pdfwr.1
man/ps2ps.1
man/wftopfa.1
psi/int.mak
psi/msvc.mak


2017-09-12 10:30:01 +0100
Chris Liddell <chris.liddell@artifex.com>
43561187cdb501ac1c6184082065647253d9336c

Product string and date for release

base/gscdef.c
base/version.mak


2017-09-12 10:14:45 +0100
Ken Sharp <ken.sharp@artifex.com>
56ca27c9a95d7917baebd42b04cb08be872d1e39

PDF interpreter - handle invalid XRefStm in hybrid PDF file

Bug #698519 "Invalid XRefStm exits with error"

Just wrap the 'readpdf15xref pop' in a stopped if the user has not set
PDFSTOPONERROR, also add mark/cleartomark to clean up the stack.

Resource/Init/pdf_main.ps


2017-09-11 09:30:59 -0700
Ray Johnston <ray.johnston@artifex.com>
a1cd439519aa07b5f70b1b044342d90377c1188e

Coverity ID 94477 and 158386

94477 suggests a potential access (as an array pcc[i]) past the singelton
address which could occur if pgs->color_component_map.num_components > 1
Copy the "all" value to an array to prevent the issue.

158386 was a mistake, fixed. Two differences show up with bitrgbtags, but
they look the same to me.
tests_private/comparefiles/Altona_Technical_v20_x4.pdf
tests_private/comparefiles/eci_altona-test-suite-v2_technical2_x4.pdf

base/gdevp14.c


2017-09-11 16:22:29 +0100
Ken Sharp <ken.sharp@artifex.com>
9e92e379d04979de614bbdb89a0af5f4aff187cb

Coverity ID 107344 and 107345, again....

When testing the return value from ftell() don't assign it to an
unsigned int....

Warning from clang this time

devices/gdevgprf.c


2017-09-11 09:31:52 +0100
Ken Sharp <ken.sharp@artifex.com>
49d8d66c80d04bd7bfcae0c50e31b18355408e71

Coverity ID 94485 revisited

another place to check that fw is not negative. Missed the fact there
were two instances with the first commit.

devices/minftrsz.c


2017-09-11 09:31:01 +0100
Ken Sharp <ken.sharp@artifex.com>
954ed1df4b60bd9b3fc57b56cb7503cb950e05b9

Coverity IDs 107344, 107345 revisited

Check return values from ftell() as well as fseek()

devices/gdevgprf.c


2017-09-11 08:22:41 +0100
Ken Sharp <ken.sharp@artifex.com>
988e56308515118b723d868e50e8b5836d43f803

Coverity ID 171512

Check return values from seek and propagate errors if encountered.

pcl/pl/plparams.c


2017-09-11 08:20:27 +0100
Ken Sharp <ken.sharp@artifex.com>
c35b385f02e007fe1edf086d8b5175af4a9836f9

Coverity IDs 171513 and 171514

prevent potential divide by zero errors. Instead, propagate error
return codes.

base/gen_ordered.c


2017-09-10 12:40:14 -0700
Ray Johnston <ray.johnston@artifex.com>
d94fd9bd9cb69a998c812eb2f04fdc0083895ae5

Adjust .genordered 50% gray level to be on an desirable boundary

Customer needs 50% gray level with 45 degree Angle and DotShape 8
to be a checkerboard pattern with no stray dots. Add a check to force
the step at 50% to be an even number of dots. Tested for Frequency
from 30 to 150 (at 600 dpi).

psi/zht2.c


2017-09-07 15:38:19 +0100
Ken Sharp <ken.sharp@artifex.com>
dc8eb2a822bda44aab546e0bf7a0e35e3115696b

Coverity ID 94999

I don't believe its actually possible to end up at the if (swap)
without setting run, because the few cases in the switch where we
don't set run, we go back to the top, swap the source and texture,
and then do the switch again, so somehow we will end up setting run

But its cheap to initialise it, and it will silence Coverity, and it
guards against any possible future problem.

base/gsroprun.c


2017-09-05 16:53:52 +0100
Chris Liddell <chris.liddell@artifex.com>
ff5828a537fbf8b58095f5147b2acd59a6330941

Compiler warning: discaring const

The fix for coverity ID# 127201 introduced a compiler warning due to an
accessor macro (ctm_only) implicitly adding const. Make the local variable
const, too.

base/gxipixel.c


2017-09-05 15:46:03 +0100
Chris Liddell <chris.liddell@artifex.com>
6846f1d5d8c7f5512fc385b3b9e2fa95cc720c53

Coverity ID# 94891

Add a cast to make integer division explicit.

base/gsdparam.c


2017-09-07 13:35:35 +0100
Ken Sharp <ken.sharp@artifex.com>
534257c41de66f040fa548b47f2bf5950cb5a3cb

Coverity ID 94819

No structural changes, just change a couple of pointer type declarations
I think this should satisfy Coverity and there doesn't seem to be any
actual problem here.

base/gxclthrd.c


2017-09-07 12:11:47 +0100
Ken Sharp <ken.sharp@artifex.com>
f12500705c692b0ad51156081901fcd3457a5601

Coverity ID 158370

Again we shouldn't be able to get to the flagged code with 'raster'
being uninitialised, because 'data', which is initialised to 0 would
have to be updated, and that would mean raster was updated as well.

But since we already initialise data its cheap to initialise raster too.

base/gximag3x.c


2017-09-07 11:36:59 +0100
Ken Sharp <ken.sharp@artifex.com>
627b0c8a1228830917bb2420edb4613550dd4ef1

Coverity ID 94819

The comments on clist_end_page() state that it returns negative for an
error, 0 for success and positive for success with a low memory warning.

In fact it always returns 0.

This means we don't conform to the comments, and discard any errors that
occur.

This commit reformats the code to reduce the number of tests and to
store the error codes, as well as adding the potential to return
something other than 0.

base/gxclist.c


2017-09-07 10:09:04 +0100
Ken Sharp <ken.sharp@artifex.com>
be04e2ac2389e6fcc2ccf7b50434678c7aefa19d

Coverity ID 94571

Its not obvious whether raster can ever be 0 here, it clearly never is
during our tests, and I think it should not be possible, but just in
case we'll guard the division with a check.

base/gsimage.c


2017-09-07 08:51:31 +0100
Ken Sharp <ken.sharp@artifex.com>
24bbc1ed3d0553964dd5086b08062442071e4ef5

Fix memory leak

An error exit would leave 'filter' and 'screen_blur' allocated, and
therefore a memory leak.

base/gen_ordered.c


2017-09-06 15:51:33 -0700
Ray Johnston <ray.johnston@artifex.com>
30e336aee9812ca3610931f86ea641d82022c8ca

Second fix for missing FULL_FILE_NAME_LENGTH

Previous commit fixed the RAW_SCREEN_DUMP=1 case, but broke the normal
case. Also added #ifndef RAW_SCREEN_DUMP around the setting in gen_odrered.h
so that the preprocesor flag could be set via the command line.

Lastly, add base/gen_ordered.h to the Headers section of the .vcproj

base/gen_ordered.h
toolbin/halftone/gen_ordered/gen_ordered.vcproj


2017-09-06 14:23:05 -0700
Ray Johnston <ray.johnston@artifex.com>
a92188b76f30c5840ce8b0716e5c70e9791fb6eb

Fix RAW_SCREEN_DUMP for gen_ordered standalone

In refactoring, I missed that FUL_FILE_NAME_LENGTH was needed if
RAW_SCREEN_DUMP was > 0 (RAW_SCREEN_DUMP is #define'd in genordered.h,
so put the definition there.).

base/gen_ordered.h
toolbin/halftone/gen_ordered/gen_ordered_main.c


2017-09-06 19:08:24 +0100
Ken Sharp <ken.sharp@artifex.com>
6b085aa479bcf0c8cb426c0b51fe7f98faba72ff

Coverity ID 94886

Remove a NULL pointer check, there's no possible way the pointer
can be NULL at this point. Or if there is, its because a NULL
pointer was passed in as an argument, and we will seg fault earlier
in this function anyway, so no point in checking it here.

base/gxfill.c


2017-09-06 19:06:22 +0100
Ken Sharp <ken.sharp@artifex.com>
754e99239371ec4aa06a9728ae65028ac22c440c

Coverity ID 94627

Guard the dereference of pdht with a NULL pointer test, to avoid a
potential seg fault.

base/gxdevndi.c


2017-09-06 16:31:48 +0100
Ken Sharp <ken.sharp@artifex.com>
6857ef647312daa24eb47417b09d823e8b59831d

Coverity ID 141334

Add some error checking

base/gxclip.c


2017-09-06 15:58:28 +0100
Ken Sharp <ken.sharp@artifex.com>
198924f4c94c561543f5838900e21ed761a886a5

Coverity ID 95001

We can only get back here by jumping to the label 'top'. ymax is not
used between this point and the last 'goto top', and it is then
recalculated before being used.

So the assignment is indeed pointless.

base/gxacpath.c


2017-09-06 15:11:56 +0100
Ken Sharp <ken.sharp@artifex.com>
0808c9eec2a92db3176b3eac0520f48a2119ddf9

Coverity IDs 164020, 164022, 164025

We don't need to check if dot_grid.data is NULL.

Testing a == 0 && b == 0 after testing a nd b individually can't be
correct. Test for both being zero first.

In the case of an error, we could attempt to free memory that had not
been allocated. Prevent this by checking dot_level_pos is non-NULL.

base/gen_ordered.c


2017-09-06 14:37:21 +0100
Ken Sharp <ken.sharp@artifex.com>
05768db75e90f56c6fda33c9c14515a3e0b6aeaa

Addition to commit 18f009a08f1eac4708188b516d375356a502a3b1

Forgot to initialise the pointer to NULL before starting.

base/gdevp14.c


2017-09-06 10:03:40 +0100
Ken Sharp <ken.sharp@artifex.com>
18f009a08f1eac4708188b516d375356a502a3b1

Coverity IDs 138751, 141130, 141131, 158373

138751 - The code assumes that a separating device has an ICC profile
but doesn't check. Add a check and return an error if it doesn't.

141130 - initialise a structure member

141131 - check and action return codes

158373 put #if DEBUG round some code that's only present to provide a
breakpoint location in debuggers. (and told Coverity to ignore this)

base/gdevp14.c


2017-09-05 15:28:19 +0100
Chris Liddell <chris.liddell@artifex.com>
61856e04852124491a47fa6379f1c3ad296f3366

Coverity ID# 122660

NULL pointer check - the code branch above already does so, looks like a simple
ommission

base/gxiscale.c


2017-09-05 15:21:23 +0100
Chris Liddell <chris.liddell@artifex.com>
1b9ea22b3456a24e356d3f5a68036cecbb28af56

Coverity ID# 126580

Explicitly promote an unsigned char value to a long.

base/gxclrect.c


2017-09-05 15:12:09 +0100
Chris Liddell <chris.liddell@artifex.com>
28e95004b508a3f4cd73552d92f7f4cd699c645b

Coverity ID# 127201

Fix potential NULL pgs (graphics state) pointer dereference. I suspect this can
never occur, but it's cheap and should silence coverity

base/gxipixel.c


2017-09-05 14:52:07 +0100
Chris Liddell <chris.liddell@artifex.com>
05c3de8915fafb65b96ba0860523a7a79e2577e2

Coverity ID# 135035

Remove pointless "upgraded_copypage" code.

base/gdevprn.c


2017-09-05 14:18:10 +0100
Ken Sharp <ken.sharp@artifex.com>
9a6045cc4c7843ee8608c1d4a2fb76e8a10a6581

Coverity ID 95054

Explicitly initialise a member of the new 'order' structure.

base/gxdhtserial.c


2017-09-05 13:36:45 +0100
Chris Liddell <chris.liddell@artifex.com>
7dd033589ce40649ab602fba4c0473aa40c48439

Bug 698471: apply vertical substitute glyphs in TTF fonts

We weren't applying vertical glyph substition (from the gsub table).

base/gstype42.c
psi/zfapi.c


2017-09-05 13:23:24 +0100
Chris Liddell <chris.liddell@artifex.com>
f753769041467a1c88084d6d26c2755d7174691d

Bug 698486: memory leaks from fontconfig calls

Address most of the memory leaks stemming from the use of fontconfig.

In this case, just destroying the fontconfig context.

base/gp_unix.c


2017-09-04 09:39:18 +0100
Chris Liddell <chris.liddell@artifex.com>
8b249d3ebd8058f2961770e21c72e1ac703cc12f

Coverity ID 139142: etc.c modulo by zero

Only calculate tmline when it will actually be used. The calculation uses
y % tmheight, but only the ETS_RSTYLE_THRESHOLD case is called with
tmheight != 0

base/ets.c


2017-09-05 12:16:38 +0100
Ken Sharp <ken.sharp@artifex.com>
463854833474dc3ae642e17707e50c451ada1fec

Coverity ID 94994

Check a return value and action it.

base/gxp1fill.c


2017-09-05 11:41:38 +0100
Ken Sharp <ken.sharp@artifex.com>
aa75f905024bdf13882c30e543d64e285e22aad1

Coverity ID 158395

I think its not currently possible to trigger this, as it would require
setting up the device pointer incorrectly before entering this routine.
However Coverity is correct that it appears possible to end up doing
a NULL pointer dereference, so add a guard to maek sure that can't
happen.

base/gzspotan.c


2017-09-05 10:45:14 +0100
Ken Sharp <ken.sharp@artifex.com>
06b5a54361525363bdc163b88f965f0d1a295087

Coverity ID 94914

Remove an unnecessary copy of a variable, its unconditionally
overwritten immediately after. Comment that.

base/sfilter2.c


2017-09-05 09:58:24 +0100
Ken Sharp <ken.sharp@artifex.com>
3f40707f85296c0abf798c9c32c79db33affbddc

Coverity IDs 94554 and 94551

We weren't checking the return values from gp_fseek_64 or fstat() and
in a couple of places weren't even able to return an error anyway
(void function).

So check the error returns from the C run-time and add error handling
as required in order too report these.

base/sfxcommon.c
base/sfxstdio.c
base/stream.h


2017-09-04 19:02:39 +0100
Ken Sharp <ken.sharp@artifex.com>
ac6c349f54b09df7b2f8cf606b8fe7e62291c2e0

Coverity ID 94959

We were failing to free a couple of allocated buffers in the event of an
error. The other error test all free both buffers properly.

devices/rinkj/rinkj-epson870.c


2017-09-04 17:26:45 +0100
Ken Sharp <ken.sharp@artifex.com>
a11bd1f982f8a8491a4c1ab45aa5535426d01dca

Coverity IDs 94868, 94936, 158371

Initialise some arrays, these are sparsely populated by the code and
potentially possible to access uninitialised data.

devices/rinkj/evenbetter-rll.c


2017-09-04 17:01:14 +0100
Ken Sharp <ken.sharp@artifex.com>
538f12d7bdd292c4798161a5d49ba2f3bcfebbe3

Alter the fix for Coverity ID 94726

Ray objected to my original change, because the debug output would not
be a valid file. So instead we choose to lose the information that
logbits2 is non-zero and drop the if clause.

devices/gdevplib.c


2017-09-04 16:57:32 +0100
Ken Sharp <ken.sharp@artifex.com>
e0d49f799157f2d0ba1ea4969cc225a15d108cf7

Coverity IDs 94478 and 94485

The first is a clear typo, the code below this point is the same as the
code modified in this commit.

The second one is less clear, but I think its reasonable, if there is
no '0' (-1 return from next_zero()) then we can't make the feature
larger by darkening to the right, so darken to the left.

devices/minftrsz.c


2017-09-04 16:27:32 +0100
Ken Sharp <ken.sharp@artifex.com>
f7d9662c5737d42942dbe1f5d4e74a9d00838b56

Coverity ID 94479

The macro used here says it shouldn't be used for run-time calculations.
However this code does use it, I'm not certain for what purpose. Since
it clearly is possible to get a negative shift, add a guard to the
values to make sure that can't happen.

Since this code is conditionally compiled out, anyone who compiled it
in and finds a problem can easily fix it.

devices/gdevxcmp.c


2017-09-04 15:56:29 +0100
Ken Sharp <ken.sharp@artifex.com>
0462b654d8a57688c1b811a4e04ad8a7aaf0dab9

Coverity ID 127202

Check the stored graphics state and if its 0, use the default method.

Remove the now redundant later check on pgs being 0 before use.

devices/gdevx.c


2017-09-04 15:16:42 +0100
Ken Sharp <ken.sharp@artifex.com>
2c5d0e0970e60d9d4c61865d61fb39629dfd6623

Coverity IDs 94503, 94506, 94523, 94536

A number of pointless comparisons, checking that a signed 32-bit variable
had a value less than the maximum for a signed 32-bit integer.

Remove them all.

devices/gdevupd.c


2017-09-04 14:32:22 +0100
Ken Sharp <ken.sharp@artifex.com>
ae7f71a161803d10f263585e8b2e5087835f51b8

Coverity IDs 94719, 94889, 94912, 94967, 95088, 101187

Return an error instead of storing it (where it gets lost)

As per gdevpsd.c and gdevprf.c refactor the #if conditional compiled
code to remove a variable and get rid of Coverity warning.

In the 'build_cmyk_raster_line_fromplanar* routines, pass the params as
a pointer instead of copying the whole 500+ byte structure around.

Finally, not a Coverity warning but a compiler warning; remove an unused
variable.

devices/gdevtsep.c


2017-09-04 13:47:16 +0100
Ken Sharp <ken.sharp@artifex.com>
413cefabb9888c0810e1c4c23e603fa4e69c7c1d

Coverity IDs 94856 and 94719

If we get an error from param_read_name, then just return it.

The AddLut lookup is less obvious. Clearly the size of the LUT read from
the config file should not be less than 0, but there's no clear upper
limit (other than an unsigned integer). However a 4Gb config file seems
unlikely. The only example we have has ~23 values for each plane, so a
limit of 256 entries seems reasonable. If anyone complains its easy to
increase and we can ask the user what a reasonable limit should be.

devices/gdevrinkj.c


2017-09-04 13:12:27 +0100
Ken Sharp <ken.sharp@artifex.com>
1cf6a2a71851e507716bd5c82c8c991239ac04e0

Coverity ID 94728

As with gdevgprf.c, refactor the #if conditional compilation so that we
don't need a variable, and remove the Coverity warning.

devices/gdevpsd.c


2017-09-04 12:12:06 +0100
Ken Sharp <ken.sharp@artifex.com>
cdceb9e93516264fcdae965e5eeb0e733bad76ee

Coverity IDs 94596, 94726

A debug print was identical in both the if and else clauses. Not really
important since its debug, but change the else to match others of the
same type.

line_ptrs was calculated and altered in the loop invocation, but its
then immediately overwritten in the loop body, making it pointless.

devices/gdevplib.c


2017-09-04 11:29:50 +0100
Ken Sharp <ken.sharp@artifex.com>
11e90b8945a54e4e16c702a4ba4ed19cef47f4a2

Coverity ID 158390

Since line is recalculated inside the loop on every iteration, there's
no point in calculating it in the loop definition.

devices/gdevphex.c


2017-09-04 10:47:04 +0100
Ken Sharp <ken.sharp@artifex.com>
615d7caf21e957fe3716ef9264def280df20beb7

Coverity IDs 121444, 121445, 121449

More problems with intermediate promotion to int, probably caused when
gx_color_index went from 32 to 64 bits.

devices/gdevpbm.c


2017-09-04 10:29:55 +0100
Ken Sharp <ken.sharp@artifex.com>
65ef52484c9a973f5fcb72b258cf1bf5a4653a75

Coverity ID 158391

Initialise 'backtable'. The code does later fill in some entries in
backtable, but it doesn't fill all of them and I can see no coherence
between the filling in code and the code that reads data from it. It
really does look like its possible to read uninitialised data here.

devices/gdevmgr.c


2017-09-03 17:14:41 +0100
Ken Sharp <ken.sharp@artifex.com>
5f73a2c82f0cbd0d0965709066ebdf13cc0b9c9d

Coverity ID 94489

The spec says that it must be 3 bytes, and uses a 16 bit shift example
(suggesting it is stored in the Brother driver as 24 bits).

For us its a short, so rather than copy the brother code, set it to 0 to
avoid any confusion over whether shifting a short right by 16 results in
all 0 or all 1.

devices/gdevhl7x.c


2017-09-03 11:48:54 +0100
Ken Sharp <ken.sharp@artifex.com>
4e122728ecf07941e15f75fc7feaec57eeb54e90

Coverity IDs 107340, 107341, 107343, 107344, 107345, 121455

Considerable rework of error checking in this device.

Firstly add error return checks on fseek and fwrite. Alter functions to
return those errors. Alter the parent functions to check the errors,
repeat until we bubble up to the top level.

Coverity claims that ftell() can return a negative value, which as far
as I can see is not true. However, by casting the return value to an
unsigned type, and altering the variable types appropriately, I think
we should eliminate this warning.

Refactor conditionally compiled code to eliminate a variable and get
rid of a dead code warning.

devices/gdevgprf.c


2017-09-02 18:31:11 +0100
Ken Sharp <ken.sharp@artifex.com>
18d430f97d95d5919fb9ea06b63423c8367548b9

Coverity ID 94722

Change the way memory allocation and free'ing is done so that we no
longer check row_first, which is always 0. THis should mean that we
don't need to check min_feature_data before passing it to
min_feature_size_process(), it is allocated in min_feature_size_init()
and we do actually now check the return value from there to ensure
there are no errors which could leave min_feature_data uninitialised.

devices/gdevfax.c


2017-09-02 17:19:00 +0100
Ken Sharp <ken.sharp@artifex.com>
4b07f41941f75fc54cd6937ff18426402ab9af36

Coverity IDs 94575 and 94722

Remove some dead code, refactor and add error checking to avoid a NULL
pointer dereference

devices/gdevdjtc.c


2017-09-02 16:33:06 +0100
Ken Sharp <ken.sharp@artifex.com>
6a4506040593416d23930049e41e806336335e67

Coverity ID 94526

Add some error checking on file handling, and report ioerrors if they
fail.

devices/gdevdfax.c


2017-09-02 15:09:25 +0100
Ken Sharp <ken.sharp@artifex.com>
998dd6a53f17104decc8533d5978023fdd008c21

Coverity ID 94814 and 94980

I wasn't able to find a way to reproduce this, because it relies on
a particular sequence of lines/points. We must fill the data buffer to
the point where another line or curve will not fit, and then the next
curve or line must be a 'POINTS_NONE'.

In this case we will not flush the accumulated points, which means we
will not reset the counter, but we will then still go on to save the
current co-ordinates in the data buffer, which will cause an overflow.

Fixed by reducing the 'full' check slightly, so that we still have one
line/curve slot open in the data buffer. If we get a POINTS_NONE then
we check to see if we have already gone past the slop. If we have, simply
reduce the counter by one which will cause us to overwrite the previous
points. Since this must have also been a POINTS_NONE, this just means
in effect that we have combined consecutive ones.

I'm not certain its even possible to get consecutive POINTS_NONE, but
its best to be safe.

This should silence Coverity, and fixes the genuine (if hard to
reproduce) potential problem.

devices/vector/gdevpx.c


2017-09-02 11:02:23 +0100
Ken Sharp <ken.sharp@artifex.com>
3a98b6855660c84b2fa5529cc25bdbdc4b2b9d7a

Coverity ID 94943

I think this code is incorrect, because this routine *always* maps
CMYK to CMYK, so there's no need to test the colour depth.

Also, it always gets provided with a CMYK buffer, not an RGB one so it
actually can't write off the end of the buffer. But the declaration
was wrong, so fix that here to avoid the warning.

devices/gdevcdj.c


2017-09-02 10:55:51 +0100
Ken Sharp <ken.sharp@artifex.com>
065b5cc15cea365c3fa5a1f3133416a0db228082

Coverity ID 95019

This code was unreachable, its even commented as such. So lets just
remove it.

devices/gdevcdj.c


2017-09-02 10:54:06 +0100
Ken Sharp <ken.sharp@artifex.com>
a48211dc97ef345261e7e9a08818dd274b07040e

Coverity ID 94736

Guard against a NULL pointer dereference. If we didn't recognise the
pritner type, then it was possible to attempt to use a NULL pointer.

devices/gdevcdj.c


2017-09-02 10:50:34 +0100
Ken Sharp <ken.sharp@artifex.com>
77fae933e126cb3b3aad9faa30a659294ed8a44a

Coverity ID 94708

The original code in here was correctly noted by Coverity as being
dead, because the division by BJC_RESOLUTION_BASE meant that we were
always comparing 0 with 0.

In addition, the use of bit shifting meant that the resolution wasn't
tested against a simple multiple of 90 dpi, but against powers of 2
times 90 dpi, which rapidly led to ridiculous values.

I'm not certain what the original limits should have been here, and
I don't have a bjc device to test against, but the code as it stood was
clearly incorrect, and this at least stands some chance or working.

devices/gdevcdj.c


2017-09-02 10:28:44 +0100
Ken Sharp <ken.sharp@artifex.com>
1e6e40715f9038b177cf4649945af38b4b21e83c

Coverity ID 121443

This was supposed to be in the earlier commit but somehow fell off...

devices/vector/gdevpx.c


2017-09-02 09:59:30 +0100
Ken Sharp <ken.sharp@artifex.com>
f2a4735118b9558a76adf46e7bb6f814a74ffb38

Coverity ID 94703

param_string_from_string cannot return an error so don't try to
check it.

devices/vector/gdevpx.c


2017-09-02 09:51:33 +0100
Ken Sharp <ken.sharp@artifex.com>
ca09b00d27d7a855c0e7cbf55c26b5e287262cca

Coverity IDs 121437, 121438 and 121443

Not certain if these are really a potential problem, but a type cast
safely resolves any potential for error.

I suspect this is a hang over from when gs_color_index was a 32-bit
value instead of 64.

devices/vector/gdevpx.c


2017-09-02 09:40:14 +0100
Ken Sharp <ken.sharp@artifex.com>
34ac92ae1741e4d8573162efbd25520bc8796424

pdfwrite - remove unused code

This code was left over from transfer function the /Apply work, but is
no longer used. It was also raising warnings with scan-build and
didn't work properly anyway (which is why its unused).

So remove it.

devices/vector/gdevpsdf.h
devices/vector/gdevpsdi.c
devices/vector/gdevpsds.c
devices/vector/gdevpsds.h


2017-08-31 16:11:15 +0100
Ken Sharp <ken.sharp@artifex.com>
4129543f9f51ccaf97d8429a9e66e348394e95b0

PDF interpreter - add support for Choice fields in Widget annotations

Bug 698461 "PDF files with filled forms are not rendered correctly if they have drop-down lists"

We didn't support Choice fields in either AcroForms or Widget annotations
which leads to these not being rendered if they have no Appearance (in
the case of widget annotations) or not rendered at all in the case of
AcroForms.

This commit adds simple support for single selection Choice fields, we
may want to improve this later.

Resource/Init/pdf_draw.ps
devices/vector/gdevpsds.c


2017-08-30 16:36:20 +0100
Chris Liddell <chris.liddell@artifex.com>
e547f2490aa40a4f8e35bb15e6815e7d6f1be22a

clang warning in color mapping code

We were bit shifting -1 (i.e. -1 << x) which is, strictly speaking undefined.

Where what was meant was meant was -(1 << x).

base/gxcmap.c


2017-08-30 16:28:08 +0100
Chris Liddell <chris.liddell@artifex.com>
dafd08a54332f66760b8d667a4b59f42bd4edf1f

clang warnings in the TTF code.

There was a type mismatch: we were using a boolean to track if an error had
occurred, but in most places we were treating it as a gs error code (int type).

Change the type to int, and tweak the couple of places where it was treated as
a bool.

base/gxttfb.c
base/gxttfb.h


2017-08-25 10:54:42 +0100
Chris Liddell <chris.liddell@artifex.com>
ff70cedd80fd037414abb8a17cd1988d92da2ad6

This is a combination of 7 commits.

from the openjpeg-2.2.0-update branch

1) OpenJPEG 2.2.0 initial commit
0b5fc7368721af148d85ef8dac2e018de10cfe91

2) Zap the openjpeg stuff we don't need
e90bbccd19cb266b55de28ebfd16d024b6e67373

3) Add predefined openjpeg headers.
71242c9a04bb76b8b17fc489d62a91d04c1ad60c

4) Import patches from Sumatra's tree.
8b89e4b5750069172522ecf85e69d094b5e567e7

5) update makefiles, interface and vcproj files for new openjpeg version
456cbe1c76659b0ab022f6ca3f67cc63b253b05f

6) Avoid getenv call in openjpeg
202a0318a7b3a397fcd5d015dcad4293474f464c

7) Bug 698135: Import security fix for OpenJPEG
8057698a5f7833499fdf8d2529162841920e354a

base/openjpeg.mak
base/sjpx_openjpeg.c
openjpeg/.gitignore
openjpeg/.travis.yml
openjpeg/CHANGELOG.md
openjpeg/NEWS.md
openjpeg/THANKS.md
openjpeg/src/CMakeLists.txt
openjpeg/src/lib/openjp2/CMakeLists.txt
openjpeg/src/lib/openjp2/bench_dwt.c
openjpeg/src/lib/openjp2/bio.c
openjpeg/src/lib/openjp2/bio.h
openjpeg/src/lib/openjp2/cidx_manager.c
openjpeg/src/lib/openjp2/cidx_manager.h
openjpeg/src/lib/openjp2/cio.c
openjpeg/src/lib/openjp2/cio.h
openjpeg/src/lib/openjp2/dwt.c
openjpeg/src/lib/openjp2/dwt.h
openjpeg/src/lib/openjp2/event.c
openjpeg/src/lib/openjp2/event.h
openjpeg/src/lib/openjp2/function_list.c
openjpeg/src/lib/openjp2/function_list.h
openjpeg/src/lib/openjp2/image.c
openjpeg/src/lib/openjp2/image.h
openjpeg/src/lib/openjp2/indexbox_manager.h
openjpeg/src/lib/openjp2/invert.c
openjpeg/src/lib/openjp2/invert.h
openjpeg/src/lib/openjp2/j2k.c
openjpeg/src/lib/openjp2/j2k.h
openjpeg/src/lib/openjp2/jp2.c
openjpeg/src/lib/openjp2/jp2.h
openjpeg/src/lib/openjp2/libopenjp2.pc.cmake.in
openjpeg/src/lib/openjp2/mct.c
openjpeg/src/lib/openjp2/mct.h
openjpeg/src/lib/openjp2/mqc.c
openjpeg/src/lib/openjp2/mqc.h
openjpeg/src/lib/openjp2/mqc_inl.h
openjpeg/src/lib/openjp2/openjpeg.c
openjpeg/src/lib/openjp2/openjpeg.h
openjpeg/src/lib/openjp2/opj_clock.c
openjpeg/src/lib/openjp2/opj_clock.h
openjpeg/src/lib/openjp2/opj_codec.h
openjpeg/src/lib/openjp2/opj_common.h
openjpeg/src/lib/openjp2/opj_config.h
openjpeg/src/lib/openjp2/opj_config.h.cmake.in
openjpeg/src/lib/openjp2/opj_config_private.h
openjpeg/src/lib/openjp2/opj_config_private.h.cmake.in
openjpeg/src/lib/openjp2/opj_includes.h
openjpeg/src/lib/openjp2/opj_intmath.h
openjpeg/src/lib/openjp2/opj_inttypes.h
openjpeg/src/lib/openjp2/opj_malloc.c
openjpeg/src/lib/openjp2/opj_malloc.h
openjpeg/src/lib/openjp2/opj_stdint.h
openjpeg/src/lib/openjp2/phix_manager.c
openjpeg/src/lib/openjp2/pi.c
openjpeg/src/lib/openjp2/pi.h
openjpeg/src/lib/openjp2/ppix_manager.c
openjpeg/src/lib/openjp2/raw.h
openjpeg/src/lib/openjp2/t1.c
openjpeg/src/lib/openjp2/t1.h
openjpeg/src/lib/openjp2/t1_generate_luts.c
openjpeg/src/lib/openjp2/t1_luts.h
openjpeg/src/lib/openjp2/t2.c
openjpeg/src/lib/openjp2/t2.h
openjpeg/src/lib/openjp2/tcd.c
openjpeg/src/lib/openjp2/tcd.h
openjpeg/src/lib/openjp2/tgt.c
openjpeg/src/lib/openjp2/tgt.h
openjpeg/src/lib/openjp2/thix_manager.c
openjpeg/src/lib/openjp2/thread.c
openjpeg/src/lib/openjp2/thread.h
openjpeg/src/lib/openjp2/tls_keys.h
openjpeg/src/lib/openjp2/tpix_manager.c
windows/ghostscript.vcproj


2017-08-31 09:40:51 +0100
Ken Sharp <ken.sharp@artifex.com>
d1dbe825e2fefed1156d0f5e02e6b4d5f20a7781

pdfwrite - address compiler warnings

A couple of benign compiler warnings, assigning to an unused variable

Also add some white space because the construction seems to confuse
scan-build.

devices/vector/gdevpdfg.c
devices/vector/gdevpsds.c


2017-08-30 15:36:10 +0100
Ken Sharp <ken.sharp@artifex.com>
794c559e34192d96b772950f854600add9c86651

PDF interpreter - make sure Stamp appearance synthesis cannot have 0 scale

One of the new PDF 2.0 Quality Logic files exhibited a problem with
synthesising a missing Appearance for some Stamp annotations; the
scale factor could be calculated as 0.

This commit makes the minimum scale value 1

Resource/Init/pdf_draw.ps


2017-08-30 10:18:19 +0100
Ken Sharp <ken.sharp@artifex.com>
782ca576c8582457b063481a4315f7b767ec4546

PDF interpreter - fix implementation of HTO

I implemented HTO by using the existing sethalftonephase without an
example to look at. It turns out that sethalftonephase uses
.setscreenphase which expects three integers while HTO consists of
an array of 2 reals.

We already manufacture the third integer (the texture) and use aload to
extract the two reals. This commit uses transform to apply the CTM and
then cvi to convert the HTO numbers to something that makes a difference
and is legal.

Fixes the error and the resulting file (rendered at 1bpp) does show a
difference in the halftone at 300 dpi or better.

Resource/Init/pdf_draw.ps


2017-08-29 14:04:28 +0100
Ken Sharp <ken.sharp@artifex.com>
050f12a7c1c9b6e17fd6253924ce5929861cd99f

PDF interpreter - Properly clamp real arguments for /Indexed spaces

Bug #698434 "real operands to /Indexed spaces not properly limited (PDF 2.0)"

The quality Logic PDF 2.0 test file fts_14_1422.pdf tests /Indexed
colour spaces with real value to see if the notes in Section 8.6.6.3
regarding real values are adhered to. Previously we simply set such
values to the lowest integer (truncated the fractional part) which is
wrong according to both the PDF and PostScript specifications.

The PDF specification specifically states that 0.5 rounds *up* while
the PostScript Language Reference Manual (unusually) doesn't state
exactly what 'nearest' means.

Since it was wrong for both before I've chosen to apply the same rules
for both PDF and PostScript, 0.5 and above rounds up, other reals round
down. Values outside the range 0->hival are clamped to either 0 or
hival whichever is nearer (this was already done in fact).

psi/zcolor.c


2017-08-29 10:37:23 +0100
Ken Sharp <ken.sharp@artifex.com>
ed962af64e86887b0c2ca614c877bb743315d414

PDF Interpreter - Paint one pixel for Patterns with BBox width/height of 0

Bug #698431 "PDF 2.0 - Patterns with BBox where width or height = 0 should paint 1 pixel"

The ISO32000-2:2017 specification explicitly states (See section 8.7.3.1
Table 74 and section 8.7.4.3 Table 77) that a Pattern with a BBox where
the width or height is 0 should still paint one pixel.

We achieve this here by detecting the condition where width or height in
a Pattern BBox is exactly 0, and add a tiny amount to the urx or ury
to ensure that one pixels is touched, and therefore painted.

Resource/Init/pdf_draw.ps


2017-08-28 15:28:01 +0100
Ken Sharp <ken.sharp@artifex.com>
93b7c164f969787767da98ea3cb4b3efdb6ffc32

fix previous commit

Commit e239afa0924503e131b0445bf2624da90f7c93d1 accidentally broke
ps2write for files with a halftone, but no transfer function. We do need
to check to see if the transfer function is present before trying to
emit it!

For safety, set the character array to NULLs before we start.

devices/vector/gdevpdfg.c


2017-08-28 14:38:02 +0100
Ken Sharp <ken.sharp@artifex.com>
e239afa0924503e131b0445bf2624da90f7c93d1

pdfwrite - fix 2 scan-build warnings

devices/vector/gdevpdfg.c


2017-08-28 14:31:37 +0100
Ken Sharp <ken.sharp@artifex.com>
f06cb1ba2d51c44cd27cbf12e2011d15e49cd3ad

PDF Interpreter - Handle recursive /Prev entries in trailer dictionaries

Bug #698409 "PDF xref loop causes denial of service"

This commit creates an array and stores the offset of each /Prev as it
is encountered while processing xrefs. Each Prev is also compared
against every preceding offset already stored in the array. If we get
a match then we have recursion and we break out. The file may not render
correctly, and we issue the usual warning.

For complex reasons it was necessary to create the array and store it in
the current dictionary rather than simply leave it on the stack, so we
undef it again after use.

Resource/Init/pdf_main.ps


2017-08-26 10:39:51 +0100
Ken Sharp <ken.sharp@artifex.com>
347f334e934356746f7cc63e478fee41a2c4a8dd

pdfwrite - fix a couple of compiler warnings

Nothing serious, but the code wasn't checking some error returns. We
should do that so fixed here.

devices/vector/gdevpdfg.c


2017-08-26 10:03:00 +0100
Ken Sharp <ken.sharp@artifex.com>
56aa7b23cbb3cea465ba962ce57157e3a6101e3a

pdfwrite - add code to apply transfer functions instead of preserving

With the release of the PDF 2.0 specification transfer functions have
been deprecated in graphics states. This means we can no longer simply
preserve transfer functions as we have done in the past, and removing
them can lead to unexpected results (Quark XPress is notorious for
using transfer functions inadvisably). So this commit alters the colour
handling code fairly extensively in order to allow transfer functions
to be applied.

In order to achieve this there are conditions under which we are forced
to convert colour spaces, as its not possible to apply the transfer
function reasonably to the base space (CIEBased colour spaces are an
example of this). In this case we will use the ProcessColorModel in
effect at the time as the space to convert to.

Its also (unfortunately) the case that when the input is a PDF file,
the PDF file uses transparency and the PDF file has transfer functions
set in the graphics state, that some kinds of operation (soft mask
groups for example) cannot have the transfer function simply applied.
This can result in surprising output. In these (admittedly rare) cases
removing the transfer function causes differently incorrect output.
There is no realistic way for us to take a PDF file like this and
produce an equivalent PDF file which does not contain transfer function.
Worse, we can't even detect this condition in advance.

This concludes the work required to support PDF 2.0 creation, and
Ghostscript should now be able to create and consume PDF 2.0 files
though additional work may be required, and we may choose to add
more functionality (eg Document Parts processing) in the future.

devices/vector/gdevpdfg.c
devices/vector/gdevpdfi.c
devices/vector/gdevpdfp.c
devices/vector/gdevpdft.c
devices/vector/gdevpsdf.h
devices/vector/gdevpsdi.c
devices/vector/gdevpsds.c
devices/vector/gdevpsds.h
doc/VectorDevices.htm


2017-08-23 16:41:14 -0700
Ray Johnston <ray.johnston@artifex.com>
bd8b456c088516e622659fb58c1079ef0d4aa21f

Fixes for .genordered

The zgenordered function created the "THRESH_STRING" length string
which would be rejected by sethalftone since the Width * Height was
not equal to the length of the Thresholds string.

Rather than a compile time switch, the .genordered param dict now
has /OutputType, one of /Type3, /ThreshString, or /TOSArray.

The supercell code still had a "realloc". This was replaced by the
simple ALLOC, memcpy, FREE equivalent.

There were still several places that used naked printf. Changed to
respect the "verbose" value or to use EPRINTF* macros. This required
a couple of new macros.

Lastly, add DITHERSC (SuperCellSize) and DITHERLEVELS (Levels) as
options in the gen_ordered_example.ps

base/gen_ordered.c
doc/Language.htm
psi/int.mak
psi/zht2.c
toolbin/halftone/gen_ordered/gen_ordered_example.ps


2017-08-22 11:27:38 -0700
Ray Johnston <ray.johnston@artifex.com>
1a9c68e70e338c31a1fbfce6c3750123c6dda319

Move gen_ordered.c from toolbin to base.

Modify to strip non LIB_BUILD functions from gen_ordered.c and
move gen_ordered.[ch] to base. Main now in gen_ordered_main.c with
project file referencing ../../../base/ for gen_ordered.[ch].
Modify the project file appropriately and add a simple Makefile for
unix.

base/gen_ordered.c
base/gen_ordered.h
base/lib.mak
base/msvclib.mak
base/openvms.mak
base/ugcclib.mak
base/unix-gcc.mak
base/unixansi.mak
psi/int.mak
psi/msvc.mak
psi/os2.mak
toolbin/halftone/gen_ordered/Makefile
toolbin/halftone/gen_ordered/README
toolbin/halftone/gen_ordered/gen_ordered.vcproj
toolbin/halftone/gen_ordered/gen_ordered_main.c


2017-08-19 14:36:59 -0600
Henry Stiles <henry.stiles@artifex.com>
37c454cb7f70fd27f14dd2c1b9c63528b3a237ab

Fix debug -dNOCACHE command line option.

In the last PL API change the code to disbable the cache was
accidentally removed.

xps/xpstop.c


2017-08-22 13:43:00 +0100
Chris Liddell <chris.liddell@artifex.com>
3d3fbafe4a8d1a74a3edb3acbe844da66e1176a2

Bug 698392: add a type check to transparency enum_param()

We were using a ref parameter as a name object without checking its type first

psi/ztrans.c


2017-08-22 13:32:02 +0100
Chris Liddell <chris.liddell@artifex.com>
e61805f2b5559647c0a9122cde508e278f331071

Bug 698391: check base_space pointer before de-referencing

in gs_pattern1_remap_color()

base/gxpcmap.c


2017-08-22 13:38:26 +0100
Ken Sharp <ken.sharp@artifex.com>
a8621022595d5af20f14e87f6ced620dbca43bad

pdfwrite - don't attempt to use the image-to-mask device unless its present

Bug #698390 "gswin32/64 crashes during PDF conversion"

This looks like a simple oversight, other places where we attempt to
use methods from the mask device we first check to see if we have a
mask device present, which we do not in this case. This commit simply
checks the presence of the mask device and doesn't attempt to use it
if we have not installed one.

No differences expected

devices/vector/gdevpdfd.c


2017-08-18 16:10:45 +0100
Chris Liddell <chris.liddell@artifex.com>
e0a921ea3457ae4fea740c4af532e9c103ee9366

Fix FAPI memory leaks.

Noticed while chasing down other memory issues.

Two issues, as it turns out:

Firstly, descendants of a composite font were not having the notify method set, so
we can free the FAPI related memory for the font.

Secondly, the Freetype incremental interface object created for each font was not
freed along with the font object.

base/fapi_ft.c
base/gxfapi.c


2017-08-21 17:05:09 +0100
Ken Sharp <ken.sharp@artifex.com>
7a9d86b5ed28862b671bfb65d3a4d0622ec745c1

XPS Interpreter - fix a formatting mistake

No impact, but it silences a compiler warning. Accidentally introduced
in commit 6162bbb7b804a0c70a35f218e59fa6c3118cd6a2

xps/xpszip.c


2017-08-21 09:46:42 +0100
Ken Sharp <ken.sharp@artifex.com>
6162bbb7b804a0c70a35f218e59fa6c3118cd6a2

Coverity IDs 158378, 158393

Add some limit checks to see if they silence Coverity. Also revisit the
check added in commit c5bf24912f589c881be44408e110ebdbb2fcd5b9 to
correct the limit check.

Coverity complains about reading values from a file format and then
using them without validating them. Its hard to see how to validate
values which can legitimately range over the whole space available. If
we add checks for that, then Coverity complains that the checks are
pointless (which is true of course).

In these cases, however, we are reading unsigned shorts into signed
integers, so we can add a (pointless, really) test to ensure that the
integer value lies in the range of a short. This should satisfy the
'tainted scalar' complaints and also should silence the overflow
warnings when using the values to allocate memory.

Normally I wouldn't do this as is costs performance, but we only execute
this code once when we open the file, so its negligible.

xps/xpszip.c


2017-08-19 14:53:28 +0100
Ken Sharp <ken.sharp@artifex.com>
c5bf24912f589c881be44408e110ebdbb2fcd5b9

Coverity IDs 158372 - 4, 158384

This is an attempt to work-around Coverity complaining about a 'tainted
scalar' or 'tainted argument'. This is caused by reading a 16-bit value
from the Zip central directory and then using it without checking the
bounds. Since the legal bounds are 0 - 2^16 its rather hard to see how
we can bounds check this....

If this doesn't silence the warnings tomorrow, or creates new ones
complaining that the bounds check is pointless (this has happened with
Coverity before) then I'll undo this commit and just tell Coverity
to ignore the warning.

xps/xpszip.c


2017-08-19 10:54:59 +0100
Ken Sharp <ken.sharp@artifex.com>
c57ea7b20d39f0e56432c9cc7bbb7f59fcc544e9

Coverity ID 158375

The function xps_set_nocache() is pointless, it doesn't do anything at
all, it merely retrieves a value from the PCL state stored in the
current instance. I suspect the value retrieved is garbage, since this
is XPS, not PCL, but since we never even use it, its irrelevant.

Whatever the original thinking behind this function was, its not doing
anything useful, so simply remove it.

xps/xpstop.c


2017-08-19 10:28:25 +0100
Ken Sharp <ken.sharp@artifex.com>
c552209d54f69152332795bd833fb3d655e79c48

Coverity ID 158394

I don't actually think the Coverity warning is possible, but I cannot be
absolutely certain, so its simpler just to explicitly set the contents
of these two arrays to a fixed 0 before we start. Its a low overhead if
we do it at the start of the routine.

devices/vector/gdevpsf2.c


2017-08-18 16:08:53 +0100
Ken Sharp <ken.sharp@artifex.com>
57bb7d00e180439440ab1be775fad94e13d340ff

PDF interpreter - Cover some cases of illegal /Parent entries

Bug #698372

The PDF file has a Page with an invlalid /Parent (it references the Page
object). Attempting to use that Page object fails when tracking Resources.

This commit alters the object storage introduced with the PDF unique
font identification so that *any* dictionary with a /Type gets its
object number stored inside it. We can then compare the object and the
Parent when tracking resources and refuse to follow a self-referencing
object.

No differences expected

Resource/Init/pdf_base.ps
Resource/Init/pdf_main.ps


2017-08-17 15:46:17 +0100
Chris Liddell <chris.liddell@artifex.com>
39648c6aafbe7ff790dd4dddf577def1fa7b1f07

Bug 698363: bounds check against length of loca table

In the FAPI code retrieving the glyph data, we weren't checking that the glyph
index was inside the loca table (i.e. that it was less than or equal to the
number of glyphs available in the font).

psi/zfapi.c


2017-08-16 15:12:14 +0100
Chris Liddell <chris.liddell@artifex.com>
2b138093cf78d9f72596a764d4225b5022ed9d9c

Bug 698356: Add reference counting for SMask ICC profiles

Previously, we didn't properly reference count the ICC profiles for
soft masks because we simply swapped in the ones for the mask, and swapped out
the ones "in force" at the time into temporary storage, then swapped them back
when the SMask was complete.

That works fine *if* the PDF is well formed, and thus the SMask completes. But
it causes havoc if the PDF is invalid and causes an error during the processing
of the SMask.

We'll now properly reference count the profiles.

base/gdevp14.c


2017-08-12 16:24:54 -0700
Ray Johnston <ray.johnston@artifex.com>
f6cabb1a7264e81a4b80a515717f7cc8938f1145

Add .gen_ordered operator to PS and htsc_gen_ordered to gs lib

If GS_LIB_BUILD is #defined, gen_ordered.c API can be called from GS to
allow for addittion of a PS operator to make a HalftoneType 3 (threshold
array based halftone) controlled by parameters from a dictionary.

The result is can be used by sethalftone or as a HalftoneType 5 halftone.

Also some warnings cleaned up and add checks for ALLOC fail.

Add a gen_ordered parameter to control verbosity of printing The default
is 0, which is error messages only. Error messages are generated to
stderr (using the EPRINTF* macro).

Add documentation of these two new operators in doc/Lagnuage.htm

Add an example toolbin/halftone/gen_ordered/gen_ordered_example.ps
of usage of ,genordered and some related rendering options.

Other parsers (PCL or XPS) may call htsc_set_default_params and
htsc_gen_ordered as well to make ordered dither halftone generation
more flexible, but the integration into non-PS parsers is left for
later.

Makefile.in
base/lib.mak
base/msvclib.mak
base/openvms.mak
base/ugcclib.mak
base/unix-gcc.mak
base/unixansi.mak
doc/Language.htm
psi/int.mak
psi/msvc.mak
psi/os2.mak
psi/zht2.c
toolbin/halftone/gen_ordered/gen_ordered.c
toolbin/halftone/gen_ordered/gen_ordered.h
toolbin/halftone/gen_ordered/gen_ordered_example.ps


2017-08-11 10:43:52 -0700
Ray Johnston <ray.johnston@artifex.com>
e64f5a2eaeb5c667bfc6bf584f4d7655c8b6b959

Refactor gen_ordered to allow for use by an application (ghostscript).

Also Refactor htsc_save_tos to extract htsc_mask_to_tos to convert
final_mask.data to turn_on_sequence.

If GS_LIB_BUILD is #defined, the "main" and functions that write files
will not be included, and all but a few of the functions will be made
static. Exported functions are:
htsc_set_default_params
htsc_gen_ordered

Also ALLOC and FREE are used to allow the use of a memory allocator
(such as ghostscript's) and PRINTF and EPRINTF macros are used to
allow for redirection of messages.

toolbin/halftone/gen_ordered/gen_ordered.c
toolbin/halftone/gen_ordered/gen_ordered.h
toolbin/halftone/gen_ordered/gen_ordered.vcproj


2017-08-15 16:56:58 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
376e4a546024d9d5f22d1f0a76294d5605ad82be

Bug 694680: Prevent SEGV due to uninitialised structure.

Changing compression within an image is unimplemented but for
now we return an error.

However, changing to eNoCompression is allowed since no
uninitialised structures are encountered.

pcl/pxl/pximage.c


2017-08-15 09:20:34 +0100
Ken Sharp <ken.sharp@artifex.com>
5628bd182819bafe965cbf86649e678a6701f818

pdfwrite - remove obselete code

Originally included as part of the colour management rework, this was
never actually needed, so remove it.

devices/vector/gdevpsds.c
devices/vector/gdevpsds.h


2017-08-15 09:19:27 +0100
Ken Sharp <ken.sharp@artifex.com>
55e3ee85c171a0d7e563535c77d69a8773f17265

Fix some spurious code in the CUPS device, flagged by the compiler

Somehow a few lines of code were duplicated, fortunately this was
benign, but lets remove the nonsense lines anwyay.

cups/gdevcups.c


2017-08-11 08:30:24 -0700
Michael Vrhel <michael.vrhel@artifex.com>
ffa47bc975171d8839af1cf8fb9677c173cff0e6

Bug 696386 Fuzzing

Take slow path if we have a 16bit indexed image

base/gxi12bit.c


2017-08-10 17:39:05 -0700
Michael Vrhel <michael.vrhel@artifex.com>
fb37a099ccc86c2af63794167ccc1799c6fc06a0

Clean up warning in gen_ordered.c

The comment about what the levels of quantization
were when no size was given for the macro cell was
not correct

toolbin/halftone/gen_ordered/gen_ordered.c


2017-08-10 17:17:39 -0700
Michael Vrhel <michael.vrhel@artifex.com>
723d2a565e726cc6f29f4d32f202c29a995b4e37

Bug 698344 gen_ordered.c

Fix case for -r600 -l144 -a45 -q64 -s8
A problem where we only need to take
one dot location for our first quantization level (there were
not multiple dots set to get that level)

toolbin/halftone/gen_ordered/gen_ordered.c


2017-08-10 13:15:15 -0700
Michael Vrhel <michael.vrhel@artifex.com>
f08687ffb24f641f7ed788ccf152752cd502df88

Fix ambiguity in creation of turn on sequence

When dot profile values are the same due to tiling,
force decision as to which one to turn on next based
upon distance to center of dot mask.

toolbin/halftone/gen_ordered/gen_ordered.c


2017-08-09 14:58:02 -0700
Michael Vrhel <michael.vrhel@artifex.com>
a664e0d6601c80388cd8af765400ce071ee8f967

Fix minor offset issue in gen_ordered.c

toolbin/halftone/gen_ordered/gen_ordered.c


2017-08-07 17:12:54 +0100
Ken Sharp <ken.sharp@artifex.com>
913acc7c63921770e755a39fca3f768dda49be5d

PDF interpreter - PDF 2.0 - basic support for UTF-8 strings

I'm sure this will require more work in future, but for now this is at
least as good as our support for UTF-16 strings.

Resource/Init/pdf_draw.ps
Resource/Init/pdf_ops.ps


2017-08-07 13:44:06 +0100
Ken Sharp <ken.sharp@artifex.com>
2efe17a30ff9a72f0698add0bd8708f3ef1d3b99

PDF interpreter - fix typos

two typos in error messages, 'endjobj' should be 'endobj'

Resource/Init/pdf_base.ps


2017-08-07 13:37:59 +0100
Ken Sharp <ken.sharp@artifex.com>
9a5e5e3c396fb18bcd21158c4f44596eed69e5d0

PDF interpreter - PDF 2.0 support - per page OutputIntents

The only way previously to handle *any* OutputIntents array was to
specify UsePDFX3Profile and give the array index of the required
profile.

This is too inflexible as each page can have a different array, so the
indices may be different on each page. Add a new switch -dUseOutputIntent
which takes a string argument.

If we have set -dUseOutputIntent, then check teh document level and each
page for an array of OutputIntents. If found, check each OutputIntent
dictionary for a OutputConditionIdentifier and compare it with the
specified string. If the OutputConditionidentifier is 'Custom' then use
the value of the Info key instead.

Resource/Init/pdf_main.ps
doc/Use.htm


2017-08-07 10:07:06 +0100
Ken Sharp <ken.sharp@artifex.com>
04fd73cadbf91e7a9cf0dee0129384ce23aa3000

PDF interpreter - PDF 2.0 support add UseBlackPtComp

Michael already implemented the use of black point compensation, and
we have a PostScript operator to turn it on and off already (GS
defaults to on).

This just hooks up the PDF 2.0 graphics state entry to the existing
framework. Note that the PDF entry is a boolean whereas our existing
PostScript operator takes 0 or 1, so there's a little fiddling to get
that right.

Resource/Init/gs_init.ps
Resource/Init/pdf_draw.ps
Resource/Init/pdf_ops.ps
psi/zcolor3.c


2017-08-07 10:04:27 +0100
Ken Sharp <ken.sharp@artifex.com>
dcc9ea12638e99917b28b49c120a52c8e309d9fa

PDF interpreter - support for PDF 2.0 add HTO

I doubt we will ever see a Halftone Origin for real. According to the
specification its like a halftone phase but with a different co-ordinate
system.

For now simply treat its as a halftone phase, if anyone ever complains
we can address it, because they will be able to supply an example to
work from.

Resource/Init/pdf_draw.ps


2017-08-06 12:24:21 -0700
Ray Johnston <ray.johnston@artifex.com>
478a0a862d2593199bcae599e46bdc97b525bb12

Bug 698334: LeadingEdge parameter problems.

Because -dLeadingEdge=# sets the value in systemdict, we need to return
this parameter from gx_default_get_param and gx_default_get_params so that
the systemdict value will get sent to the device (putdeviceprops).

Also found that the JPEG device was using LeadingEdge, but not stripping
off the "LEADINGEDGE_SET" bit. Fix by anding with LEADINGEDGE_MASK.

Lastly, the cups device put_params needs to be able to accept a null
parameter type as the default put_params can.

base/gsdparam.c
cups/gdevcups.c
devices/gdevjpeg.c


2017-08-06 02:23:55 +0800
Sebastian Rasmussen <sebras@gmail.com>
d91d4273f38fb8a527ff342d360cee8aaf468896

Allow for symbol dictionary with 0 symbols.

jbig2dec/jbig2_symbol_dict.c


2017-05-14 17:50:32 +0800
Sebastian Rasmussen <sebras@gmail.com>
b5a27404ff64c427d8bcdbd16742ab15a4f6cda5

Plug leak of parameter info in command-line tool.

jbig2dec/jbig2dec.c


2017-05-14 17:44:45 +0800
Sebastian Rasmussen <sebras@gmail.com>
1d939952cc3262c8e7b31247046f4e7d9c2d7394

Do not grow page if page height is known.

Previously an encountered region segment could cause the page
height to be increased if the segment height/position occurred
outside of the page boundaries. This happened regardless of
whether the page height was previously known or unknown.

jbig2dec/jbig2_page.c


2017-08-05 11:23:25 +0100
Ken Sharp <ken.sharp@artifex.com>
22dca483140d23a73ab7db835e7d923a91745b6f

pdfwrite - begin support for PDF 2.0

Permit CompatibilityLevel to be 2.0 for production of PDF 2.0. We may
eventually make this the default.

Don't write ProcSet resources when creating PDF 2.0
Don't write a Producer etc in the Info dict when creating PDF 2.0
Don't write DOCINFO pdfmarks in the Info dict when creating PDF 2.0
Don't write CharSet key in font dictionaries when creating PDF 2.0
Write FontDescriptor, Widths, FirstChar and LastChar for base 14 fonts
when creating PDF 2.0

Don't write Transfer functions in graphics states when creating PDF 2.0.
We need to add the ability to 'apply' transfer functions for proper
support here.

Need to add support for BlackPointCompensation and (possibly) per-page
OutputIntents when the PDF itnerpreter has been upgraded to support
these.

devices/vector/gdevpdf.c
devices/vector/gdevpdfb.c
devices/vector/gdevpdfg.c
devices/vector/gdevpdfi.c
devices/vector/gdevpdfm.c
devices/vector/gdevpdfp.c
devices/vector/gdevpdft.c
devices/vector/gdevpdfv.c
devices/vector/gdevpdtd.c
devices/vector/gdevpdtt.c


2017-08-01 15:57:17 +0100
Chris Liddell <chris.liddell@artifex.com>
dcda07a31c90ff1ece5a92961eb83b58ffc44be4

Bug 697232: URW++ font update from 2017/07/27

Adds blue zones for the top features of numbers in:
NimbusSans-Italic
NimbusSans-Regular

Resource/Font/NimbusSans-Italic
Resource/Font/NimbusSans-Regular


2017-08-04 09:22:36 +0100
Ken Sharp <ken.sharp@artifex.com>
cd1c10382c868b8bd8dba9b52ea7fca970f95eaa

pdfwrite - initialise some new downscale parameters

Bug #698329 "Floating point exception in s_IScale_init()"

Commit a936cf76a33389610b558ffaf5de7389265fd657 to fix Bug #693684
"Add InterpolateControl parameter to limit image interpolation." added
a new parameter 'abs_interp_limit' but omittted to initialise the
variable in pdfwrite's use of the filter.

This led to an unuinitialised variable, which could eventually cause a
divide by zero fault.

It seems this parameter is only used when scaling up, so this commit
simply sets it to the minimum value of 1. At the same time initialise
a couple of other parameters too, these are probably unused and in any
event should be initialised by the filter code, but its best to be safe.

devices/vector/gdevpsdi.c


2017-08-02 13:41:59 +0100
Ken Sharp <ken.sharp@artifex.com>
ca1ec9b486ddba3f921355fd1d775f27f4871356

PDF interpreter - remove the PDFDontUseObjectNum switch

This was implemented to allow us to restore the default behaviour if
it caused problems. No real problems reported, so lets get rid of
(yet another) of our many, many command line switches.

Resource/Init/pdf_font.ps


2017-07-29 18:18:58 +0100
Robin Watts <robin.watts@artifex.com>
cdd2b1bcafdc9108f843183a22360ffbc65525a1

Bug 698034: Fix various problems with MFS downscaling to cmyk.

Firstly, the mfs buffer was not large enough.

Secondly, the downscaling logic in down_core4_mfs was broken - fixed
by copying it from down_core4.

Thirdly, the sense of the mfs was inverted (we had forced the white
spots to be zero).

All in all, my finest work. :(

Fixed here.

base/gxdownscale.c


2017-07-27 13:22:50 -0700
Ray Johnston <ray.johnston@artifex.com>
8321323b7c31828d79c0aa1b5c0312f156a53192

Fix Bug 695333: PDF 1.4 transparency did not support Spot Color clist devices

Not just the tiffsep device named in the bug, but the psdcmyk device would
also fail if the clist was used. This file needs to be in the regression suite.

Fix by adding a pdf14_clist_copy_planes proc that forwards to the underlying
clist device. NB: The pdf14 rendering device already had a copy_planes device
which is used in page mode or during clist playback.

base/gdevp14.c


2017-07-28 15:58:38 +0100
Ken Sharp <ken.sharp@artifex.com>
8b721623f5fee0150822f7ead66ca5820d74e568

Fix a couple of documentation typos

doc/Use.htm


2017-07-28 13:37:17 +0100
Ken Sharp <ken.sharp@artifex.com>
7454690eb64cb71c13e957fc47e9881463d01ba4

Coverity ID 158374 - cater for anerror return

This probably isn't possible, we're getting a repeat form so the original
form must be already stored, but its worth the error check.

devices/vector/gdevpdfi.c


2017-07-28 12:06:01 +0100
Ken Sharp <ken.sharp@artifex.com>
afa8fb82aea663e3da2d7e0e297ca9bc401a1912

Coverity ID 158379 identical branches

Coverity is obviously correct that the two branches are identical. I'm
no longer certain of how this works, but I did test it quite extensively
at the time so I'm going to assume that the code is correct and simply
remove the branch logic which seems to be pointless.

base/gxshade1.c


2017-07-28 11:37:14 +0100
Ken Sharp <ken.sharp@artifex.com>
f26ebc119717475bef5b6fd6068af5f0ab779dc9

Coverity ID 158388 - don't dereference a pointer before checking it is non-NULL

base/gdevdflt.c


2017-07-28 11:08:18 +0100
Ken Sharp <ken.sharp@artifex.com>
0947a042bab551b60f9004366bc06b098b8bdbf3

Coverity ID 158394 - uninitial;ised scalar variable subrs_count[j]

Unlike other instances of this, I can't be certain that its impossible
to read the data when its not been initialised, and in other places
we zero the memory when we change the current hint size, which suggets
that its at least potentially possible, so here we zero the array of
bits (flags).

No differences expected

devices/vector/gdevpsfx.c


2017-07-27 16:33:08 +0100
Ken Sharp <ken.sharp@artifex.com>
e5d24b703e5413732f2ef58d8fcd5b4803865d7c

pdfwrite - don't handle some kinds of x/yshow with TJ

Bug 698218 "Font matrix woes, also with PDF Reader/Writer"

In fact this is not a problem with the FontMatrix. The problem is
actually to do with the way the PDF interpreter executes certain kinds
of operation, basically Fonts where the /Widths array entries don't
match the actual glyph widths.

In this case we use an x/yshow operation with the modified width, and
this works perfectly well for rendering. However, for pdfwrite, we can
try to use the TJ operator, which works in a slightly different way...

xshow takes a displacement which is measured from the origin of the first
glyph to the origin of the following glyph, TJ by contrast adds a
displacement after the first glyph is rendered. Normally we essentially
subtract the width from the displacement to find the TJ value. However,
if the Widths array overrides the glyph width, and the actual glyph
width is significantly different (eg 0), then what happens is that
we apply the modified width after rendering the first glyph, and then
apply the TJ displacement. In effect applying it twice.

Detecting this condition turned out to be essentially impossible, there
are too many cases in PostScript files where similar trickery is pulled
to reliably determine that this occurs. It is, however, rare, especially
in PDF files, because very few fonts are neither horizontal nor vertical
in their FontMatrix (shearing is not uncommon but that's different)

So this commit adds a new boolean which we set false only when we have
a x/yshow operation, and the width and real width do not match (which
happens when we have a /Widths mismatch). This prevents the TJ being
applied and uses direct text positioning commands instead, which works.

devices/vector/gdevpdte.c
devices/vector/gdevpdts.c
devices/vector/gdevpdts.h


2017-07-25 13:55:19 -0600
Henry Stiles <henry.stiles@artifex.com>
44ccac6fb19ec0e3f42b2b51ec4b2b6a4438af71

Add an upper bound for pattern and bitmap source heights.

pcl/pxl/pxptable.c


2017-07-21 13:03:54 -0600
Henry Stiles <henry.stiles@artifex.com>
92e2f00d88d664e5249792458c276b6be89b37fa

Remove unnecessary padding.

pcl/pxl/pximage.c


2017-07-21 10:59:35 -0600
Henry Stiles <henry.stiles@artifex.com>
bcae781b1f4ef69a67c287f187cf871cd5db60f0

Fix 694654 - fuzzing seg fault.

The clip path accumulator device (gxacpath.c) does not support raster
operations so don't install the device if the raster operation is not
default.

To support raster ops the device would need to add procs for get_bits,
get_bits_rectangle, strip_copy_rop, and copy_color (used by get_bits
potentially), then it would need to render the accumulated path using
the current raster operation (it uses "lop_default" now). The
optimization is not useful in real world PCL files so we choose to
bypass it.

base/gsimage.c
base/gximask.c
base/gximask.h


2017-07-18 13:50:33 -0600
Henry Stiles <henry.stiles@artifex.com>
dbb4ea0147655b70ee51c18f9963566057b05dc6

Fix 694643 fuzzing segfault.

It was possible to write past the end of the gs_debug array.

pcl/pcl/pgconfig.c


2017-07-21 09:38:13 -0700
Ray Johnston <ray.johnston@artifex.com>
be281458bc48aa20acd7d276fb1e1713f1966750

Fix bug 694654: Stale cdev->clip_path with image

base/gxclimag.c


2017-07-20 13:23:14 -0700
Ray Johnston <ray.johnston@artifex.com>
0d751be73cfa40e45bee50560873bf01884b9d92

Add ROUNDSPOT function and fix limit on lpi search.

ROUNDSPOT added as growing white circle transitioning to shrinking black
circle.

Also there was an arbitrary limit of lpi <= res/10.0 (y<11) that I changed
to allow things like -l30 -r600 to give more than 100 levels.

toolbin/halftone/gen_ordered/gen_ordered.c


2017-07-25 12:58:02 +0100
Ken Sharp <ken.sharp@artifex.com>
f816b092c1f69c0fed977aa8804dadd04f0296a5

PDF interpreter - cope with corrupted Pattern

Bug #696410 "Seg faults found by fuzzing in pattern_paint_finish (zpcolor.c:321)"

The file no longer seg faults, but it did enter an endless loop, caused
by the pattern code consuming the saved dictionary for the 'q' (gsave)
operation, but leaving another different dictionary on the dictionary
stack.

The code here 'ends' teh current dictionary if it has neither a /n or
/self key, otherwise it calls 'Q' which will end it anyway. This
prevents the loop being endless because countdictstack is greater
than the saved dict count, but the current dictionary isn't the
result of a gsave.

No differences expected

Resource/Init/pdf_draw.ps


2017-07-25 11:30:20 +0100
Chris Liddell <chris.liddell@artifex.com>
f0b4fc4f870ada5264c74c17094c982a66bcb42c

Bug 698287: fix out of bounds access in c_pdf14trans_write

In pdf14_clist_create_compositor() we create a temporary compositor command to
change the compositor procs and avoid creating subsequent compositors (rather
than enable/disable/reconfigure the already existing compositor).

The problem arises because we create and only copy the data defined by
the generic gs_composite_t type, rather than the pdf14 compositor specific
type (gs_pdf14trans_t).

Change so we use, and copy, the full pdf14 compositor command type.

base/gdevp14.c


2017-07-25 11:02:07 +0100
Chris Liddell <chris.liddell@artifex.com>
f98e88cabfa7161ec098e0aaf9d94df52923a212

Move the PCL/PXL/XPS example files into pcl/examples

instead of pcl/tools

pcl/examples/bitfont.pcl
pcl/examples/bitfonts.pxl
pcl/examples/fills.pcl
pcl/examples/fontpage.pcl
pcl/examples/fonts.pcl
pcl/examples/fonts.pxl
pcl/examples/frs96.pxl
pcl/examples/gl-chars.pcl
pcl/examples/grashopp.pcl
pcl/examples/grid.pcl
pcl/examples/label.tst
pcl/examples/lineprinter.pcl
pcl/examples/null.pxl
pcl/examples/opaque.pcl
pcl/examples/origins.pcl
pcl/examples/owl.pcl
pcl/examples/owl2.pcl
pcl/examples/pattern.pcl
pcl/examples/pattern.pxl
pcl/examples/tiger.px3
pcl/examples/tiger.xps
pcl/examples/vasarely.px3


2017-07-21 15:03:16 +0100
Chris Liddell <chris.liddell@artifex.com>
910927d86239c80cc5bc365445c1df7a6e5fa8da

Bug 696387: iccprofile ref counting in gdevp14 compositor

The transparency compositor does extensive swapping and creating of ICC
profiles but was less than well disciplined with the reference counting. This
moves *most* of the profile swapping to a consistent use of the reference
counting.

The one remaining exception is the handling of colors for soft masks, which are
still handled "specially".

base/gdevp14.c


2017-07-13 13:57:30 +0100
Chris Liddell <chris.liddell@artifex.com>
f060b1bffacca60b45b9be1b94a8944ca2608930

Bug 698188: (clist) prevent reading off the end of a bitmap buffer

In clist_copy_mono, when the bitmap is clipped (in the x-direction) we apply
gross clipping to the bitmap data - the "clip" the left edge of the bitmap
to the nearest byte.

The problem is that we then calculate the aligned bitmap raster from that
byte offset. Thus, in the uncompressed case, if we copy the aligned raster
bytes for each scanline, we *can* end up reading off the end of the buffer.

Instead, use width/8 bytes as the amount to copy for each scanline. Then, if
necessary, zero the padding bytes.

base/gxclbits.c


2017-07-06 14:54:02 +0100
Chris Liddell <chris.liddell@artifex.com>
671fd59eb657743aa86fbc1895cb15872a317caa

Bug 698158: prevent trying to reloc a freed object

In the token reader, we pass the scanner state structure around as a
t_struct ref on the Postscript operand stack.

But we explicitly free the scanner state when we're done, which leaves a
dangling reference on the operand stack and, unless that reference gets
overwritten before the next garbager run, we can end up with the garbager
trying to deal with an already freed object - that can cause a crash, or
memory corruption.

psi/ztoken.c


2017-07-13 13:36:19 +0100
Chris Liddell <chris.liddell@artifex.com>
18a2365b69cc43ed4dbe2bfd44f739622623821c

Update fonts to latest URW++ release (2017/05/01)

Plus 2017/07/20 update

Fixes bugs 696582, 697232 and 697058

Resource/Font/C059-BdIta
Resource/Font/C059-Bold
Resource/Font/C059-Italic
Resource/Font/C059-Roman
Resource/Font/NimbusMonoPS-Bold
Resource/Font/NimbusMonoPS-BoldItalic
Resource/Font/NimbusMonoPS-Italic
Resource/Font/NimbusMonoPS-Regular
Resource/Font/NimbusRoman-Bold
Resource/Font/NimbusRoman-BoldItalic
Resource/Font/NimbusRoman-Italic
Resource/Font/NimbusRoman-Regular
Resource/Font/NimbusSans-Bold
Resource/Font/NimbusSans-BoldItalic
Resource/Font/NimbusSans-BoldOblique
Resource/Font/NimbusSans-Italic
Resource/Font/NimbusSans-Oblique
Resource/Font/NimbusSans-Regular
Resource/Font/NimbusSansNarrow-BdOblique
Resource/Font/NimbusSansNarrow-Bold
Resource/Font/NimbusSansNarrow-Oblique
Resource/Font/NimbusSansNarrow-Regular
Resource/Font/P052-Bold
Resource/Font/P052-BoldItalic
Resource/Font/P052-Italic
Resource/Font/P052-Roman
Resource/Font/URWBookman-Demi
Resource/Font/URWBookman-DemiItalic
Resource/Font/URWBookman-Light
Resource/Font/URWBookman-LightItalic
Resource/Font/URWGothic-Book
Resource/Font/URWGothic-BookOblique
Resource/Font/URWGothic-Demi
Resource/Font/URWGothic-DemiOblique
Resource/Font/Z003-MediumItalic
Resource/Init/Fontmap.GS
psi/psromfs.mak


2017-07-24 15:54:41 +0100
Ken Sharp <ken.sharp@artifex.com>
bfed2aa2b1d854d4b63bc75957438e38fca361fc

PDF interpreter - permit Widths arrays to contain indirect objects (!)

Bug 698275 "GPL Ghostscript 9.21: Failed to interpret TT Instructions"

The actual problem is that the PDF file contains a Widths array where
one or more of the entries is an indirect object. Since this has no
useful purpose beyond making the PDF file larger I can't think why this
has been done.

Nevertheless, as usual 'Acrobat accepts it' so now we do too.

The complain about the TT instructions is because in addition the file
contains two TrueType fonts which are broken.

Resource/Init/pdf_font.ps


2017-07-19 22:05:33 -0700
Ray Johnston <ray.johnston@artifex.com>
983e56cb679768fe5a048fbb33a43259efb9afbf

Fix Bug 696398: Segfault with fuzzing file.

Oveflow of integer caused later failure even if allocation of the
ht_buffer succeeded. Detect overflow, return error.

base/gxht_thresh.c


2017-07-19 12:13:30 -0700
Ray Johnston <ray.johnston@artifex.com>
877cbdf0b279bb4bf5f3b74182ab6d0101095f99

Fix bug 696402: Segfault with fuzzed data caused by dda overflow.

The ty of the matrix in the fuzzed data was a very large value that
resulted in the Y for an image being near the limit for the dda,
so the first step (dda_next) overflowed from positive to negative
resulting is a large destination height calculation (vdi). Prevent
this by not stepping if it would cause an overflow. This will be
outside the clip limits, so will not affect the output.

base/gxidata.c


2017-07-20 13:36:46 +0100
Ken Sharp <ken.sharp@artifex.com>
91fd78617440c18288b6d4cd226fa3f77db91705

Update the nulldevice for DeviceN

Bug #696383 "Seg faults found by fuzzing in get_num_pdf14_spot_colors (gstrans.c:720)"

The problem here is really an example of our poorly maintained device
API. As stated previously the comments in the code seem to indicate
that all devices should either implement their own versions of all
the device methods, or use the graphics library default method. No
device method should be NULL, so it should never be necessary to check
this.

Sadly, many of our devices have NULL entries for some methods, and in
this case the nulldevice did not implement a method for
'ret_devn_params'. Presumably this was missed when the mthod was added.

In this commit, just up date the device to use the default method.

base/gdevnfwd.c


2017-07-18 16:36:15 +0100
Ken Sharp <ken.sharp@artifex.com>
64cb7a492292eb40a01de760be832b7d5425d8e9

PDF interpreter - detect and ignore recursive Form XObjects

Bug #698226 "Error: /rangecheck in --run--"

The PDF file supplied in the bug is broken, it has a Form XObject:

285 0 obj
<<
/BBox [ 294.572 797.586 306.188 793.466 ]
/Group 287 0 R
/Matrix [ 1 0 0 1 0 0 ]
/Resources <<
/ExtGState <<
/GS0 32 0 R
>>
/XObject <<
/Fm0 285 0 R
>>
>>
/Subtype /Form
/Length 58
>>
stream
q
0 Tc 0 Tw 0 Ts 100 Tz 0 Tr []0 d
/GS0 gs
0 TL/Fm0 Do
Q
endstream
endobj

The file throws an error in Acrobat, Ghostscript recurses the Form until
it hits an execstackoverflow, and is then unable to proceed. Testing
Acrobat we see that it can detect recursion even when its not a simple
self-reference, a child referencing a parent is also detected and
ignored.

In the PDF interpreter we normally push a dictionary on the operand
stack and record objects as we encounter them, checking each new one
against all the ones executed so far, and exit if we find reuse. This
approach doesn't quite work for Form XObjects, because we cannot be
certain of the operand stack shape when a Form is executed, and so we
cannot locate our dictionary.

Instead we now store the dictionary in the top level 'pdfdict' which is
always available. The technique is otherwise the same.

I'm not totally happy with this, but its the best compromise between
performance hit, memory use and code frailty I could come up with.

No differences expected.

Resource/Init/pdf_draw.ps
Resource/Init/pdf_main.ps


2017-07-13 16:02:16 -0600
Henry Stiles <henry.stiles@artifex.com>
cea2da4aae1edbf6aef128f44962cfe8baa5c728

Fixes Bug 697900 - No support for disk resident fonts.

Support added for using PCL font resources from the PJL file system.
Macros have always been supported and using a font wrapped in a macro
as a workaround works, but this isn't quite correct or convenient.
Also refactoring and better error handling for alphanumeric key support.

pcl/pcl/pcsfont.c


2017-07-12 08:53:21 -0600
Henry Stiles <henry.stiles@artifex.com>
8d195215c057f4df0c609828b5da65c7f3462588

Fix bug #697650 - RemoveFont opearator error handling.

The RemoveFont operator produced an error and stopped processing when
the font was not found, now we produce a warning and continue like HP.
Other areas of the code needed tidying up as well. The
px_widen_font() function did not NULL the font output parameter
according to its spec and RemoveFont did not check there wasn't an
error before attempting to remove the font from the font dictionary

pcl/pxl/pxffont.c
pcl/pxl/pxfont.c


2017-07-17 09:19:14 +0100
Ken Sharp <ken.sharp@artifex.com>
798bc40317ba4b552560f4ceede1607c561ef54c

pdfwrite - remove the 'deferred free' code

Now that the memory cleanup is completed, we can remove the 'hack'
that defers really freeing freed memory in the memory manager.

devices/vector/gdevpdf.c


2017-07-13 13:43:45 +0100
Ken Sharp <ken.sharp@artifex.com>
091b860bcde7fc610cff89b7711c59597dc06674

pdfwrite - memory management cleanup

Bug #696608 "Use after free error in PDF write"

As per the instructions in the original bug report, filling free memory
with 0x00 causes seg faults because of 'use after free' conditions in
the pdfwrite resource management.

There were a number of problems solved in order:

1) Move freeing of colour spaces until after shadings are freed, because
shadings can refer to colour spaces.

2) Colour space and function resources can reference other resources of
the same type. clear such references before freeing the resources.

3) 'Other' resources can potentially reference other resource types
(seen with Colorant dictionaries referencing colour spaces). We need to
clear these references before freeing the resource types. Also, move the
freeing of 'other' resources until nearer the end.

4) The 'Metadata' resource was previously added to the Catalog
dictionary after the 'Other' resources were freed, so the fact that it
was double referenced (once from resourceOther, once from 'global named
object' wasn't a problem. Now that we free 'other' resources later,
this could lead to double freeing. Explicitly remove the Metadata
reference from the 'other' resource chains to prevent this.

Running this on the cluster fixes all the pdfwrite problems, it does
however leave one file which still causes problems, just not with pdfwrite.

Bug688308.ps seg faults on the cluster with differing configurations,
it isn't stable, so I suspect garbage collection may be involved. Its a
rather complicated page from a yellow pages directory, and involves
numerous EPS files from varied sources. Unfortunately I can't reproduce
a problem locally.

However, its not a pdfwrite problem.

devices/vector/gdevpdf.c
devices/vector/gdevpdfe.c
devices/vector/gdevpdfo.h
devices/vector/gdevpdfu.c
devices/vector/gdevpdfx.h


2017-07-10 15:06:36 -0600
Henry Stiles <henry.stiles@artifex.com>
7276327a2f78290a7d526df493d92325947a834d

Bug 698147 - PXL "passthrough" initialization problem.

Don't let PCL clear the current page if XL has marked the page.
Thanks to Norbert Janssen for the patch.

pcl/pxl/pxpthr.c


2017-07-10 11:09:57 -0600
Henry Stiles <henry.stiles@artifex.com>
ec906d206f6ed044b6b7e1b1cc7551150b8db6d4

Bug 698125 - JPEG RGB not grayscaled.

Using the XL JPEG compression scheme it is possible to have a mismatch
between color space in the graphics state and image. This cannot
happen in any other PXL raster format except JPEG and we expect it
will rarely happen in the normal workflows. We detect the the
mismatch and convert the rgb triples to gray triples in advance of
rendering the scanline.

pcl/pxl/pximage.c


2017-06-28 17:14:14 -0600
Henry Stiles <henry.stiles@artifex.com>
df8ac78c06cc6093409142aaee839cd4bf953588

Renaming and refactoring, no functional differences.

In particular, we get rid of the "universe" structure and move its
members into the main instance.

pcl/pl/plapi.c
pcl/pl/plmain.c
pcl/pl/plmain.h


2017-07-06 13:57:41 -0700
Ray Johnston <ray.johnston@artifex.com>
21e28148792158aba5cf2b93fad755455d0cc8ba

Fix viewpbm.ps FITPAGE SCALE option

lib/viewpbm.ps


2017-07-05 08:45:10 -0700
Ray Johnston <ray.johnston@artifex.com>
12cb9d16d69cd3430b86d0bdfea7f73fcbeeceb3

Fix regression from InterpolateControl change that affects pattern-clist

Seen with comparefiles/Bug689851.pdf as missing interpolation.

The clist_make_accum_device did not copy the interpolate_control value
from the target. Also copy the params for non-clist pattern accum
devices and forwarding devices along with graphics_type_tag.

base/gdevnfwd.c
base/gxclist.c
base/gxpcmap.c


2017-07-05 10:59:18 +0100
Robin Watts <robin.watts@artifex.com>
6b24e08b26bbd99082e36785fe742108ab705c23

Bug 698135: Import security fix for OpenJPEG

https://pdfium.googlesource.com/pdfium/+/463b77b4f1e4257cd89f3460b5a6fdb102f44265%5E%21/#F0

Patch doesn't apply cleanly, but requires some manual conflict
resolution.

openjpeg/src/lib/openjp2/dwt.c


2017-07-05 14:31:31 +0100
Ken Sharp <ken.sharp@artifex.com>
095a0c9e9c16b5c131709d2d831f97a77084f1bd

pdfwrite - prevent substitution of an SMask for an identical parent image

Bug #698128 "PDF created by gs generates "recursive /SMask" messages when run with gs"

When we have the (highly unusual) case where an image dictionary has an
SMask entry, and the SMask is an image which is identical to the parent
in every respect (dictionary contents, stream data) except for the
SMask key, it was possible for pdfwrite to decide to use the SMask
instead of the image.

This leads to a PDF which has an image which references an SMask in the
image dictionary, and the SMask is the same image XObject.

In this commit, when checking for an identical image, if the image we
find is the same as the 'current' softmask image, then do not treat it
as identical. This prevents us inadvertently detecting an image and its
SMask as being the same image.

devices/vector/gdevpdfj.c


2013-06-05 10:07:47 -0700
Ray Johnston <ray.johnston@artifex.com>
a936cf76a33389610b558ffaf5de7389265fd657

Bug 693684: Add InterpolateControl parameter to limit image interpolation.

Previously, we always interpolated to the full device resolution. This
parameter allows control of the resolution of the interploated image
which makes sense for devices that cannot render continuous tone at
the device resolution due to halftone cell size. This avoids the
overhead of interpolation beyond what the device can reproduce and
allows the user a quality/performance tradeoff.

The -dDOINTERPOLATE is equivalent to -dInterpolateControl=-1 and the
-dNOINTERPOLATE is equivalent to -dInterpolateControl=0. These options
still work for PS/PDF files, but are deprecated and may be removed in
the future.

Performance results vary, but using the -dInterpolateControl=4 is
4.5 times faster with files that have images that are scaled up and cover
a large portion of the page such as comparefiles/Bug695221.ps at 600dpi.

Resource/Init/gs_img.ps
Resource/Init/gs_init.ps
base/gsdparam.c
base/gxdevcli.h
base/gxdevice.h
base/gxht.c
base/gxiscale.c
base/lib.mak
base/siscale.c
base/sisparam.h
devices/devs.mak
devices/gdevbit.c
devices/vector/gdevpsdi.c
doc/Use.htm


2017-06-27 15:56:01 -0700
Ray Johnston <ray.johnston@artifex.com>
e56286167cad5a5fba3e0b8911d9a54b6a5a5400

Speed up image interpolation with UseFastColor

The check for dev_profile->usefastcolor was buried way down in the ICC
remap logic after getting a link, etc. then eventually returning the
is_identity that would skip transforming the color. Also check in the
image_class0_interpolate function to disable use_icc so that it uses
the faster image_render_interpolate rather than the interpolate_icc
versions.

base/gxiscale.c


2017-06-29 15:13:03 -0600
Henry Stiles <henry.stiles@artifex.com>
9ed740e848891de10af6f85bd234298ac2bbab7b

Fix fuzzing Bug 694668 - CCITT fuzzing.

Bounds check CCITT Columns.

pcl/pcl/pcl.mak
pcl/pcl/rtraster.c


2017-07-04 12:11:33 +0100
Ken Sharp <ken.sharp@artifex.com>
676ad40aed33815aea7bf65cb9f374b79b1d8518

pdfwrite - fix /Colorants when converting DeviceN colour spaces

Bug 698129 "Produced PDF that gives "Wrong operand type" in Acrobat for some pages"

The supplied example uses a Duotone witha CMYK alternate and a Colorants
array (for the Pantone colour only). When converting to a different
space we preserve the Spot colours (and therefore DeviceN) but we
convert the alternate space to the specified base space by sampling the
original space.

However, if the DeviceN space contained a Colorants array we were writing
the new colour space array with the Colorants inserted in the wrong
position, immediately after the ink array instead of at the end.

This commit moves the Colorants entry to the correct place, and also
adds the (previously missing) Subtype key to the Colorants dictionary.

devices/vector/gdevpdfg.c


2017-07-01 16:36:29 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
f1cfdcd88da67bcab1efbed26191d27a0ce00a53

Bug 694626: Prevent SEGV due to division by zero.

Add bounds checking in ttfFont__Open to default nUnitsPerEm to 1024 as
precedented in ttfOutliner__Outline.

base/ttfmain.c


2017-06-29 11:20:09 +0100
Chris Liddell <chris.liddell@artifex.com>
0b7fa9293f43dce8aea028e4d2b32da1d8fc18c8

Add error checking for gs_colorspace_set_icc_equivalent()

base/gscdevn.c
base/gsciemap.c
base/gscolor2.c
base/gscsepr.c
base/gstrans.c
base/gxcmap.c
base/gxipixel.c
base/gxiscale.c
base/gxshade.c


2017-06-29 11:00:38 +0100
Chris Liddell <chris.liddell@artifex.com>
d592ee18a9168b1190bc7f7a1426b41fa6d508af

Bug 698151: XPS: bounds check selecting cmap table.

xps/xpsfont.c


2017-06-29 10:54:49 +0100
Chris Liddell <chris.liddell@artifex.com>
0c39ac5a0b8ca650101ac6322be34bd7504e7f63

Bug 698150: XPS: bounds check in format 6 and 10 cmap tables

xps/xpsfont.c


2017-06-29 12:07:29 +0100
Robin Watts <robin.watts@artifex.com>
ad0ac7883807331c1c9afb0b87585838bd3e63be

Bug 697981: Avoid integer overflow problems in scan converter.

Positions can be anywhere in the signed range 0x80000000..0x7fffffff,
therefore the difference between those positions can overflow a
signed 32bit representation.

base/gxscanc.c


2017-06-28 17:03:24 -0600
Henry Stiles <henry.stiles@artifex.com>
d4681a07410f96ee68479e0c39f1ca6f27168b8f

Fix Bug 694656, Seg faults found by fuzzing in hpgl_get_char_width

Along with checking that there is a valid font make sure there is a
current font selection, if not recompute the current font.

pcl/pcl/pglabel.c


2017-06-28 20:29:47 +0100
Robin Watts <robin.watts@artifex.com>
1d9dc902167802515d8ee86bf4e2205461486b50

Squash some warnings in gsmchunk.c

base/gsmchunk.c


2017-06-07 19:16:46 +0100
Robin Watts <robin.watts@artifex.com>
af4317bc527142dd0b8a6032799c4accf40bf835

MSVC: Squash double->float implicit cast warning.

devices/vector/gdevpdfv.c


2017-06-07 19:14:16 +0100
Robin Watts <robin.watts@artifex.com>
f204ddc13530f1bdb180eb38ebcf5a96caab8b74

MSVC: Fix some implicit casting warnings in ft_api.c

Simply make the castings explicit.

base/fapi_ft.c


2017-06-27 19:18:32 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
3a684e3dcc55c27506dc179723e8bcd85d121aa7

Bug 694670: Prevent buffer overrun.

Add bounds checking in pxSetHalftoneMethod to prevent a buffer
overrun.

pcl/pxl/pxink.c


2017-06-22 22:14:59 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
25d4e951e5290a34354f633f46d57cb6870fbd5d

Bug 694681: Prevent buffer overrun.

Move bounds checking earlier in pxReadRastPattern to prevent a buffer
overrun when StartLine attribute is set to non-zero.

pcl/pxl/pximage.c


2017-06-27 09:58:44 -0700
Michael Vrhel <michael.vrhel@artifex.com>
dc09d291658c1758fe2a0a02776e66355f56b09a

Bug 698134 Text knock with alphabits

The pdf14_copy_alpha operation was not updated
when fixes were made to properly handle non-isolated
knockout groups.

base/gdevp14.c


2017-06-27 15:33:22 +0100
Chris Liddell <chris.liddell@artifex.com>
6ce668c11ccbadde6d76430ba00205eca853879e

Bug 698130: check the icc profile data exists before accessing it

base/gscsepr.c


2017-06-26 10:04:02 +0100
Chris Liddell <chris.liddell@artifex.com>
74ce33d1fdb26af4e15a58e5df91dbb1403f66f9

Drop the now redundant check for zero length, staight contours

when degenerating the outline into moveto/lineto/curveto operations.

base/gxfapi.c


2017-06-26 09:58:11 +0100
Chris Liddell <chris.liddell@artifex.com>
6d17251a6c22673854bcd288d8562650361847e5

Bug 697983: (re-redux) Drop zero length contours from glyph outlines

Zero length contours cause issues (line-caps) when the outline is stroked.

Turns out the same problem can arise with arcs as with straight lines.

That complicates things where TTFs are concerned since we have to convert cubic
to conic splines, and the floating point errors make it dubious checking for
point equality after the conversion. As a result, the checking has to be done
in the scaler specific interface code, rather than in the scaler independant
FAPI code.

That just means if we ever integrate another scaler that can handle
downloadable fonts, we need to take care to include the same checks as are
now in the Freetype interface code.

base/fapi_ft.c


2017-06-20 06:50:49 -0600
Henry Stiles <henry.stiles@artifex.com>
793f93b08813e898aa0f1b316619e33568275fb0

Fix Bug 697926, processing jpeg embedded color parameters.

HP ignores the height, width and color components provided with the
raster commands and uses the values in the embedded JPEG.
Consequently, we have to defer beginning the image until the image
data arrives.

pcl/pxl/pximage.c


2017-06-21 01:07:17 +0800
Sebastian Rasmussen <sebras@gmail.com>
4942c650d9ab84671724e1f98541829ba8b6ff80

Adapt tools to use renamed gpcl6 binary.

pcl/tools/docov.pl
pcl/tools/pcl2pdfwr
pcl/tools/pcl2pdfwr.bat
pcl/tools/plot2pdf.sh
pcl/tools/smoke_check.sh
pcl/tools/smoke_update.sh


2017-06-21 16:01:39 +0100
Ken Sharp <ken.sharp@artifex.com>
3b6625b9f04daedf678a137475858ad35b991052

pdfwrite - don't arbitrarily alter the 'current' shape alpha

Bug 697472 "Transparent box appears lighter"

Whenever we opened a substream, if it was an XObject resource we would
set the blend mode and shape alpha to the default values.

This looks wrong to me, and it means that when using a complex ExtGState
which includes a SMask, if there was an alpha other than 1 in the
ExtGState then we would write the constant alpha out twice, once
in the page content, and once again in the resulting Group Form
XObject which we create. If the alpha was not 1, then this causes it
to be applied twice, resulting in rendered content which is too pale.

Both of these look incorrect, but removing the blend mode causes other
files to fail. Removing the shape alpha causes progressions in a number
of test suite files.

devices/vector/gdevpdti.c


2017-06-21 07:38:01 -0700
Ray Johnston <ray.johnston@artifex.com>
e178c1c3a45076fcffbe703c722b4f9bca0ac532

Fix typo in previous commit s/b PageUsesTransparency

examples/transparency_example.ps


2017-06-20 17:57:26 -0700
Ray Johnston <ray.johnston@artifex.com>
670840afcd100f4751b911cf4ac3bf0415ba55c2

Bug 698087: Heap buffer overflow with confused clist colorspace

The PDF14 transparency compositor changes the colorspace to Gray
(8-bit), but if a 1-bit deep device is the target device, and the
normal startup for transparent pages doesn't happen, the playback
would write 8-bit data to a 1-bit deep buffer

Also fix the transparency_example.ps so that it sets the device param
PageUsesTransparency which is expected.

examples/transparency_example.ps
psi/ztrans.c


2017-06-20 15:39:22 +0100
Chris Liddell <chris.liddell@artifex.com>
7258589eb5005d05c1499e717da8de804e1c35e1

Bug 698069: tighten up the out-of-data condition in spgetcc

base/stream.c


2017-06-20 10:06:51 +0100
Chris Liddell <chris.liddell@artifex.com>
8aaacf3f8d3837b471fc302de0a84c85ecb24307

Bug 698081: more bounds checking in xps_load_sfnt_name

xps/xpsfont.c


2017-06-19 13:26:02 +0100
Ken Sharp <ken.sharp@artifex.com>
605af24e8adcbc71bec1c5e1283dc20eabfbc515

Yet another check on raster memory for get_bits_rectangle

Bug #698073 "Potential null pointer dereference in mem_word_get_bits_rectangle"

Not the same reason, but still a potential use of dev->line_ptrs, which
can be NULL If you mangle makeimagedevice and copyscanlines.

base/gdevmem.c


2017-06-19 10:02:34 +0100
Ken Sharp <ken.sharp@artifex.com>
a5c6f7da872845b1d9bf2025c0cd5fc98b937d90

PS interpreter - remove 'STRICT' and remove from documentation

The 'STRICT' switch is documented as removing as many Ghostsctipt
extensions as possible. In reality it only removes some media size
definitions from statusdict.

This seems less than useful, so remove it to reduce clutter.

Resource/Init/gs_init.ps
Resource/Init/gs_statd.ps
doc/Use.htm


2017-06-19 09:46:21 +0100
Ken Sharp <ken.sharp@artifex.com>
2fa6beaa40144c592661a611bf35ff6f06d3354f

Tools - remove ps2ascii.ps, recode scripts to use txtwrite

ps2ascii.ps uses DELAYBIND, which we would like to get rid of, in
addition it doesn't do a terribly good job of actually extracting text.
The txtwrite device is more sophisticated, although it does not have the
added 'COMPLEX' feature of ps2ascii.ps which emits strokes and fills
as rectangles.

If the COMPLEX feature set should prove useful enough it would be easy
to add this functionality to a new device, but in reality I doubt
anyone is using this. The scripts specifically set -dSIMPLE.

This allows us to deprecate DELAYBIND and in future remove it.

lib/ps2ascii
lib/ps2ascii.bat
lib/ps2ascii.cmd
lib/ps2ascii.ps


2017-06-17 17:06:32 +0100
Ken Sharp <ken.sharp@artifex.com>
8f796773b5aae90362ec500d942dc38e6a1f0f6b

PS interpreter - deprecate DELAYBIND, remove from documentation

DELAYBIND seems like a bad idea, we suspect there is nothing it does
which cannot be achieved another way.

For now we will continue to allow it, but user will have to set
-dREALLYDELAYBIND instead, setting -dDELAYBIND will trigger a warning
message and an error.

Resource/Init/gs_init.ps
doc/Language.htm
doc/Use.htm


2017-06-17 16:13:57 +0100
Ken Sharp <ken.sharp@artifex.com>
0a41e707c2ca9a9243df640b32c5abe372be1f53

PS interpreter - remove NOBIND option and all references

This was only ever supposed to be a 'debugging aid' and its something
of a struggle to see why it would be useful.

Resource/Init/gs_dps1.ps
Resource/Init/gs_init.ps
Resource/Init/gs_ll3.ps
doc/Language.htm
doc/Use.htm


2017-06-17 14:27:06 +0100
Ken Sharp <ken.sharp@artifex.com>
c294b131ea270cea5d66c9b0a6ea61d3a69a20a0

PS interpreter - fix use of superexec with DELAYBIND

Commit 8556b698892e4706aa0b9d996bec82fed645eaa5 removed superexec from
systemdict, leaving it in internaldict, where it should be. However,
if we run with DELAYBIND then by the time we come to bind the procedures
which use superexec the definition in systemdict is gone.

Technically this shouldn't be a problem, as we should be using the version
in internaldict. But if we do that, without DELAYBIND the internaldict
definition isn't present, because we haven't copied it yet....

So now we look for the presence of superexec in systemdict and use that
one if its present, otherwise we assume its in internaldict and use
that instead.

Unfortunately the use of DELAYBIND interferes with the cluster testing
causing thousands of files to fail. I've run a random selection of them
locally in a normal setup and they work, I guess we'll just have to
hope for the best and fix any problems as they are reported.

Resource/Init/gs_dps1.ps
Resource/Init/gs_fonts.ps
Resource/Init/gs_ttf.ps
Resource/Init/gs_type1.ps


2017-06-17 11:17:52 +0100
Ken Sharp <ken.sharp@artifex.com>
971472c83a345a16dac9f90f91258bb22dd77f22

Make operator hiding work with DELAYBIND

Commit 1497d65039885a52b598b137dd8622bd4672f9be undefines as many operators
as possible once startup is completed, in order to prevent potantially
malicious PostScript or PDF files using them.

However, if DELAYBIND (itself a gaping security hole if used) is
specified, this leads to an endless loop. Instead we must undefine the
operators during .bindnow (after the deferred binding has occured).

Resource/Init/gs_init.ps
Resource/Init/pdf_main.ps


2017-06-13 00:45:54 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
4bf1f491517c4d1f30f594a77ea4adbef263bfc9

Bug 694639: Prevent buffer overrun.

Add bounds checking in pxReadRastPattern to prevent a buffer overrun when
StartLine attribute is set to non-zero.

pcl/pxl/pximage.c


2017-06-16 15:40:33 +0100
Chris Liddell <chris.liddell@artifex.com>
824aa630e2d4ce5b53e78cf8b2686ee6acb7a5fe

Bug 698066: Ensure device has raster memory before using it

Same solution as Bug #697676

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/gdevmpla.c


2017-06-16 09:03:14 +0100
Chris Liddell <chris.liddell@artifex.com>
260fefe6504653742a623d416fcf73f6b2559579

Bug 698065: xps: fix reading of idRangeOffset in cmap table

In format 4 cmap tables the idRangeOffset was being read as a signed value,
but it is unsigned.

xps/xpsfont.c


2017-06-16 08:50:43 +0100
Chris Liddell <chris.liddell@artifex.com>
961b10cdd71403072fb99401a45f3bef6ce53626

Bug 698064: bounds check xps_encode/decode_font_char_imp

xps/xpsfont.c


2017-06-16 08:29:25 +0100
Chris Liddell <chris.liddell@artifex.com>
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15

Bug 698063: Bounds check Ins_JMPR

base/ttinterp.c


2017-06-15 09:05:20 +0100
Chris Liddell <chris.liddell@artifex.com>
937ccd17ac65935633b2ebc06cb7089b91e17e6b

Bug 698056: make bounds check in gx_ttfReader__Read more robust

base/gxttfb.c


2017-06-15 08:58:31 +0100
Chris Liddell <chris.liddell@artifex.com>
7755e67116e8973ee0e3b22d653df026a84fa01b

Bug 698055: bounds check zone pointer in Ins_MDRP

base/ttinterp.c


2017-06-14 22:00:52 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
f887813ad00d680e2ea5d81606fd21d1b68067af

Bug 694662: Bounds check formlines in pcl_vmi_default()

Added bounds checking to clamp value between a minimum of 5 and a
maximum of 128.

pcl/pcl/pcursor.c


2017-06-13 22:35:37 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
3749bc274be1ae5a2f9897447708e84418ccf7a4

Bug 694653: Prevent buffer overrun.

Add bounds checking to pcl_character_data to prevent a buffer overrun if
the continuation data total is greater than font_data_size.

pcl/pcl/pcsfont.c


2017-06-14 16:07:02 +0100
Chris Liddell <chris.liddell@artifex.com>
db85b2782543f6dc6397a2e87c6beefc00b25b54

Fix mistake introduced with the pcl glyph data bounds checking code

When I added the bounds checking for PCL glyph data, I changed slightly the
way offsets were calculated for the PXL 'error handler' bitmap font so
we could know the data length.

I messed up, and forgot to fully take account of the first byte being the
char code, and not part of the bitmap data.

pcl/pxl/pxerrors.c


2017-06-14 15:14:30 +0100
Chris Liddell <chris.liddell@artifex.com>
4992ef5bc283a6347737f1369ef3d7bd4efbdce1

Bug 697983: (redux) Drop zero length contours from glyph outlines

When a outline glyph has contours with only one point in it, we end up with
a moveto and a lineto the same point, thus resulting in a zero length line
segment. This causes problems when the outline is stroked (line caps).

We'll now drop these pointless lineto operations.

Resource/Init/pdf_ops.ps
base/gxfapi.c
base/lib.mak


2017-06-14 10:46:27 +0100
Chris Liddell <chris.liddell@artifex.com>
80f4cc558efdd73be26ede4057ac1750b0b34210

chunk allocator: on free, use original size for single object chunk

On allocation, we decide, based on the requested size (+ house keeping data)
if an object should be in a chunk on its own. But the size recorded can be
larger than that if the chunk was recovered from the free list (because the
free list can contain merged free chunks). In such a case, we also record the
padding bytes.

On freeing, we have to use the object size minus the object padding to
identify single object chunks - to mirror the decision making in the allocation
code.

Fixes the cluster segfault with C410.bin and bitrgbtags

base/gsmchunk.c


2017-06-14 10:14:51 +0100
Chris Liddell <chris.liddell@artifex.com>
3ee55637480d5e319a5de0481b01c3346855cbc9

Bug 698050: xps: bounds check offset for requested cmap table

xps/ghostxps.h
xps/xpsfont.c
xps/xpsglyphs.c


2017-06-14 09:30:45 +0100
Chris Liddell <chris.liddell@artifex.com>
3c2aebbedd37fab054e80f2e315de07d7e9b5bdb

Bug 698044: restrict font name length to the buffer size.

xps/ghostxps.h
xps/xpsfont.c
xps/xpsttf.c


2017-06-14 09:16:02 +0100
Chris Liddell <chris.liddell@artifex.com>
c53183d4e7103e87368b7cfa15367a47d559e323

Bug 698042: xps: fix glyph index and index bounds check.

If a gs_glyph has the GS_MIN_GLYPH_INDEX offset, we need to remove the offset
before we try to use it.

Secondly, using a unsigned variable for a value from which we subtract 1, and
which can be zero doesn't work well. Switch to a signed value.

xps/xpsttf.c


2017-06-14 09:28:34 +0100
Ken Sharp <ken.sharp@artifex.com>
6cf7a8c45517d5857aa81cf59a82a2cc5c7d021c

PDF interpreter - fix a problem with AcroForm interpretation

No bug for this, noticed in passing while working on a customer bug.

If we turn on AcroForm processing, and we have an AcroFOrm where a /Tx
field has a /V entry, then we would not write the value to the string we
are accumulating. We would only write the value if we had no /V but a
/DV.

Instead the string was left on the stack, leading to an error. This
appears to be due to a logical error when writing the V/DV handling
where the write== was placed inside the if clause, when it should be
outside the clause.

Resource/Init/pdf_draw.ps


2017-06-13 06:58:32 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
fe61712d5157066212d0fcee79b129d6ddcbd251

Bug 694657: Prevent SEGV due to missing font.

Updated pcl_reselect_font to check for missing font.

Updated hpgl_select_stick_font to initialise font->storage before it is
used in pcl_downloaded_and_bound.

pcl/pcl/pcfsel.c
pcl/pcl/pglabel.c


2017-06-12 18:05:14 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
8e1acddeb57e9cbb105ec9ff9e65d35005cac44f

Bug 694648: Prevent buffer overrun.

Add bounds checking to pl_tt_string_proc to prevent a buffer overrun if
the incoming offset value is greater than the header size.

pcl/pl/plchar.c


2017-06-12 17:50:58 +0100
Chris Liddell <chris.liddell@artifex.com>
284f5fe121d8eb0a0f50a6f2465ee2f99a061018

mkromfs needs linked to zlib when using shared zlib

Ensure the compiler/linker command line parameter gets propagated from configure
to the mkromfs build.

Makefile.in


2017-06-12 13:15:17 +0100
Chris Liddell <chris.liddell@artifex.com>
98f6da60b9d463c617e631fc254cf6d66f2e8e3c

Bug 698026: bounds check zone pointers in Ins_IP()

base/ttinterp.c


2017-06-12 13:08:40 +0100
Chris Liddell <chris.liddell@artifex.com>
c7c55972758a93350882c32147801a3485b010fe

Bug 698024: bounds check zone pointer in Ins_MIRP()

base/ttinterp.c


2017-06-12 12:59:38 +0100
Chris Liddell <chris.liddell@artifex.com>
d2ab84732936b6e7e5a461dc94344902965e9a06

Bug 698025: validate offsets reading TTF name table in xps

xps/xpsfont.c


2017-06-10 14:06:49 +0100
Ken Sharp <ken.sharp@artifex.com>
f6507e828ddfe1f60645bc925bff9bedfdb306ce

graphics library - fix memory leak regression

Bug # 698005 "regression: commit 70cfc6afc42b9c299e9c05359f12455055105fac with Bug692720.pdf"

Commit 70cfc6 created a path from a list of rectangles early in a clip,
in order to minimise the number of times the path was created (creating
it later caused it to be discarded and re-created multiple times)

Unfortunately, as I feared at the time, this introduced a memory leak
under certain conditions. When the clip_path is discarded we weren't
counting down the reference to the path_list.

With this commit Bug697270.pdf uses approximately the same amount of
memory as it did before commit 70cfc6, but runs approximately 20%
faster.

The regular cluster run also seems to exhibit a further ~20% improvement
in performance, presumably in addition to the existing 10% from the initial
commit. Note, this *only* affects configurations where the clist is
used.

base/gxcpath.c


2017-06-08 16:57:25 +0100
Ken Sharp <ken.sharp@artifex.com>
a4f2cd23893cabe466d977668975987f925278d2

pdfwrite - keep using /Subsample for /Indexed images when downsampling

Bug #698000 "Inappropriate choice of downsampling filter for Indexed images"

For Bug #693917 we checked the downsampling factor for the Subsample and
Average downsampling filters and, if it was not an integer or nearly so,
we forced the Bicubic filter instead.

Unfortunately, this doesn't work well for image data in a /Indexed colour
space.

Instead this commit checks the colour space and, if its a /Indexed space,
forces the downsampling factor to the nearest integer, and preserves the
Subsample or Average filter.

devices/vector/gdevpsdi.c


2017-06-08 15:43:42 +0100
Chris Liddell <chris.liddell@artifex.com>
2a9d6adb5239e797eec3358518950e49565730b0

Bug 697983: avoid marking zero length glyph contours

The file contains many glyphs with stray zero length contours dotted around the
'main body' of the glyph outline. When a text rendering mode involving stroke
was used, these were resulting in the linecaps being drawn, and showing as
extra dots around the gylphs.

Force linecap to 'butt' when using a stroking text rendering mode to avoid this.

Resource/Init/pdf_ops.ps


2017-06-07 14:55:12 +0100
Chris Liddell <chris.liddell@artifex.com>
cfde94be1d4286bc47633c6e6eaf4e659bd78066

Bug 697985: bounds check the array allocations methods

The clump allocator has four allocation functions that use 'number of elements'
and 'size of elements' parameters (rather than a simple 'number of bytes').

Those need specific bounds checking.

base/gsalloc.c


2017-06-07 14:27:51 +0100
Robin Watts <robin.watts@artifex.com>
70cfc6afc42b9c299e9c05359f12455055105fac

Bug 697679: Ensure clist playback correctly creates clip paths.

Ghostscript clip paths consist of 3 parts:

1) A list of scan converted rectangles that union together to give
the clipping region.
2) (Optionally) a path that represents the clipping region.
3) A path_list structure (a list of paths that when intersected
together give the required clipping region).

3 is required for high level devices like pdfwrite (and the opvp
device).

Most of the code is at pains to preserve path_list as gx_cpaths are
manipulated. The exception to this appears to be the clist code.
The rectangle list is sent through the clist, but the path is not.

Accordingly, the code to intersect a gx_cpath with another path
checks to see if the path_list is valid on entry. If not, it
synthesizes one from the rectangle list.

This bug is caused by the fact that we end up intersecting a
clip path 120000 times in a pattern clist playback. Each of those
synthesizes a path from the rectangle list.

The fix here is to make the pattern clist playback create the
path_list each time it is replayed, meaning we have < 100 such
operations.

Thanks to Ken for his work on this, and for coming up with the
initial version of this patch.

base/gxclrast.c
base/gxcpath.c
base/gxpath.h


2017-06-03 18:50:05 +0100
Ken Sharp <ken.sharp@artifex.com>
0af88bdacdd8962244ac0a538c78b56bd5cc9376

pdfwrite - fix customised doumentUUID

Bug #697977 "document UUID gets truncated"

The code writing out a user-specified documentUUID had an error, failing
to account for the 'uuid:' prefix.

Credit to Axel Holewa for finding the preoblem and suggesting the fix.

devices/vector/gdevpdfe.c


2017-05-19 18:12:00 +0100
Robin Watts <robin.watts@artifex.com>
9c94340cd251ead99b4ae9121d1138c83be9a5df

PXL: Optimise 1 pixel wide image handling.

If we are given a 1xH image, we'd rather reflect it to be
an Hx1 image so that it gets passed through the image code
as a single scanline. This allows things like collation of
runs of matching pixels to work far better.

In particular this improves page mode performance for j11.prn.

pcl/pxl/pximage.c


2017-05-29 16:19:39 +0100
Chris Liddell <chris.liddell@artifex.com>
5f53dbc3e917d44e92619f831ba06be7944b5471

Bounds check buffers for downloaded glyphs in PCL.

For downloaded fonts, there were several buffer overreads reported by valgrind
when interpreting Intellifont glyph descriptions.

This adds using the (already existing) length field to bounds check when we
interpret the glyph.

pcl/pcl/pcsfont.c
pcl/pl/plchar.c
pcl/pl/plfont.c
pcl/pl/plfont.h
pcl/pl/pllfont.c
pcl/pl/plulfont.c
pcl/pxl/pxerrors.c
pcl/pxl/pxfont.c


2017-05-29 16:22:19 +0100
Chris Liddell <chris.liddell@artifex.com>
fe6ed9f54a02357e01c1f8c517b6af831e5f59ae

Ensure a FAPI instance is attached to a cloned font

It was possible for a cloned font to be missing the FAPI server attached to the
'parent' font. Add in a pl_fapi_passfont() call so it's guaranteed to be
available.

pcl/pcl/pcsfont.c


2017-05-31 20:51:00 +0100
Robin Watts <robin.watts@artifex.com>
bc12dc36623f3eb3c553ea1455cf1fd84d10b114

Avoid needless clip path recalculations.

While investigating Bug 697679, I spotted that clip_call_fill_path
was being called with a non NULL pcpath, thus triggering a 'slow'
rebuild of the clipping path.

In at least some of these cases, pcpath pointed to an invalid
clipping path. I believe this means we might as well have used
the fast route!

base/gxclip.c


2017-05-31 20:14:55 +0100
Robin Watts <robin.watts@artifex.com>
9ee2adefdfc9a12bf71acd1e08e88b8cc8af0502

Avoid calling the same function twice.

Not really expecting any huge speed benefit from this, but
it's silly to call it twice with the same args.

base/gxcpath.c


2017-05-31 21:44:41 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
2cebfeb7c91d5bcf916bc2c51d32a213f0ca776d

Bug 694646: Fix SEGV due to missing FontName attribute.

pxSetFont allowed for an optional FontName attribute which meant it tried
to set a font using NULL. This function has been updated to check that
FontName, CharSize and SymbolSet are not NULL before trying to use them.

pcl/pxl/pxfont.c


2017-05-31 12:28:43 +0100
Robin Watts <robin.watts@artifex.com>
e57b2aafe5bf09bb7e7df5f4608a4910145553b2

Bug 697970: Solve underflow/overflow problems in new scan converter.

The test file asks us to fill a line with one end at 0x7fffffff,
using 'any part of a pixel'. In order to calculate the index table
the existing code 'expands' this vertical area by 0x7f to allow
for rounding within a pixel. This leads to 0x8000007e, which
is of a different sign.

Correspondingly the vertical ranges touched by the lines appear
different in the indexing and marking phases.

To fix this we rejig the line calculations to avoid this
difference by more carefully doing the expansion.

Thanks to Kamil Frankowicz for doing the fuzz testing that lead
to this bug/fix.

base/gxscanc.c


2017-05-31 13:50:32 +0100
Ken Sharp <ken.sharp@artifex.com>
9e621d6ffb0e29c5de8331bf2c95003c8cf85941

PDF interpreter - apply Optional Content /Usage dictionaries

Bug #696076 "Ghost script 9.16/9.15 print PDF layer even if print state is "Never Print""

We currently only apply the /OFF (or /ON) entries from the Optional
Content Properties (/OCProperties) which is quite a high level and hence
low granularity control.

This commit adds processing of the /Usage dictionary; any ordinary
Optional Content (not OCMD) which is not set to /OFF in the OCProperties
is checked for the existence of a /Usage dictionary. We then check for
either a /Print or /View key in the dictionary depending on the setting
of the -dPrinted command line switch. If the relevant key is present
then we check for a ViewState key and use that to determine whether the
Optional Content should be rendered or not.

Note that if -dPrinted is not set on the command line then the interpreter
will attempt to guess. If the current device has OutputFile set then
the interpreter will assume that it should consider 'Print' keys. If it
is not present in the device, then the interpreter will assume that it
should consider 'View' keys.

This causes the PDF file Bug690364.pdf to render radically differently.
This is because much of the content is set to not print, and a small
amount of extra data is set to render only when printed. Because the
cluster uses an OutputFile, we assume that we should behave as if
printing.

Resource/Init/pdf_draw.ps


2017-05-31 11:24:40 +0100
Robin Watts <robin.watts@artifex.com>
33cf871a82e0fd9a0ebfed14317a2fa0f40e1e9d

Bug 697748: Fix misspelled alignment attribute in SSE code.

The SSE thresholding code relies on a buffer being 16 byte aligned.
To achieve this we use a compiler attribute to force alignment
to 16 bytes.

MSVC uses "align(16)", but gcc etc uses "aligned(16)".

We were using "align(16)" for both. Fix this in the macro here.

Thanks to Timo Teras for spotting the problem and suggesting the
fix.

base/gxht_thresh.c


2017-05-30 10:30:05 +0100
Ken Sharp <ken.sharp@artifex.com>
b883b8fc62ec6bc630d5f88abef0d7799efa6687

pdfwrite - Don't assume param list strings are NULL-terminated

Bug #697948 "(Add an ID to memory allocations.) breaks PDF/A output"

The bug description is misleading; in fact the problem is that the code
for reading a flag numeric value from a string parameter was assuming
the parameter was NULL_terminated, when in fact it is not.

Depending on exactly how the memory layout happened to be, the bytes
following the parameter may or may not be NULLs, or ASCII digits. If it
so happened that the trailing bytes were ASCII digits, it was possible
for an incorrect Flag value to be parsed, which could lead to an error
being flagged.

This commit just copies the actual number of bytes in the parameter
string to a temporary stack-based character buffer, NULL terminates the
buffer and reads the Flag value from there.

devices/vector/gdevpdfm.c


2017-05-28 21:46:26 -0600
Henry Stiles <henry.stiles@artifex.com>
4226202adec2a3f3a416e1986e8630bf7ca3bdc7

Fix Bug 694633 fuzzing segmentation fault.

Return an error if the GL/2 parser runs out of data while processing
a macro. If within a macro, unlike the normal data stream, the GL/2
commands already have access to all of the data.

pcl/pcl/pgparse.c


2016-07-04 09:28:06 +0100
Ken Sharp <ken.sharp@artifex.com>
7918a01dd37bc383e61ae0b237341e69286dc83c

PDF interpreter - Move ExtGState parameters into the regular graphics state

Bug #696511 - "Move ExtGState parameters into the regular graphics state"

A long time ago a decision was made not to replicate the PDF ExtGstate
parameters in the graphics state. This has had long term painful consequences
because we were unable to do a gsave/grestore to simply preserve
parameters but had to jump throuhg a lot of hoops. Amongst other problems
has been confusion over when exactly a change in colour has taken place.
With this commit the ExtGState parameters are moved into the graphics state
and obey gsave and grestore.

This extensive commit was worked on in the PDF_gstate branch and the history
is preserved in that branch.

This does introduce a few differences in the test suite;

There are a few cases where broken files (recursive SMasks) now render
slightly differently.

Some files now exhibit progressions, especially with CMYK or DeviceN output
devices, this is because the 'default' colour space was incorrect, the code
was using DeviceGray instead of the device's colour space, and this makes
a difference for some types of transparency blending when the Group does
not specify a Blending space.

A few other files demonstrate progressions because a change in colour now
takes place before an error occurs.

Resource/Init/pdf_draw.ps
Resource/Init/pdf_font.ps
Resource/Init/pdf_main.ps
Resource/Init/pdf_ops.ps
base/gsstate.c
base/gsstate.h
base/gstrans.c
base/gstrans.h
base/gxgstate.h
psi/igstate.h
psi/int.mak
psi/zcolor.c
psi/zcssepr.c
psi/zgstate.c
psi/zmatrix.c
psi/ztrans.c
psi/ztype.c


2017-05-29 11:22:34 +0100
Ken Sharp <ken.sharp@artifex.com>
2e2a9d851c73192739c9227ef0030f3ba3e7b6fd

PDF interpreter - Don't render closed Popup annotations, synthesise missing Popup Appearances

Bug #697951 "MuPDF - Arguably incorrect annotation"

Although this is a MuPDF bug, it showed a couple of problems in Ghostscript

Firstly; Popup annotations which have /Open false should not be rendered

Secondly; Popup annotations with no /Open should be treated as ?open False

Finally, Popup annotations with no /Appearance were not rendered, unlike
other annotation types we were not synthesising an Appearance.

This commit addresses all 3 of these, and shows progressions with:

tests_private/pdf/PDF_1.7_FTS/fts_32_3232.pdf
tests_private/pdf/sumatra/1312_-_comments_not_displayed.pdf
tests_private/pdf/sumatra/1571_-_popup_annotations.pdf
tests_private/pdf/sumatra/embedded_go-to_actions.pdf

Resource/Init/pdf_draw.ps


2017-05-28 21:27:41 -0600
Henry Stiles <henry.stiles@artifex.com>
3ded6c3b28a1b183a492ada2f2a3970953f3d060

Increment the PJL stream pointer for illegal characters.

When an illegal character is encountered within a PJL command we exit
with end of job. With recent changes it is necessary to increment the
stream pointer as well because the PJL interpreter is reinvoked upon
UEL resulting in an infinite loop.

pcl/pl/pjparse.c


2017-05-24 19:29:57 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
3ebffb1d96ba0cacec23016eccb4047dab365853

Bug 697934: Fix SEGV due to error code being ignored.

The return code from jbig2_decode_text_region was being ignored so the
code continued to try and parse the invalid file using incomplete/empty
structures.

jbig2dec/jbig2_symbol_dict.c


2017-05-26 17:05:29 +0100
Ken Sharp <ken.sharp@artifex.com>
5cf06167c248f345a1042c421cc2f5f741bf281d

pdfwrite - correctly set the BPC for the image downsampling filter

Bug #697944 "Segmentation fault with -sDEVICE=pdfwrite"

The code to call the downsampling filter resizes the input to the filter
to 8BPC, and then resizes the output from the filter back to whatever
the required depth was.

But the stream state for the downsampling filter was left with the
original BPC. This led to the Mitchell filter calculating two parameters
sizeofPixelIn and sizeofPixelOut incorrectly as 0 (4/8 is 0 in integer
arithmetic). Later the code used sizeofPixelOut being 1 to write 1 byte
output data, but if the value was not 1 it wrote 2 bytes of output.

This causes a buffer overflow in the callers buffer, leading to memory
corruption and an eventual seg fault.

This commit simply sets the BPC in the stream state correctly to reflect
the fact that the intermediate data is always 8 bits.

devices/vector/gdevpsdi.c


2017-05-26 13:13:16 +0100
Ken Sharp <ken.sharp@artifex.com>
6cae884b66944318c34e17992c628a246dda18aa

Vector devices - work around TrueType subsetting bug corrupting metrics tables

Bug #697376 "Adobe Distiller can't handle EPS files created with eps2write - limitcheck error"

The TrueType writing code for the vector devices continues to produce
problems. We should rewrite this code but realistically that is still
some way off.

In this case the code was attempting to minimise the size of the VMTX
and HMTX tables by only writing out the metrics for the glyphs we were
actually including in the font (unused glyphs remain as references in the
font, but have no outlines).

This is not valid in TrueType, the metrics tables must contain an entry
for each glyph. Looking at the code it should have been clear that this
was nonsense, but apparently it was missed.

We can save a minimal amount of space by writing out the metrics for all
the glyphs up to the last used one, and then writing just a 0 side
bearing for each remaining glyph, but the space saving is small. So I've
chosen simply to disable the subsetting of metrics and copy the entire
table.

devices/vector/gdevpsft.c


2017-05-26 11:27:44 +0100
Chris Liddell <chris.liddell@artifex.com>
bf949eaff89ac71b30d4a93638716e2c63090b0a

Bug 697949: check parameters for .setuseciecolor

psi/zcolor3.c


2017-05-24 08:54:25 -0700
Ray Johnston <ray.johnston@artifex.com>
d57e9332127baa82fa8083c0927498f412aa48d8

Fix tags with transparency.

Only change the tag if the alpha_s (source alpha) is > 0. If it is 100%
and the BlendMode is Normal, then we use the object's tag, if not, we
combine with the existing tag (in the backdrop/destination) by OR'ing
the bits together. Note that for some Blend modes, the pixel may only
have contributions from the source or from the destination, but we don't
use that because it could change the tag within an object (e.g, gradient
or image) depending on the color value causing unexpected shifts in the
tag value.

base/gdevp14.c


2017-05-24 16:26:55 +0100
Ken Sharp <ken.sharp@artifex.com>
2e3ca2386ae8045a084dc862e7e22f3df1341d0e

device subclassing fix reference counting and stype patching

We patch the memory manager's 'stype' on the original device's memory
when we subclass the device, but had missed resetting that when we
unsubclass the device, restoring the child device. This left the memory
manager stype set incorrectly.

Secondly it transpires that we can alter the reference count of the
parent, so that it differs from the child, and we hadn't accounted for
that. If the reference count of the child (subclassed) device differs
from the parent (subclassing) device at the point where we unsubclass
the device, we need to make sure we retain the correct reference
count. Otherwise we can end up with saved gstates pointing to a device
which has been freed.

base/gdevdflt.c


2017-05-23 13:05:42 +0100
Ken Sharp <ken.sharp@artifex.com>
b13ef3074dd164d2317cd5d03331b8de96ea98d0

pdfwrite - unescape specially escaped names in pdfmark operations

Bug #697885 "Commented pdf-file converting with 9.21 comments are omitted but not with <= 9.20 versions"

We now preserve (where possible) annotations from input PDF files
into the output file, where previously these were effectively 'folded into'
the page content stream.

In order to do this for Appearances, we need to create a separate Form
XObjet which we reference from the annotation. Doing this requires
some underhandedness in the PDF interpreter, where me make use of
a non-standard 'escape' consisting of tow NULL (0x00) bytes before the
name of the Form XObject, and one NULL after.

This works well, but ended up copying the NULL bytes into the output
PDF file. This is actually legal, but it seriously confused the
Linearisation code when it tried to alter the object numbers in order
to write them in the correct xref table.

Since these NULLs are not required and confuse the code, we now take
extra action to remove them from the string we create working from the
pdfmark data.

devices/vector/gdevpdfr.c


2017-05-22 10:18:56 +0100
Chris Liddell <chris.liddell@artifex.com>
b914c5de71fcc7675f40d8557975ec87cd46fced

Bug 697910: handle Type 1 fonts with 'embedded' Type 1 fonts

The test file for this bug has a Type 1 font stream (for an oblique version of
a font) which 'contains' a second (non-oblique) Type 1 font, from which the
'outer' font pulls the CharStrings (the oblique version contains its own
subrs to make the regular font into the oblique font).

A previous fix for a broken Type 1 font broke support for the above (valid)
form of Type 1 font. The broken Type 1 ends up putting various required keys
in the current dictionary, rather than in the font dictionary.

The previous fix pushes a sacrificial "top dictionary" before executing the font
stream. It identifies the broken font by spotting that required keys exist in
a dictionary on the dictionary stack (rather than in the font dictionary on the
operand stack on the call to definefont). When it encounters the broken font
layout, it copies the required keys into that sacrificial top dictionary, and
uses that as the font dictionary.

The Type 1 inside another Type confuses that code, and ends up creating one font
from the "inner" Type 1.

This commit reverses the logic: it checks for required keys missing from the
font dictionary, and if any are missing, it tries to find them on the
dictionary stack.

This is slightly less robust than the original solution, since it assumes that
the font has created a font dictionary, but has defined required keys before
pushing it onto the dictionary stack. A font that fails entirely to create
a font dictionary will fail.

Obviously, a solution for broken fonts that causes (admittedly strange) but
valid fonts to fail is unacceptable. If we find a case of a font that is broken
as described above, we can revisit this fix.

Resource/Init/pdf_font.ps


2017-05-17 15:27:23 -0600
Henry Stiles <henry.stiles@artifex.com>
d7cade08ad36382a0ed5dfa72fcb9a0e9a822417

Remove shared device psi implementation and improve documentation.

The experimental gpdl build now only supports running PostScript and
PDF in a seperate context with it's own device using the normal API.
At this time it only runs files detected as PostScript or PDF in the
default device with no arguments. The previous setup did not work
properly and if we are to have a shared device it should be
implemented anew anyway.

Also improve the documentation for how languages plug into the
language switching system.

gpdl/psi/psitop.c
pcl/pcl/pctop.c
pcl/pl/plimpl.c
pcl/pl/plmain.c
pcl/pl/pltop.h
psi/imain.c
psi/zdevice.c


2017-05-11 13:56:04 -0600
Henry Stiles <henry.stiles@artifex.com>
00d5670774e9c56cb8bf6e9f877756c82d10536e

Clean up documentation and simplify language implementation procs.

pcl/pcl/pctop.c
pcl/pl/pltop.h
pcl/pxl/pxtop.c
xps/xpstop.c


2017-05-08 17:16:56 -0600
Henry Stiles <henry.stiles@artifex.com>
d585f6b8b2150c70a4fdc8d2b4d582012411f586

PL API: Remove separate interpreter instances.

The previous design was complicated by supporting multiple instances
of each language which will never be used, so we can remove the
interpreter instance type and access each language through the
implementation pointer.

gpdl/psi/psitop.c
pcl/pcl/pcimpl.c
pcl/pcl/pcstate.h
pcl/pcl/pctop.c
pcl/pcl/pctop.h
pcl/pl/pjparse.c
pcl/pl/pjparse.h
pcl/pl/pjparsei.c
pcl/pl/pjtop.c
pcl/pl/pjtop.h
pcl/pl/plapi.c
pcl/pl/plimpl.c
pcl/pl/plmain.c
pcl/pl/plmain.h
pcl/pl/pltop.c
pcl/pl/pltop.h
pcl/pl/realmain.c
pcl/pxl/pxstate.h
pcl/pxl/pxtop.c
xps/xpstop.c


2017-02-21 20:42:15 -0700
Henry Stiles <henry.stiles@artifex.com>
b6689161cc0dcbbb0f029a91708ac2724570a63d

PL API: make PJL an implementation and several miscellaneous improvements.

It is simpler to have PJL selected as an implementation upon seeing
the @PJL identifier or detecting a UEL in the input stream.
Previously we always entered the PJL interpreter after exiting another
language. Also, added stubs for the "run_string" api.

pcl/pl/pjparsei.c
pcl/pl/pl.mak
pcl/pl/plapi.c
pcl/pl/plapi.h
pcl/pl/plcursor.c
pcl/pl/plmain.c
pcl/pl/plmain.h
pcl/pl/realmain.c


2017-02-03 13:04:53 -0700
Henry Stiles <henry.stiles@artifex.com>
611289048a343ec07eb3ec1dd19aa922211f200d

Remove cursor renewal.

This hack was used so the languages could return without consuming
data which is wrong. The underlying problem was the XL interpreter
returning 0 when it should have been returning an exit code.

pcl/pl/plcursor.c
pcl/pl/plcursor.h
pcl/pl/plmain.c
pcl/pxl/pxtop.c


2017-01-30 17:10:50 -0700
Henry Stiles <henry.stiles@artifex.com>
3eb111d09610e72106af19b28a90982b14dc55dc

PL API: cleanup unused functions replace by API calls.

pcl/pl/gpcl6dll32.def
pcl/pl/gpcl6dll64.def
pcl/pl/gpdldll32.def
pcl/pl/gpdldll64.def
pcl/pl/gxpsdll32.def
pcl/pl/gxpsdll64.def
pcl/pl/plapi.h
pcl/pl/plmain.c
pcl/pl/plwmainc.c


2017-01-29 08:08:56 -0700
Henry Stiles <henry.stiles@artifex.com>
87af13a97cc6868dd31379e446f089b1dd9e101a

PLAPI: Use api for windows display program.

pcl/pl/pl.mak
pcl/pl/plapi.c
pcl/pl/plapi.h
pcl/pl/plmain.c
pcl/pl/plwmainc.c


2017-01-02 10:20:58 -0700
Henry Stiles <henry.stiles@artifex.com>
761bf52f3591219b8262549d9a337d0a3d71fd61

PL API: add plapi implementation.

Fills out the plapi implementation and changes the default command line
program to use the new api.

pcl/pl/pl.mak
pcl/pl/plapi.c
pcl/pl/plapi.h
pcl/pl/plmain.c
pcl/pl/plmain.h
pcl/pl/realmain.c


2016-12-29 08:55:44 -0700
Henry Stiles <henry.stiles@artifex.com>
47d3e1e7ec973fcead1f88cf24e4bdc430123592

Memory leak check.

pcl/pl/plmain.c


2016-12-29 08:38:42 -0700
Henry Stiles <henry.stiles@artifex.com>
0877d850a63fe57ad60fac065ae7675817ba7a4f

Rename pltoputl to plcursor.

Only the cursor code remained in pltoputl.

pcl/pl/pl.mak
pcl/pl/plcursor.c
pcl/pl/plcursor.h
pcl/pl/plmain.c


2016-12-23 11:10:31 -0700
Henry Stiles <henry.stiles@artifex.com>
ebd2e51a648e0657eb9bd2464be01ad09f9b01e0

Move all cursor code to single module.

Not sure why this was spread out in plmain.c and pltoputl.c.

pcl/pl/pl.mak
pcl/pl/plmain.c
pcl/pl/pltoputl.c
pcl/pl/pltoputl.h


2016-12-22 15:09:31 -0700
Henry Stiles <henry.stiles@artifex.com>
2ec6f74df2fa14776182a75d306f3028170f5715

Make the main instance opaque.

Needed to reduce spreading dependencies resulting from including
plmain.h.

pcl/pcl/pctop.c
pcl/pl/plmain.c
pcl/pl/plmain.h
pcl/pxl/pxtop.c
xps/xpstop.c


2016-12-21 12:03:57 -0700
Henry Stiles <henry.stiles@artifex.com>
6850869002f40634a2af0e6a1c939d3ed385f217

Factor out common icc code into 1 pl procedure.

pcl/pcl/pctop.c
pcl/pl/plmain.c
pcl/pl/plmain.h
pcl/pxl/pxtop.c
xps/xpstop.c


2016-12-21 10:17:40 -0700
Henry Stiles <henry.stiles@artifex.com>
5c663ee7cf06f0887404709aae45141fb3049817

Remove unused vmspaces and nogc references.

pcl/pcl/pcl.mak
pcl/pcl/pcpage.c
pcl/pl/plmain.c
pcl/pl/plmain.h
pcl/pl/pltop.c
pcl/pxl/pxl.mak
pcl/pxl/pxtop.c


2016-12-19 21:43:08 -0700
Henry Stiles <henry.stiles@artifex.com>
6a20606c8f5ce3f8c0ce80c84a831ed4a98f2156

PL API: functions to exit and delete the main instance, like gs.

pcl/pl/plmain.c
pcl/pl/plmain.h


2016-12-18 14:50:20 -0700
Henry Stiles <henry.stiles@artifex.com>
2a3bc2153fd93542914b83df5d94dbafdbe257ec

Fix the gpdl build, PCL and XPS language switching for testing.

This uncovered a problem with the PJL state and the command line. PJL
should not be initialized for each file (pl_main_run_file()) if PJL
was issued on the command line (-J switch) otherwise it should be
initialized.

pcl/pl/plimpl.c
pcl/pl/plmain.c
pcl/pl/plmain.h


2016-12-17 20:47:14 -0700
Henry Stiles <henry.stiles@artifex.com>
37d1286a66bd80a471aa9ac0a166bc291a8318db

PL API - Reorganizing main procedure.

Splits out routines for running a file and inializing with arguments,
consistent with gs API. The allocator module was removed, the
procedures were to simple to be separated out. Lots of trivial clean
up as well.

pcl/pl/pl.mak
pcl/pl/plalloc.h
pcl/pl/plmain.c
pcl/pl/plmain.h


2016-12-15 11:11:13 -0700
Henry Stiles <henry.stiles@artifex.com>
f1dd6db9f969d0a6d23baeb781f5082f8d0f78e4

PL API: deprecate error string buffers which were never used.

pcl/pl/plmain.c


2016-12-15 10:32:49 -0700
Henry Stiles <henry.stiles@artifex.com>
bd95aa0cf7a5eef3e37c4bfa29ec32debd6b954d

PL API: continues previous commit removing pre and post page operations.

pcl/pl/plmain.c


2016-12-14 13:01:07 -0700
Henry Stiles <henry.stiles@artifex.com>
e9ff0dcf1892086276872e868a254d012ab48702

PL API: continue previous commit, purge pre and post page closures.

pcl/pcl/pctop.c
pcl/pl/pjparsei.c
pcl/pl/plmain.c
pcl/pl/pltop.c
pcl/pl/pltop.h
pcl/pxl/pxtop.c
xps/xpstop.c


2016-12-14 12:34:40 -0700
Henry Stiles <henry.stiles@artifex.com>
97f9904dc5d8f45cbca93b02098eac077bca7f5c

PL API: remove instance page count and refactor output page.

The page count is no longer needed in the main instance, it is now
available in the device. The output page closures were convoluted and
never used, factor out a common procedure to output the page,
pl_finish_page(), to be used by PCL, PXL and XPS.

pcl/pcl/pctop.c
pcl/pl/plmain.c
pcl/pl/plmain.h
pcl/pxl/pxtop.c
xps/xpstop.c


2016-12-13 16:38:10 -0700
Henry Stiles <henry.stiles@artifex.com>
23d85c19be2700d098d133f87a40e24031a9c64e

Remove set client instance procedure.

Unnecessary complexity between the main program and the individual languages.

pcl/pcl/pctop.c
pcl/pl/pjparsei.c
pcl/pl/plmain.c
pcl/pl/plmain.h
pcl/pl/pltop.c
pcl/pl/pltop.h
pcl/pxl/pxtop.c
xps/xpstop.c


2016-12-09 10:34:42 -0700
Henry Stiles <henry.stiles@artifex.com>
e14474ba4eff1cf7c42ff8888a3daa6dc6c83aaa

PL API Remove device_memory main instance member.

This was only needed for the language switch build with PS and PDF
which is no longer supported.

gpdl/psi/psitop.c
pcl/pcl/pctop.c
pcl/pl/pjparsei.c
pcl/pl/plmain.c
pcl/pl/plmain.h
pcl/pl/pltop.c
pcl/pl/pltop.h
pcl/pxl/pxtop.c
xps/xpstop.c


2016-12-08 17:33:41 -0700
Henry Stiles <henry.stiles@artifex.com>
3e026d15093a2a7279c3c4e46b3e24cb5ee11370

PL API: Add PJL instance to PDL array.

Previously the PJL interpreter was separated out from the other
interpreters now it is simply known to be the 0'th entry in the array
of languages. Having it separate would yet another member in the main
instance with the new API.

pcl/pl/pjparsei.c
pcl/pl/plimpl.c
pcl/pl/plmain.c


2016-12-08 08:40:56 -0700
Henry Stiles <henry.stiles@artifex.com>
ce20a5af6c0d72ae1d0198f3c44e2b0a0d0a09d6

PL API: remove pdl implementation array references.

A copy of a reference to the array was used in varous places, yet it
is a global constant, so reference the global directly.

pcl/pl/plmain.c
pcl/pl/plmain.h


2016-12-08 07:34:26 -0700
Henry Stiles <henry.stiles@artifex.com>
a3ad76f1872b46390328c31102c9b6e6bf25d776

PL API: remove plplatf module.

This makes the startup more consistent with gs.

pcl/pl/pl.mak
pcl/pl/plmain.c
pcl/pl/plplatf.c
pcl/pl/plplatf.h
pcl/pl/plplatfps.c


2016-12-07 18:30:04 -0700
Henry Stiles <henry.stiles@artifex.com>
587bfc08b8e833c2aa45284fe558a8d9b7116f4e

PL API: move argument state to the main instance.

pcl/pl/plmain.c
pcl/pl/plmain.h


2016-12-07 16:53:00 -0700
Henry Stiles <henry.stiles@artifex.com>
7f856d0f9de2145e7533ad239de618506ae145e6

PL API: move device parameter list to the main instance.

pcl/pl/plmain.c
pcl/pl/plmain.h


2016-12-07 13:40:09 -0700
Henry Stiles <henry.stiles@artifex.com>
5ce6334ed0996ccd2d52ac81d273a78293487bfd

PL API: access main instance parameters directly.

pcl/pcl/pctop.c
pcl/pl/plmain.c
pcl/pl/plmain.h
pcl/pl/pltop.h
pcl/pxl/pxtop.c
xps/xpstop.c


2016-12-07 09:38:45 -0700
Henry Stiles <henry.stiles@artifex.com>
6ab1d85eef2b821dcb08f8b82622fa92be1be1af

PL API: make main instance the "top of the system"

pcl/pl/plmain.c


2016-11-30 19:52:57 -0700
Henry Stiles <henry.stiles@artifex.com>
9a7d93d3f71ec4a92a726998f1acac85489c277e

PL API Make language read buffer a member of the language instance.

pcl/pl/plmain.c
pcl/pl/plmain.h


2016-11-29 17:26:55 -0700
Henry Stiles <henry.stiles@artifex.com>
1130f6ac765de4c6d202281496e1ad62b8370460

PL API: refactor initialization to be more like gs.

pcl/pl/plmain.c


2016-11-28 11:56:01 -0700
Henry Stiles <henry.stiles@artifex.com>
6cf194e23355ed75ddd248bde3e4849c8ad1bfcf

SVG is no longer supported, remove test file.

Also adds an xps tiger created by xpswrite.

pcl/tools/tiger.svg
pcl/tools/tiger.xps


2016-11-27 15:35:38 -0700
Henry Stiles <henry.stiles@artifex.com>
46a472c247dd33d53124b79204594c707c99e134

PL API - remove PJL memory allocator.

pcl/pl/plmain.c


2016-11-18 13:47:46 -0700
Henry Stiles <henry.stiles@artifex.com>
c672305a6e45a39c446918b5c4899c9763fc8f5b

PL API - make "universe" part of instance.

The "universe" is soon to be deprecated but for now include it in the
instance so it is available to all api functions.

pcl/pl/plmain.c
pcl/pl/plmain.h


2016-11-17 16:43:19 -0700
Henry Stiles <henry.stiles@artifex.com>
c5b13ee9953a4d482ab3bce112c61f19cf758a62

PL API - Dynamically allocate main instance.

pcl/pl/plmain.c


2017-05-19 11:08:38 +0100
Ken Sharp <ken.sharp@artifex.com>
119ec77d4e44e3861a376323ed14466b28b2f4bf

PDF interpreter - better match the behaviour of Acrobat with invalid /Mask

Bug #697919 "Invalid Mask values cause content to not render"

The sample file has a 1 bit per component image with a Mask, the values
in the mask array are [204 255]. Since this is a 1 bit image, clearly the
only valid values are 0 or 1.

Previously (bug #692852) we have specifically treated /Indexed spaces
with an invalid Mask specially, so that if the initial value is out
of range we ignore the Mask array, otherwise we use the initial value
and set the second to 1.

Also previously we have bug #689717 which is, in fact, an identical
case to this one. In that case we have code which clamps the two values
to 'max - 1' which works for that case. In fact, it works too well for
that case, and produces content which is almost certainly desired by
the author, but which Acrobat does not render.

In this commit we make the DeviceGray case match the /Indexed case, I
rather suspect that for 1 bit images Acrobat *never* uses the /Mask
array values, but I don't have an example in any other colour space. So
for now we'll leave them alone.

This causes the file for Bug 689717 to render with content 'missing',
however it does now match Acrobat. I do not think we can reasonably match
Acrobat's result for this bug without also matching it for the prior bug.

Resource/Init/pdf_draw.ps


2017-05-15 14:34:17 +0100
Robin Watts <robin.watts@artifex.com>
5501c28dbb1814aa869cb5132e52d5bcf090ec6e

New chunk memory manager.

Based off the original chunk heap managers code, this uses splay
trees for free blocks to speed searching. (Dual, top-down,
semi-splaying trees, one ordered on size, and another on location).

Adding this memory manager runs into a problem with pdfwrite.
Because pdfwrite is not entirely behaved with memory freeing, it
can free the same blocks more than once. This primarily happens
in pdf_close.

The existing chunk memory manager seems to get away with this by
luck, whereas this revised version sees SEGVs in some {pcl,xps} ->
pdfwrite tests.

Accordingly, we add a special fudge; if we call gs_defer_frees(1)
then the memory manager defers freeing blocks by putting them
onto a linked list (but only once). When we then call
gs_defer_frees(0), the manager finalizes all the blocks on the
list (which may in turn add new blocks to the list!). Once
all the blocks have been finalized, they are then freed.

"All" the pdfwrite double frees come from inside pdf_close (or
all the ones I have seen at least). Accordingly we bracket
pdf_close with gs_defer_frees(1) and gs_defer_frees(0).

base/gsalloc.c
base/gsmalloc.c
base/gsmchunk.c
base/gsmchunk.h
base/gsmemory.h
base/gsmemret.c
devices/vector/gdevpdf.c


2017-05-18 16:18:25 +0100
Robin Watts <robin.watts@artifex.com>
b69d68995d065d61b2defe919c038cf9cf60b598

Fix buffer overrun in xpspath.c

Seen with tests_private/xps/sumatra/buffer_overflow_in_path_handling.xps

Specifically:

bin/gxps -sOutputFile=out.pdf -sDEVICE=pdfwrite -r72 -Z: -dNOPAUSE
-dBATCH -dClusterJob
tests_private/xps/sumatra/buffer_overflow_in_path_handling.xps

xps/xpspath.c


2017-05-18 15:59:22 +0100
Ken Sharp <ken.sharp@artifex.com>
1e0088aa8d8e65ad7455d35e9280fe978163534b

Bug 696412 - Fix seg fault in pdf_end_transparency_mask

Bug #696412 "Seg faults found by fuzzing in pdf_end_transparency_mask"

The file is (of course) badly corrupted, leading to us receiving a
'end' for a transparency mask when we did not previously receive a
'begin'.

The code in pdf_end_transparency_mask assumed that the prior begin would
have created a soft mask dictionary, but of course if we didn't see the
begin then we don't have one.

Check for this and simply return an error instead of trying to
dereference the NULL pointer.

devices/vector/gdevpdft.c


2017-05-18 14:10:56 +0100
Ken Sharp <ken.sharp@artifex.com>
58aeac2fbd1489c797351a9b53134e40729b661c

Bug 696377 - Fix a seg fault in subclassing

Bug #696377 "Seg faults found by fuzzing in default_subclass_create_compositor"

With a sufficiently corrupted file it was possible to reach this point
with a mismatch of transparency group begin/end. This could lead to
us having the compositor device being NULL which we would then try to
dereference.

Simply check the compositor device and don't try to dereference it if
its NULL.

This was only reproducible on the commit mentioned in the bug report,
after fixing it the file continued on to seg fault in a completely
different place. However I believe this is due to the fact that the
corrupted file leads to a mismatch of push/pop groups for transparency
and Michael has addressed that with later commits. The file runs to
completion (with *many* errors) on current code.

base/gdevsclass.c


2017-05-14 03:34:57 +0800
Sebastian Rasmussen <sebras@gmail.com>
56c26790af78f94c08a595e0c9da527418c47614

Bug 697866: Do bounds checking of read data.

Credit to Ken for suggesting what bounds to check.

jbig2dec/jbig2_text.c


2017-05-14 03:37:11 +0800
Sebastian Rasmussen <sebras@gmail.com>
d39d31168cec8a08ac1e5c44c95925fecb087173

Make clipping in image compositing handle underflow.

jbig2dec/jbig2_image.c


2017-05-14 12:36:28 +0800
Sebastian Rasmussen <sebras@gmail.com>
a328d6377bac5268d3a8c071fbbf54c66e07de3a

Fix memory leak in case of error.

jbig2dec/jbig2_text.c


2017-05-14 03:31:50 +0800
Sebastian Rasmussen <sebras@gmail.com>
dbdcc8158d59960abfa5241b55ed76cbd40e12f3

Fix double free in error case.

jbig2dec/jbig2_symbol_dict.c


2017-05-16 20:53:27 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
8e466b1468df6afd91eac6266a417160540d8789

Bug 694632: Fix SEGV due to invalid proportional_spacing value.

Updated pcl_font_header to correctly handle fonts where the
proportional_spacing is greater than 1.

pcl/pcl/pcsfont.c


2017-05-17 14:38:45 +0100
Robin Watts <robin.watts@artifex.com>
bc8190c4e8050364c10bb3545ca6c705bfb3d38c

Squash warning.

Don't implicitly lose 'const'.

pcl/pcl/pcstate.h
pcl/pcl/pctext.c


2017-05-17 13:03:07 +0100
Robin Watts <robin.watts@artifex.com>
24781094295489cafe562239a251300c6cfbd6ca

Remove superfluous gsmemlok files.

Use it or lose it.

base/gsmalloc.c
base/gsmemlok.c
base/gsmemlok.h
base/gxclread.c
base/gxclthrd.c
base/lib.mak
windows/ghostscript.vcproj


2017-05-17 09:58:44 +0100
Chris Liddell <chris.liddell@artifex.com>
79fd8d7466f51c74bd0c14dc1fd33cfaba0e7b83

Bug 697909: Handle PDF T3 glyph streams with unmatched 'q'

We have to handle the case where a glyph description stream from a PDF Type 3
font has an unmatched 'q'. We can track this in the PDF interpreter by checking
the depth of the dictionary stack, and unwinding with 'Q' operations until the
dictionary stack is back to where we started.

Resource/Init/pdf_font.ps


2017-05-17 12:45:20 +0100
Robin Watts <robin.watts@artifex.com>
b38ed8a40e013ea79c89c6561eedf1841caa9801

Add gs_set_object_type function to gs_memory_t interface.

The subclassing code uses a horribly unsafe hack to reset
the type of a device object. This fails when the device
object is not of the expected type (in this case, when it's
not from the i_alloc manager).

Add a new access function to the API to allow this to happen
safely regardless of manager type.

base/gdevdflt.c
base/gsalloc.c
base/gsmalloc.c
base/gsmchunk.c
base/gsmemlok.c
base/gsmemory.h
base/gsmemret.c


2017-05-15 14:32:47 +0100
Robin Watts <robin.watts@artifex.com>
b5fd7b3473fc7cd02a2575f47b38d07f0e1e4222

Squash warning in ETS code

Missing 'restrict' in a prototype.

base/ets.h


2017-05-14 11:53:42 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
b9c9f25d2cf43835d3d563e6012968b253e7faf1

Bug 694628: Fix SEGV due to invalid bits_per_index value.

Updated check_cid_hdr to correctly handle indexed colour
spaces where the bits_per_index is greater than 8.

pcl/pcl/pccid.c


2017-05-15 13:42:23 +0100
Chris Liddell <chris.liddell@artifex.com>
9468f852a09232d1f4200d252ffb665bc4d86f51

Bug 696416: clean up pdfwrite form stack after error.

In pdfwrite, when we start accumulating a form (whether a 'real' form, or a
transparency group), we save a load of 'state' in stack form, so we can then
unroll it when the form execution completes.

If we begin a form, and the form content throws an error, we can reach the end
of the page whilst still having not unrolled the state from the form level back
to the page level, leaving the form stream object as the 'current' stream
rather than the page stream.

This results in the form not being marked as used, and potentially freed,
resulting in a seg fault when we try to flush the current stream (expecting it
to be the page stream, not the form stream).

Before we proceed to complete the page, ensure that we've unrolled any errant
form states.

devices/vector/gdevpdf.c


2017-05-15 13:26:22 +0100
Chris Liddell <chris.liddell@artifex.com>
050d101bda8a73a6da44c379b20156f1ce49c948

Remove spurious extra definition of RAMFS_APPEND

Spotted by Robin

base/ramfs.h


2017-05-12 11:21:51 +0100
Chris Liddell <chris.liddell@artifex.com>
969bef004730b3feb8cc01cf99d12f152807b24e

Bug 696397: further validate TTF glyph "end point" values

In a TTF glyph, we have to read the index of last point for each contour. We
already validated the value to ensure that the value for index "i + 1" was
always larger than that for "i". But we didn't check the values are positive.

base/ttfmain.c


2017-05-12 11:19:00 +0100
Chris Liddell <chris.liddell@artifex.com>
7de3003abd8a66ec312ebed4146bd56ec4649d8f

Bug 696390: bounds check Type 2 charstring "registry"

We emulate a "Registry" construct for Type 2 charstrings, but only with a single
entry. Bounds check accesses to it to avoid overrun.

base/gstype2.c


2017-05-13 10:48:56 +0100
Ken Sharp <ken.sharp@artifex.com>
98fca6146085dc2cf60effb0596e79fe12b3e69f

pdfwrite - make sure an EP pdfmark is not an orphan

Bug #696375 "Seg faults found by fuzzing in cos_object_memory (gdevpdfo.c:189)"

The fault is caused because the initial /BP pdfmark is corrupted. This
means that a substream and resource for the 'Picture' has not been
created, leading to us trying to dereference a NULL pointer.

If the resource is NULL< throw an 'undefined' error instead.

devices/vector/gdevpdfm.c


2017-05-12 13:15:06 +0100
Ken Sharp <ken.sharp@artifex.com>
7df7d8b6c37ca2d42ffcf1eb5bc795e741241259

Remove descriptions of operators which have been hidden

doc/Language.htm


2017-05-12 11:54:24 +0100
Ken Sharp <ken.sharp@artifex.com>
35a0ead22c8f1f459a4466b435b2486d53e75836

Update documentation to reflect recent utility file removal

doc/Psfiles.htm


2017-05-12 11:20:13 +0100
Ken Sharp <ken.sharp@artifex.com>
a0753746c3b6dd0ee01f37ebf9f3903450e9e832

remove deleted file references from unixinst.mak

base/unixinst.mak


2017-05-12 08:42:31 +0100
Ken Sharp <ken.sharp@artifex.com>
e8750a73313d6083aa949bc5223a26ae55ef02dd

Renove or modify many files from lib and toolbin that are no longer useful

Remove unused packfile.ps and gs_pfile.ps file from lib
--------------------------------------------------------
The PostScript claims to 'Pack groups of files together, with
compression, for use in storage-scarce environments.'

It also states that it 'must be kept consistent with gs_pfile.ps' which
says it is 'Runtime support for minimum-space fonts and packed files'

I've never heard of either of these being used, they aren't used in the
ROM file system and it seems unlikely these days that there is a great
deal of call for minimising file sizes.

If these should need to be reinstated, note that they use .setglobal
.currentglobal and .computecodes. At the time of this commit these
operators were being deprecated and hidden though the C support is
retained. If the C code is later removed then these library files
will not work.

Remove font2c.ps
-----------------
If we want to build a font into C and link it, we have the ROM file
system in place to do so. This no longer seems useful.

remove font2c

Remove impath.ps
-----------------
The apparent purpose of this code is to take a bitmap (scan ?) of a
glyph and turn it into a PostScript type 1 font form, presumably in
order to make a font.

This doesn't seem hugely useful, and seems to me at least borderline
illegal depending on jurisdiction.

We also want to remove, or at least disable, the .imagepath operator
which this program (and only this program) relies upon. If we ever
need to re-instate this program, we will also need to reinstate
.imagepath

Remove pdfinflt.ps and pdfwrite.ps
-----------------------------------
pdfwrite is only (as far as I can see) used by pdfinflt.ps which says:

% It is not yet ready for prime time, but it is available for anyone wants
% to fix it.
%
% The main problem is:
%
% 1. Sometimes the PDF files that are written are broken. When they are
% broken, GS gets an xref problem.
%
% This problem is actually due to lib/pdfwrite.ps since even
% when no conversion is done, the file is may be bad.

Since it doesn't work, and we can use MuPDF (which does work) for the
same task, I've chosen to delete both these files.

Remove unprot.ps wrfont.ps
---------------------------
unprot.ps 'disables access checks' according to the comments in order
to print out eexec-encrypted type 1 fonts. Since this could, presumably
be used to read a noaccess dictionary and dump type 1 font outlines it
is of dubious legality. (see the comments in wrfont.ps)

wrfont.ps is used to decode a type 1 font, we have better tools for
decoding fonts so this file seems mostly useless.

By the same reasoning we don't need type1ops.ps or type1enc.ps

Remove addxchar.ps
-------------------
This was used to add extended Latin characters to a font. Our fonts
now contain all the standard glyphs that Adobe fonts do, we don't want
to go back down the route of adding (and maintaining) poor quality
additional glyphs to the fonts.

Remove decrypt.ps
------------------
Yet another way to decrypt a type 1 font. In addition to dubious
legality we have better ways to do this.

Remove pcharstr.ps
-------------------
Again, we have better tools for doing this job and the legality of
this tool is debatable.

Remove markhint.ps
-------------------
We believe we now have better tools for dealing with fonts than this.

Delete level1.ps
-----------------
A fairly pointless file.

Remove smoke.ps from toolbin
-----------------------------
Our current testing method is much more thorough.

Remove bughunt.sh
------------------
A 'user contributed file that has not been kept current', since 1995
apparently. I can't believe this is still useful.

Remove pstogsf.bat
-------------------
I'm fairly certain this is long defunct.

Remove showchar.ps
-------------------
another font-related utility, we've deleted the programs it reliee on,
so....

Remove wftopfa
---------------
Wadalab fonts, given these were uploaded by Werner Lemberg I'm as sure
as possible that we don't need these utilities to work with these
fonts.

Remove markpath.sh
-------------------
seems like a moderately pointless file; since it uses flushpage,
which I want to hide, remove it.

Remove quit.ps
---------------
Seriously ? A file which just contains 'quit' ?

Modify various of our utilities to not use Ghostscript extension ops
---------------------------------------------------------------------
We want to hide various of our extension operators, these files used
.devicename, .rectappend, .currentglobal, .setglobal and .namestring

Replaced .currentglobal/.setglobal with currenglobal/setglobal

Replaced .rectappend with a simple PostScript path

Replaced .devicename with currentdevice /Name get

Replaced .namestring with 1024 string cvs

Remove EndOfTask.ps
--------------------
Just a Ctrl-D

Remove gs_rdlin.ps
-------------------
Linux 'readline' support, just sets prompt to nothing

Remove showpage.ps
-------------------
just contains 'showpage'!

lib/EndOfTask.ps
lib/addxchar.ps
lib/decrypt.ps
lib/font2c
lib/font2c.bat
lib/font2c.cmd
lib/font2c.ps
lib/font2pcl.ps
lib/gs_pfile.ps
lib/gs_rdlin.ps
lib/impath.ps
lib/level1.ps
lib/markhint.ps
lib/markpath.ps
lib/packfile.ps
lib/pcharstr.ps
lib/pdfwrite.ps
lib/pftogsf.bat
lib/ps2ascii.ps
lib/quit.ps
lib/showchar.ps
lib/showpage.ps
lib/traceop.ps
lib/type1enc.ps
lib/type1ops.ps
lib/unprot.ps
lib/viewmiff.ps
lib/wftopfa
lib/wftopfa.ps
lib/wrfont.ps
toolbin/bughunt.sh
toolbin/pdf_info.ps
toolbin/pdfinflt.ps
toolbin/smoke.ps


2017-05-11 13:09:29 +0100
Ken Sharp <ken.sharp@artifex.com>
1497d65039885a52b598b137dd8622bd4672f9be

Remove as many non-standard operators as possible

Remove all the Display PostScript operators and all the NeXT extensions

Remove all the operators which do not appear to be used in our code

Remove all the operators which are only used in bound procedures defined
at startup and which can therefore subsequently be removed.

The operators to be undefined are stored in arrays in PostScript and
the C support code is untouched. This means that it is relatively
simple for an end user to restore an operator if required.

Operators which are used in our test suite files are listed in the
arrays but commented out.

Operators which are used (by our own code) in a way which requires them
to be present are also listed in the arrays, but commented out.

Resource/Init/gs_init.ps
Resource/Init/pdf_main.ps


2017-05-12 13:47:34 +0100
Ken Sharp <ken.sharp@artifex.com>
0072619f46f89e0c7406160d4829bccda314b37d

ps2epsi - reapply fix

Bug #697890 "Bug 689832 still unresolved in master"

The fix for this was applied (contrary to the report in 697890) but it
was later removed as part of the fix for bug #688500.

I presume this was accidental, since 688500 predates 689832, but the
fix was applied later. I don' know how this happened and after 8 years
I don't propose to worry about it.

Just reapply the fix for 689832

lib/ps2epsi.ps


2017-05-12 11:22:55 +0100
Joseph Heenan <joseph@emobix.co.uk>
0feca09fccfa3b45b095f85a9627a89954b03d58

Update URLs in jbig2dec README

jbig2dec/README


2017-05-11 18:23:55 +0100
Robin Watts <robin.watts@artifex.com>
fdd5bef4c19dcc653b07c5cfd3cea4de13aab0f7

Tweak MSVC build flags for profile builds.

Always build with frame pointers enabled, otherwise we get no
stacktraces, which makes the profiles much less useful.

base/msvccmd.mak


2017-05-11 13:30:45 -0600
Henry Stiles <henry.stiles@artifex.com>
ce0dd3907f01e93cc42c1b5e5d18c996cf7822e9

XPS and PXL did not set the scan converter option.

pcl/pxl/pxtop.c
xps/xps.mak
xps/xpstop.c


2017-04-17 16:23:41 -0600
Henry Stiles <henry.stiles@artifex.com>
9cbd475a13e5b0992bb7f8e33d75eb246c1a622d

There is no reason to flush the cache when writing mode changes.

pcl/pxl/pxgstate.c


2017-05-11 16:42:34 +0100
Ken Sharp <ken.sharp@artifex.com>
181ebf1c8c07c5411e98d50cbac86511e0098e4d

PDF interpreter don't warn about Decode for ImaegMasks

An imagemask could result in a warning about Decode arrays being the
wrong length if the current colour space was not DeviceGray.

This commit properly checks to see if the image is an ImageMask and
checks the Decode length is 2.

Resource/Init/pdf_draw.ps


2017-05-11 14:07:48 +0100
Chris Liddell <chris.liddell@artifex.com>
ccfd2c75ac9be4cbd369e4cbdd40ba11a0c7bdad

Bug 697892: fix check for op stack underflow.

In the original fix, I used the wrong method to check for stack underflow, this
is using the correct method.

psi/zfrsd.c
psi/zmisc3.c


2017-05-11 09:57:48 +0100
Chris Liddell <chris.liddell@artifex.com>
31f9fddb4a330c21ea8268fc9e8ae0ead23296bf

Bug 696417: fully initialise TTF bytecode context.

Although the font and CVT programs aren't supposed to use certain opcodes,
specifically, in this case, the opcodes that reference the contents of the
zone pointers. But this font contains programs that do. Since other interpreters
handle this, just ensure we initialize the context fully (so the zone pointers
are valid) before executing the context.

base/ttobjs.c


2017-05-10 18:43:25 +0100
Chris Liddell <chris.liddell@artifex.com>
6839638079bab4dc6f1e9e87e340e98b2e39ba7c

Bug 696421: check for infinite recursion in TTF composite glyph

This font contains a composite glyph that references itself, resulting in
infinite recursion when we try to retrieve the metrics for the glyph.

Add a check for this (trivial) case.

base/gstype42.c


2017-05-10 18:20:38 +0100
Chris Liddell <chris.liddell@artifex.com>
496ebe4757eb630d09589a577738891c1e803707

Bug 696422: bounds check number of points in TTF glyph

There was already a bounds check for the number of points in a TTF glyph
outline contour, to avoid buffer overflow, but it failed to check that the value
was positive. In this case, the value is negative, which caused loops to fail
to exit. This is sufficiently broken, we can only give up and return an error

base/ttfmain.c


2017-05-10 16:33:34 +0100
Chris Liddell <chris.liddell@artifex.com>
85cd173e3ceeb638a2b035e057a0497f10547978

Bug 694150(2): Ensure lzw state is fully intialized.

valgrind identified an issue where the OldTiff flag in the lzw state wasn't
initialized. Although not evident in this case, it was possible for other fields
to also not be set. So, initialize the state fully before using it.

psi/zfdecode.c


2017-05-10 17:50:39 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
ed6c5133a1004ce8d38f1b44de85a7186feda95e

Bug 697683: Bounds check before reading from image source data.

Add extra check to prevent reading off the end of the image source
data buffer.

Thank you to Dai Ge for finding this issue and suggesting a patch.

jbig2dec/jbig2_image.c


2017-05-10 15:34:35 +0100
Robin Watts <robin.watts@artifex.com>
1a624d1bfa1e63ceab87f5e4e22c3daffa2d0f01

Bug 697811 (continued): Fix the other 3 equivalent cases.

Followup from the previous commit, applying the same fix to the
other 3 cases.

base/gxscanc.c


2017-05-10 15:18:34 +0100
Robin Watts <robin.watts@artifex.com>
210893fb2b271717957fcca4e6c049494024cc9d

Bug 697847: Fix SEGV seen in scan converter.

Previously the scan converter had had problems with extremely
large/small values over/underflowing during bezier subdivision.

We'd fixed this by calling into a "_big" variant of the
subdivision routine that sacrificed accuracy in the bottom bit.

Unfortunately, this can cause 'jitter' in the low bits of the
subdivided curves, which can cause scanlines to be crossed
repeatedly. Once a single curve can cross a given scanline
more times than expected, our buffer allocation is too small
and we get crashes such as the one seen here.

The fix is to move to using 64bit accuracy in the _big variant
and thus not introduce the jitter.

base/gxscanc.c


2017-05-10 11:13:04 +0100
Robin Watts <Robin.Watts@artifex.com>
b38f2cb37b7bf469b36ac52b62c4aab6ccf55b6b

Bug 697813: Fix integer overflow leading to buffer overflow.

When calculating the amount of space required for a buffer, we
were using an int. This would overflow, meaning we'd allocate
less than we needed, and then segmentation fault when we overran
the end.

Fix is to count the space required in an int64_t, and check that
that actually fits into a uint (the type passed to the allocation
function) before allocating.

Side note: Surely gs should be using size_t's rather than uints
for its allocation calls?

Also, our error cleanup was freeing the wrong thing. Fix that too.

base/gxscanc.c


2017-05-05 13:25:08 -0700
Michael Vrhel <michael.vrhel@artifex.com>
0bccbb7bc00ffaeee7785544aa796c315f4b579f

Bug 697861 Avoid push of text transparency group when no text is drawn

The text can be handed to the pdf14 device text_begin operation with a graphic
state that has a null device. This occurs when the text state was
set to do no stroke or fill, only movements. In such a case we
don't want to do the text group push until we actually have some
text to draw.

base/gdevp14.c


2017-05-08 16:08:46 +0100
Ken Sharp <ken.sharp@artifex.com>
ab78fab575a8d699aeec7ca37fecff66413cb93b

Ensure FAPI server is present in base font in .FAPIBuildChar

The code used 'I', the FAPI server retrieved from the font dictionary,
without checking to see if it was NULL.

Prevents a seg fault

psi/zfapi.c


2017-05-08 12:16:16 +0100
Ken Sharp <ken.sharp@artifex.com>
24133e312b7824ad1b5bc7701039b34b800b7062

remove #if TEST sections

This code seems to be no longer used, it wasn't compiled and
I can't see a justification to retain it.

base/gscencs.c
psi/zfdcte.c
psi/zfunc.c


2017-05-08 11:48:42 +0100
Ken Sharp <ken.sharp@artifex.com>
2ef1ae95e0b0c7f24a246868dd26339bb5db7160

remove smtf.c, zrop.c, zdosio.c and zfilterx.c from all builds

Some of these were included in some builds, none of the content is
believed to be still useful.

Update the Windows projects to reflect the file deletions

Update develop.htm to also reflect the file removal

Makefile.in
base/smtf.c
base/unix-gcc.mak
doc/Develop.htm
psi/int.mak
psi/os2.mak
psi/zcidtest.c
psi/zdosio.c
psi/zfilterx.c
psi/zrop.c
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2017-05-06 09:26:16 +0100
Ken Sharp <ken.sharp@artifex.com>
f11cb093563ace8c4b831bcb97caff951474e380

Remove some old colour test code and associated operators

psi/zcolor.c


2017-05-06 09:09:54 +0100
Ken Sharp <ken.sharp@artifex.com>
4ee490955006dda75797468ba1a69a71867c8cdb

Delete the unused source file zcsdevn.c from the PostScript interpreter

Remove the reference from the Windows VS projects

Remove the reference in develop.htm

doc/Develop.htm
psi/zcsdevn.c
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2017-05-05 15:38:19 +0100
Ken Sharp <ken.sharp@artifex.com>
ff2243aae6d34e395f0d5cbac93689df7069c09c

Bug 697859 - unchecked operand in .repeatform can cause seg fault

Check that the second operand is a dictionary before we try to use it.

psi/zform.c


2017-05-03 22:06:01 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
b184e783702246e154294326d03d9abda669fcfa

Bug 697703: Prevent integer overflow vulnerability.

Add extra check for the offset being greater than the size
of the image and hence reading off the end of the buffer.

Thank you to Dai Ge for finding this issue and suggesting a patch.

jbig2dec/jbig2_symbol_dict.c


2017-05-04 15:50:46 +0100
Ken Sharp <ken.sharp@artifex.com>
e24e6194ca59d7b556116451490f71d2d85f4642

Bug 697854 - unchecked operand in .seticcspace can cause seg fault

This operator hasn't been used since (I think) the release of 9.0. To
prevent this problem, remove it totally.

psi/zicc.c


2017-05-04 15:13:10 +0100
Ken Sharp <ken.sharp@artifex.com>
956becf97c69ccb2542a37c9a6421159dfe58e4e

Bug 697853 - unchecked operands in .begintransparencymaskgroup

The operator .begintransparencymaskgroup didn't check the type (or
indeed existence) of its 5th parameter. Because this a boolean it
wouldn't have caused an actual problem, but nor would it have correctly
signalled a stackunderflow or typecheck error. Also, we should always
validate the operands.

psi/ztrans.c


2017-05-04 14:16:09 +0100
Chris Liddell <chris.liddell@artifex.com>
59ef159e4c42c84c72130c14825f9517ef53cc16

Extend annotation type control for pdfwrite

The original solution to control the drawing of annotations based on the
annotation type only worked for output devices that do not preserve things
like annotations (i.e. only non-pdfwrite devices).

This applies the filtering to also work with pdfwrite.

Resource/Init/pdf_draw.ps


2017-05-04 14:26:25 +0100
Ken Sharp <ken.sharp@artifex.com>
88667cf67d3a435bc3ba727ab173c77666c8a1bb

Bug 697850 - .getdeviceparms doesn't check operands

This is actually benign because the unchecked parameter is used as an
argument to stack_param_list_write() which simply ignores it if the
type is incorrect. However, its possible we might change this at some
point, I think its best to check the type.

psi/zdevice.c


2017-05-04 13:42:37 +0100
Ken Sharp <ken.sharp@artifex.com>
37f9ba12dad303edca41ef166dd5b8815fb31763

Bug 697848 - .type42execchar doesn't validate parameters

The code made quite a has of parameter validation, it did validate some
parameters, but not very coherently.

psi/zchar42.c


2017-05-04 12:08:02 +0100
Ken Sharp <ken.sharp@artifex.com>
478800857dfc06b0d2d363dd1ef916dbdda061ed

Correct function /Domain array checks

Bug #697858 "Function Domain validation incorrect"

The PDF and PostScript specifications state that the entries in a Domain
array for a function must be such that Domain2i <= Domain2i+1

However the code in fn_build_sub_function() inverted the sense by
checking if Domain2i >= Domain2i+1 and throwing an error if so. This is
of course incorrect for the case where Domain2i == Domain2i+1, this
should not be an error, but the code treated it as an error.

psi/zfunc.c


2017-05-03 12:05:45 +0100
Chris Liddell <chris.liddell@artifex.com>
57f20719e1cfaea77b67cb26e26de7fe4d7f9b2e

Bug 697846: revision to commit 4f83478c88 (.eqproc)

When using the "DELAYBIND" feature, it turns out that .eqproc can be called with
parameters that are not both procedures. In this case, it turns out, the
expectation is for the operator to return 'false', rather than throw an error.

psi/zmisc3.c


2017-05-03 11:47:35 +0100
Chris Liddell <chris.liddell@artifex.com>
2a619d16d86348805b1732fb1e21c88dd00374fd

Add finer control of PDF annotation drawing.

Add the ability to define an array of annotation types that gs should draw,
and ignore the others. On the command line, you'd add:
-c "/ShowAnnotTypes [.....]" -f <input file>

Where the array can contain one or more of:
/Stamp
/Squiggly
/Underline
/Link
/Text
/Highlight
/Ink
/FreeText
/StrikeOut
/stamp_dict

Resource/Init/pdf_draw.ps
doc/Use.htm


2017-04-26 22:12:14 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
5e57e483298dae8b8d4ec9aab37a526736ac2e97

Bug 697693: Prevent SEGV due to integer overflow.

While building a Huffman table, the start and end points were susceptible
to integer overflow.

Thank you to Jiaqi for finding this issue and suggesting a patch.

jbig2dec/jbig2_huffman.c


2017-04-27 13:21:31 +0100
Chris Liddell <chris.liddell@artifex.com>
04b37bbce174eed24edec7ad5b920eb93db4d47d

Bug 697799: have .rsdparams check its parameters

The Ghostscript internal operator .rsdparams wasn't checking the number or
type of the operands it was being passed. Do so.

psi/zfrsd.c


2017-04-27 13:03:33 +0100
Chris Liddell <chris.liddell@artifex.com>
4f83478c88c2e05d6e8d79ca4557eb039354d2f3

Bug 697799: have .eqproc check its parameters

The Ghostscript custom operator .eqproc was not check the number or type of
the parameters it was given.

psi/zmisc3.c


2017-04-27 12:34:19 +0100
Chris Liddell <chris.liddell@artifex.com>
5603e8fc3e59c435318877efe627967ee6baebb8

Bug 697769: cmap tab for symbolic fonts, and format 4 cmap parsing

This involved two problems:
Firstly, the logic of whether to treat a font flagged as symbolic *really*
as symbolic was missing a condition. It appears that as well as checking for
a symbolic (3.0) cmap table, we also need to check for a UCS-2 (3.1) cmap
table.

As noted before, this area is poorly documented in the spec, so it is possible
further issues may arise.

Secondly, the fonts in the test file are, in fact, invalid. Each using a format
4 segmented cmap table with only one, non-terminal, segment. According to the
TTF spec, a format 4 table should have a terminating segment whose start and
end codes are 0xffff. These fonts do not have such a segment. As it happens,
we ignore the terminal segment anyway, so by simply tweaking the loop
condition, we can parse the one segment, and retrieve a usable cmap.

Resource/Init/gs_ttf.ps


2017-04-27 12:28:42 +0100
Chris Liddell <chris.liddell@artifex.com>
05d0bbc50ad453990520ed2d2ded3ace538bcb1d

Change TTF cmap procedure name and tidy up

The procedure for parsing the TTF cmap table was called "cmaparray", but it
has returned a dictionary rather than an array for a *long* time. So change
the procedure name to "cmapdict".

In the format 4 cmap parsing, left over from when we did return an array, we
looped over the codes, counting as we go, so we could allocate an array large
enough to hold all the mappings, then looped over them again to fill in the
array.

As we now use a dictionary, there is no need to pre-count, so the first
loop was redundant - remove it.

Resource/Init/gs_ttf.ps


2017-04-20 09:54:44 +0100
Chris Liddell <chris.liddell@artifex.com>
e589d67461e7e522c8af6cb9cc61064018b6a4fc

Bug 696379: Handle error correctly in font with CDevProc

In event of a Type 1 charstring font throwing an error setting up for a
CDevProc, ensure we use the correct path to exit the function, doing the
required cleanup along the way.

psi/zchar.c


2017-04-19 16:20:49 +0100
Chris Liddell <chris.liddell@artifex.com>
7e78f3a285bb41a6d3a33d608c6ba9d00b9cd107

Ensure gs is sufficiently inited before using PS memory

Spotted by accident: having "-o" first in the command line can cause a
segfault

psi/imainarg.c


2017-04-06 22:10:30 +0100
Chris Liddell <chris.liddell@artifex.com>
88fc69e9bf5bfc73ce906c038b09bc8055dabe96

Bug 697722: Skip glyph cache with vertical substitution

The way PXL implements vertical glyph substitution means it defeats our glyph
cache logic - the cache doesn't have the information to differentiate between
a vertical substitute and a regular glyph.

As this is a very rarely used feature, the simplest solution is to disable use
of the cache when vertical substitutes are in force - it will neither lookup
existing, nor add new glyph instances to the cache.

If we start seeing more jobs using vertical glyph substitution, and this proves
to be a performance bottleneck, we can revisit this and add the required data
for the cache to handle these (and possibly other) cases.

pcl/pxl/pxfont.c


2017-04-25 21:05:27 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
7f5fb63f7f2ef5ff3f234e0653412d8f4a439c0d

Bug 694150 : Fix SEGV in s_LZWD_process.

Prevent using prev_code < 0 which would make an entry before the table.
This in turn means that when a length of 4 is decoded, the decoder fails
to find the eod and continues to write off the end of the memory segment.

base/slzwd.c


2017-04-26 16:12:10 +0100
Ken Sharp <ken.sharp@artifex.com>
1d2ba380aaa4df253bb6a1237f136ab4984657bd

PDF interpreter - Apply /Widths to illegal (empty) type 3 CharProcs

Bug #697805 "Incorrect spacing between text"

The file (created by the Skia graphics library) embeds all the fonts as
type 3, the CharProc for the space glyph is embedded as an empty stream:

17 0 obj
<<
/Length 0
>>
stream
endstream
endobj

The specification does not say what should happen if the /Width entry
is not the same as the actual width in the glyph description, but we
choose to use the /Width, because from prior experience we know that's
what Acrobat does.

However, this glyph is illegal, because it contains neither a d0 nor a d1
operator. We apply the Widths override when executing d0 or d1, so if
the (required) operator is not present in the glyph description we
cannot override it.

In this commit we detect a 0 length stream and treat it the same as a
missing stream; we execute a dummy d1 which enables us to do the
Widths override.

Resource/Init/pdf_font.ps


2017-04-26 10:20:12 +0100
Ken Sharp <ken.sharp@artifex.com>
d648ec8c6935387d485b1d9be56e2d147109616f

(e)ps2write - add definition of MacRoman Encoding

Bug #697733, follow on from commit c90836f3782ce8e8f3076cb8b50503cfe91dabcf

The previous commit altered to using MacRoman Encoding for embedded,
subset TrueType fonts, because we prefer the 1,0 CMAP subtable from
such fonts. However, MacRoman is not a standard Encoding for PostScript
interpreters. Add it here.

devices/vector/opdfread.ps


2017-04-25 17:08:26 +0100
Ken Sharp <ken.sharp@artifex.com>
8556b698892e4706aa0b9d996bec82fed645eaa5

PS interpreter - remove superexec from systemdict

This looks like bit rot, superexec was meant to have been undefined from
systemdict, and moved to internaldict, but the code only executed if
superexec was defined in the current dictionary. It seems that at some
time in the past the order of execution was changed in such a way that
the current dictionary at that point was no longer systemdict.

So instead of checking currentdict, explicitly check systemdict.

This means changing our gs_cet.ps file which we use for the Quality
Logic CET (Command Emulation Test) suite so that it can find superexec
and use it to set up our environment in a specific fashion, to prevent
spurious differences when running the tests.

If sueperexec isn't available when we run the CET tests we'll get an
error, which sounds like a good idea, hopefully we'll notice that.

Resource/Init/gs_cet.ps
Resource/Init/gs_init.ps


2017-04-25 13:38:33 +0100
Ken Sharp <ken.sharp@artifex.com>
31cb597dbbff0a6aebe48469568837e2844cdfdc

A better DSC Parser fix for bug #697800

Commit 06d283c4a20fe7ec727bebb56404242734ea2d70 checked the number of
operands, but this is a better fix, since it also correctly checks the
type of the dictionary operand, which the previous fix didn't do.

psi/zdscpars.c


2017-04-25 13:03:22 +0100
Ken Sharp <ken.sharp@artifex.com>
06d283c4a20fe7ec727bebb56404242734ea2d70

DSC parser - check number of operands supplied

Bug 697800 "Null pointer dereference in zparse_dsc_comments()"

The custom operator .parse_dsc_comments wasn't checking the number of
operands supplied, before attempting to validate them. If not enough
were supplied it ended up falling off the bottom of the operand stack.

Generate a stackunderflow error when this happens.

psi/zdscpars.c


2017-04-24 12:01:53 +0100
Ken Sharp <ken.sharp@artifex.com>
db4cb499fbc3c87b2b0182e550c82eb3c93fc1b4

PS interpreter - restore correct error behaviour for invalid /Decode arrays

PDF interpreter - trim excessively long Decode arrays to the correct length

Bug #697787 " regression, several EPS figures which work fine with gs <= 9.07 throw Error with gs > 9.08"

commit 89c224b029357002c48660dae98de2d1e560d4e0 was applied to fix
bug #694276, and the fix was, I'm afraid, incorrect.

The bug in question was a PDF file where the /Decode array was too long
(by 1 entry) for the actual colour space. This caused the PostScript
interpreter to (correctly) throw an error. Ray fixed this by altering
the PostScript interpreter so that it did not throw an error when the
Decode array was too long, but instead used the requisite number of
elements.

This is not correct, the PostScirpt interpreter should throw an error.

The file attached to this report is an EPS file which relies (horribly)
on getting an error when the Deocde array is too long for an image, and
uses that to call colorimage instead.

By not throwing an error we treat the image as being in DeviceGray and,
since the data is actually RGB, only read 1/3 of the image data. We then
attempt to carry on from that point and throw real errors due to reading
from the middle of a data string.

This commit reverts (significant) the changes in commit
89c224b029357002c48660dae98de2d1e560d4e0. It also addresses the 'bug'
in report #694726 by shifting the checking to the PDF interpreter and
having that correctly set the decode array.

Resource/Init/pdf_draw.ps
psi/idparam.c
psi/zimage.c


2017-03-28 09:22:23 -0700
Ray Johnston <ray.johnston@artifex.com>
5fa7596d8d467e98fbc069d11b7a3769f7d024f0

More fixes for tag plane problems.

tests_private/comparefiles/Altona_Technical_v20_x4.pdf Page 7 had a
problem in blending when nos_knockout was true that ignored the tag.

This also showed up cases where the alt_dev_color was not updated with
the tag (e.g. tests_private/comparefiles/0000728-simpleNG.pdf).

Another difference that tests_private/comparefiles/Bug689761.pdf shows
is that "gsave fill grestore stroke" reverts the dev_color with grestore,
but doesn't change the dev->graphics_type_tag. Keep the tag in the
dev_color structure so that we know if the dev_color needs unset.

Fix the ensure_tag_is_set inline function to make sure BOTH the device's
graphics_type_tag AND the dev_color.tag are set correctly.

We need to write and read the pattern tag plane for raster patterns with
transparency. Seen with tests_private/comparefiles/Bug689422.pdf

Lastly, the ensure_tag_is_set in gs_shfill needs to happen before the
remap_color (since it may unset the dev_color if the tag was different).

base/gdevdsha.c
base/gdevp14.c
base/gscolor3.c
base/gsdcolor.h
base/gsdevice.c
base/gsht.c
base/gsptype1.c
base/gxblend1.c
base/gxdcolor.h
base/gxgstate.h
base/gxp1fill.c
base/gxpcmap.c
base/gxpcolor.h
base/lib.mak


2017-04-18 09:38:17 -0700
Ray Johnston <ray.johnston@artifex.com>
35a5977484afecae01afc92f5018709feba6bc91

gs_fillpage should set the tag to UNTOUCHED, not PATH.

This produces tag plane differences in areas that have transparency
that are painted (touched) in a transparency group since the page level
buffer will now have tag UNTOUCHED == 0 instead of PATH, so areas that
were PATH+TEXT or PATH+IMAGE can become just TEXT or IMAGE (which is
correct).

base/gspaint.c


2017-04-10 12:23:00 -0700
Ray Johnston <ray.johnston@artifex.com>
82ec3b5eef0a530666044dc94b6ba94ed9aa15b6

Set color_info separable_and_linear for bitrgbtags device.

Since this device is separable and linear, we can skip the testing in
check_device_separable and check_device_compatible_encoding. We can
safely set GX_CINFO_SEP_LIN_STANDARD since the low (color) bits are
compatible with the pdf14_encode_color_tag.

This shows up many shading differences since the device was being
(incorrectly) classified as SEP_LIN_UNKNOWN which would then flatten
color patches and use fill_trapezoid rather than the preferred
fill_linear_color_trapezoid (the latter writes less data to the
clist).

devices/gdevbit.c


2017-04-20 14:34:43 -0400
Steve Phillips <steve.phillips@artifex.com>
59c7840aea41253d274d9037b637e60c38359f9f

Auto-generate opdfread.h from opdfread.ps during the build using packps tool

This commit implements a new packps tool which converts PostScript files
to packed arrays of C strings, providing a method to compile PostScript
code directly into the executable. Using this tool, the opdfread.h
file is now derived from devices/vector/opdfread.ps.

- The packps utility is built from the new file base/pack_ps.c.
- opdfread.ps has been moved from lib to /devices/vector. This is
now the reference file for the opdfread header procset code.
- opdfread.h has been removed from /devices/vector and is now built
within the DEVGEN directory as part of the make process.
- For Windows builds, a stale file reference to Resource\Init\opdfread.ps
has been removed from the project file. Additionally, a file reference
to opdfread.ps has been added to the /devices/vector source list, and
the reference to opdfread.h has been removed from the header file list.

base/gs.mak
base/msvctail.mak
base/pack_ps.c
base/unix-aux.mak
base/unix-end.mak
devices/devs.mak
devices/vector/opdfread.h
devices/vector/opdfread.ps
windows/ghostscript.vcproj


2017-04-20 13:42:31 -0400
Steve Phillips <steve.phillips@artifex.com>
7daa44b70e213e704e0da53032a89bf56ff07e0a

Reconcile differences between opdfread.h and opdfread.ps

This change reconciles all differences between devices/vector/opdfread.h
and lib/opdfread.ps so that they contain exactly the same PostScript code,
other than whitespace differences and comments. The opdfread.h file was
originally created through a one-time conversion of opdfread.ps to an array
of C strings, and opdfread.h is currently used as the reference code for
source builds. These two files have diverged slightly over time, so the
unused code in opdfread.ps was no longer up-to-date.

In this commit, all differences between these two files have been reconciled
so that either the header file or the PostScript version can be used as the
reference copy. A subsequent commit will add a tool to derive opdfread.h
from opdfread.ps during the build process, which will use opdfread.ps as
the master copy instead. This commit ensures that this tool change will
not introduce any functional differences in the generated header file.

For ease of comparison, all whitespace-only changes (removing spaces and
moving code to different lines) have been made in opdfread.h, so there are
no functional changes to this module.

The changes to opdfread.ps resolve all remaining functional differences,
with opdfread.h used as the reference source for any changes.

With these changes, the new packps tool converts opdfread.ps to a C
file which matches opdfread.h exactly, other than the header comments
at the top of the file.

devices/vector/opdfread.h
lib/opdfread.ps


2017-04-20 13:57:21 +0100
Robin Watts <robin.watts@artifex.com>
18174668ea815c7830841a511f1dc850557772a9

Scan converter: Remove 2 outdated asserts.

base/gxscanc.c


2017-04-20 12:31:22 +0100
Robin Watts <robin.watts@artifex.com>
53c1849dabf14941bc191506b6feaf2d6f7817cb

Add missing braces in scan converter code.

The lack of these could cause memory overwrites when
DEBUG_SCAN_CONVERTER was enabled.

base/gxscanc.c


2017-04-20 11:57:14 +0100
Ken Sharp <ken.sharp@artifex.com>
13b97d2c1b4c8a819e0682047d044f9308a56174

Initialise path bounding boxes.

Bug #697770 "Inconsistent behaviour"

The problem is that gx_path_init_bbox_accumulator() sets bbox_accurate
which is later used to signal that the attached bbox is valid and
accurate.

But we don't actually initialise the bbox member at all, in the bug in
question the glyph has no contours, so creates no path, leaving the
bbox uninitialised. But because we have set bbox_accurate we just
copy the values when determining the font bounding box, leading to
insane values.

Initialising the bbox gives more reasonable results.

base/gxpath.c


2017-04-19 12:06:39 +0100
Robin Watts <robin.watts@artifex.com>
8210a2864372723b49c526e2b102fdc00c9c4699

Bug 697762: Fix scan converter SEGVs.

The SEGVs are caused by the scan converter allowing less room
in the table than is actually required. This happens due to
the mark_curve subdivision overflowing.

For example, if we have a curve such as:

0 0x80000000 moveto
0 0x80000000 0 0x80000000 0 0x80000000 curveto

Then the current subdivision logic does:

fixed ay = (sy + c1y)>>1

For sy = c1y = 0x80000000 this gives ay = 0, when clearly
the average should be 0x80000000.

An alternative formulation of the splitting code:

fixed ay = (sy>>1) + (c1y>>1)

gives the required result, at the expense of dropping accuracy at
the low end.

This commit therefore has 2 formulations of the splitting code, one
for 'big' values (values that might overflow), and ones for normal
values (values that won't).

We select between the two pieces of code by comparing the top 2
bits of each value; if they differ, then we use the big variant.

Also, when calculating the size of the table required, we were
incorrectly closing the curve more often than we needed to. This
had no ill effect other than inflating the amount of memory we
needed.

base/gxscanc.c


2017-04-18 12:37:21 +0100
Ken Sharp <ken.sharp@artifex.com>
0f598a2c56f2ccec4ecf67f8f585a340b04057ef

PDF interpreter - detect missing 'endobj' on final object in file

Bug #697761 " Broken PDF (missing endobj on final object) causes error"

The sample file has the final two objects (Info and Catalog dictionaries)
written with missing 'endobj' Our normal processing catches that in the
body of the file, but if its the final object, then we carried on and
tried to process the entire trailer and xref.

Add 'xref' to the entries in resolveopdict and treat it as a missing
endobj. While we're here, add an error message for the case of detecting
an 'obj' when resolving an object. We already handle that, but we
weren't producing an error for it.

Resource/Init/pdf_base.ps


2017-04-17 15:41:11 +0100
Robin Watts <robin.watts@artifex.com>
3e7e5272faf866419473a7c8e0149028bdfb4add

MSVC: Fix x64 'All' configuration.

windows/GhostPDL.sln


2017-04-15 14:33:08 +0100
Ken Sharp <ken.sharp@artifex.com>
43ed8ae1ce7e254866d443176e48c9ca6787db35

subclassing devices - process the graphics_type_tag into all chained devices

The tag devices encode the type of operation into the device color, if
the devices graphics_type_tag has the GS_DEVICE_ENCODES_TAGS bit set.

The specific tag is maintained by altering the graphics_type_tag in the
device structure using a device method (set_graphics_type_tag). However,
when checking to see if the tag needs to change (for a different marking
operation type), the code does not, as might be expected, use a
symmetric device method such as get_graphics_type_tag. It was felt that
the performance impact would be unacceptable. Instead the
graphics_type_tag of the *current* device in the graphics state is
inspected directly from the structure.

This means that every device chaining method (and there are several,
see ghostpdl/doc/subclass.htm) needs to ensure that every device in
the chain sets its graphics_type_tag in the device structure, *and*
passes that on to any underlying devices.

Apparently the 'forwarding' devices already do this, I presume the clist
and transparency compositors do as well, I haven't checked. The obselete
'device filter chain' does not, the subclassing devices did not either.

Its also important (for pattern colour spaces) that we track the tag
even when we are not actually rendering.

So here we remove the code from the First/Last page device which skipped
tags on elided pages. This means the device can instead use the standard
subclassing default method.

In the standard subclassing default method we now update the tag on the
current device in the chain before passing it on to the next device.
This means that all devices in the chain now track the tag. An important
note for any subclassing devices which implement a set_graphics_type_tag
method is that it must set the tag in its device structure. So we document
that as well.

base/gdevflp.c
base/gdevsclass.c
doc/subclass.htm


2017-04-14 14:19:53 -0700
Michael Vrhel <michael.vrhel@artifex.com>
22d8a2653ae532c7c23aa9a441e6c120edd9bdef

Add back icc support for PNG output

When the png library was updated, the embedded ICC profile
was no longer getting written. This fixes the issue as
well as fixes a minor issue in our setting of D50 in the
resource ICC profiles which prompted a warning from the
PNG library.

devices/gdevpng.c
iccprofiles/default_cmyk.icc
iccprofiles/default_rgb.icc
iccprofiles/gray_to_k.icc
iccprofiles/lab.icc
iccprofiles/ps_cmyk.icc
iccprofiles/ps_gray.icc
iccprofiles/ps_rgb.icc
iccprofiles/srgb.icc


2017-04-13 16:01:02 +0100
Ken Sharp <ken.sharp@artifex.com>
6d65aaa8af3a9f56c1828e7943c6e1c8b93cf614

PCL - remove the 'bias' from glyph indices before use, if present

Bug #697744 "Accents not handled correctly"

In plfont.c, pl_glyph_name, we use the 'glyph' (which is of type
gs_glyph) as an index to retrieve a glyph name from a TrueType font.

However, as per the documentation in gsccode.h, if the glyph is truly
an index (as opposed to a name) then it is biased by GS_MIN_GLYPH_INDEX
which means that attempting to use it directly as an index into the font
fails, and returns no name.

This causes pdfwrite multiple problems; firstly it causes the original
glyph to be rendered as a bitmap. Then, because the glyph is a composite
glyph (its made up of two or more other glyphs) subsequent uses of the
same glyph cause it to become confused, and use the initail component
glyph.

This can be easily resolved simply by testing to see if the glyph is
biased by GS_MIN_GLYPH_INDEX and, if it is, removing the bias.

In addition to fixing the reported problem a number of test suite files
show progressions (accents now present) and small but useful quality
improvements (glyphs no longer rendered as bitmaps) as well as being
able to properly extract text from either the PCL or the output PDF file.

pcl/pl/plfont.c


2017-04-12 16:02:33 +0100
Ken Sharp <ken.sharp@artifex.com>
c90836f3782ce8e8f3076cb8b50503cfe91dabcf

(e)ps2write - use correct encoding for subset TrueType fonts

Bug #697733 "Character section is not handled with eps2write"

We carry around a 'base encoding' with fonts, which is generally the
encoding of the original font, potentially 'refined' to a more useful
encoding if its originally one we can't use.

For TrueType fonts, we would either Standard or ISOLatin1, and in fact
almost always StandardEncoding.

The problem is that if we are subsetting the font, then we *don't* embed
the original font's CMAP subtable, we generate a new pair, one of Windows
Unicode (3,1) and one of Mac Roman (1,0). Neither is suitable for use
with StandrdEncoding and in fact the opdfread code will always use the
MacRoman Encoding.

This can lead to a problem if the same glyph name is encoded in one or
other Encodings, and is either missing or in a in a different position
in the other.

When we encode the string we will use StandardEncoding, and the opdfread
code will read the character codes using MacRoman Encoding, so the
Charstrings dictionary will be incorrectly constructed and glyphs will
either become notdef or potentially use the wrong glyph.

To fix it; if we have a TrueType font, and are subsetting it, select
a Base Encoding of MacRoman. Update the refine_encoding procedure to
permit a TrueType fotn to have MacRoman encoding.

This shows a minor progression in one file in the test suite;
Bug691848.ps, surprisingly with Kanji text.....

devices/vector/gdevpdtt.c


2017-04-11 14:55:26 -0700
Ray Johnston <ray.johnston@artifex.com>
e90c8f5a93e274b02b7e25762ef83995455f8464

Yet another fix for tag handling that affects shading fills and pdf14

The comp_shift that is relied upon for color generation in fill_linear
color_scanline did not work because the comp_shift[num_components] was
not set for the pdf14 device when the device "has_tags".

Also fix a bunch of whitespace variances.

base/gdevp14.c


2017-04-07 18:39:58 +0100
Robin Watts <robin.watts@artifex.com>
ba92812e5a25c3c1f8d13c79e584398d2250b72a

Scan Converter: Speed tweak to sorting.

When sorting the intersects on a scanline, if the list is short
use inline sort code, rather than calling qsort. This is a big
saving in runtime, presumably due to function call overhead.

This reduces the bug 697678 time from 40 seconds to 35.

base/gxscanc.c


2017-04-10 18:10:32 +0100
Robin Watts <robin.watts@artifex.com>
31aefb5777a72c54363685498c07f2cd00867525

Scan converter: Simplify edgecmp comparison.

It *shouldn't* matter the order we treat up/down edges in,
therefore, it shouldn't matter if we alter our sort routine
to actually care about the bottom bits. This results in
simpler (and hence, hopefully, faster) code.

base/gxscanc.c


2017-04-07 18:15:21 +0100
Robin Watts <robin.watts@artifex.com>
9eb97696875fb97b08321aba009c14419a4feeba

Tweak make_table for speed.

base/gxscanc.c


2017-04-10 18:47:43 +0100
Robin Watts <robin.watts@artifex.com>
81385210e0d484050ee6ed7898b03ebcc5105ba1

Scan converter: Fix double written pixels

The any part of a pixel (non trap) code could occasionally double
write some pixels. Fixed here.

base/gxscanc.c


2017-04-10 18:09:07 +0100
Robin Watts <robin.watts@artifex.com>
bc739b046c0490e5ab941ef2942eadac37a2ce13

Squash a float <-> double warning.

base/gxiscale.c


2017-04-10 18:05:44 +0100
Robin Watts <robin.watts@artifex.com>
e16d0c760651b973d5a750524cf9e69df8601256

MSVC: Profile builds. Ensure linker optimisations are enabled

/DEBUG disables optimisations, so add /OPT:REF and /OPT:ICF to
reenable them.

base/msvccmd.mak


2017-04-07 18:06:15 +0100
Chris Liddell <chris.liddell@artifex.com>
74f9d86d60c8ded49d0df2c23bec2d68fea1f6b5

Revert "gs_malloc_memory_t: change type of limit/used/max_used"

This reverts commit 47417a5cbfbfa3d7bb9ee387909246cdd265d4ff.

Until I can debug the errors is causes on Windows.

base/gsalloc.c
base/gsmalloc.c
base/gsmalloc.h


2017-04-07 15:09:29 +0100
Robin Watts <robin.watts@artifex.com>
1cd00def041e82e66e2ea12a153801552b64246e

Squash warning.

./base/gsfont.c:1006:12: warning: overflow in implicit constant conversion [-Woverflow]

base/gsfont.c


2017-04-07 13:15:46 +0100
Robin Watts <robin.watts@artifex.com>
9eae07a45a76f8944d7fbfe1fb4546f473fcf400

Further scan converter work inspired by Bug 697678

This applies the same changes done for the any-part-of-a-pixel,
trapezoid case to the any-part-of-a-pixel non-trapezoid case.

base/gxscanc.c


2017-04-05 17:56:14 +0100
Robin Watts <robin.watts@artifex.com>
f158bfa0346833ac2181bc66709cfabff1a12afc

Further work inspired by Bug 697678

Apply the same speedups for vertically clipped paths as have already
been done for the any-part-of-a-pixel, trapezoid case to the
centre-of-a-pixel cases.

The any-part-of-a-pixel, non-trapezoid case remains to be done.

base/gxscanc.c


2017-04-06 08:46:20 -0700
Michael Vrhel <michael.vrhel@artifex.com>
ee57023920599a2209e5e0b7eded2ae9c2002e19

Fix error in color updating

Ray found an issue that would appear to cause problems when we have
transparency and spot colors for the separations devices.
The mask and shift values in color info were not getting set properly
for the spot colors in this case. It is not a real issue
due to the way that the separation device colors are
stored in the devn hl color (planar) but is good to fix
to avoid confusion.

base/gdevp14.c


2017-04-04 14:43:05 +0100
Chris Liddell <chris.liddell@artifex.com>
47417a5cbfbfa3d7bb9ee387909246cdd265d4ff

gs_malloc_memory_t: change type of limit/used/max_used

The limit, used and max_used values in gs_malloc_memory_t were type ulong,
giving rise to differences between LP64 systems (Unix-like) and LLP64 systems
(MS Windows).

So, make them uint64_t for consistency across platforms.

base/gsalloc.c
base/gsmalloc.c
base/gsmalloc.h


2017-04-06 16:44:54 +0100
Chris Liddell <chris.liddell@artifex.com>
bfa6b2ecbe48edc69a7d9d22a12419aed25960b8

Bug 697548: use the correct param list enumerator

When we encountered dictionary in a ref_param_list, we were using the enumerator
for the "parent" param_list, rather than the enumerator for the param_list
we just created for the dictionary. That parent was usually the stack
list enumerator, and caused a segfault.

Using the correct enumerator works better.

psi/iparam.c


2017-03-31 13:36:03 -0700
Ray Johnston <ray.johnston@artifex.com>
063416192c169889ef0b227aab5d912f71640590

Fix gx_default_fill_linear_color_scanline to handle tags.

The fill_linear_color_scanline would calculate linear and separable colors
based on the num_components, which does not include the tags, leaving the
tag value set to 0 (GS_UNTOUCHED_TAG). If the device does need tags
(GS_DEVICE_ENCODES_TAGS set) then set the tag value using the last comp_shift
to GS_PATH_TAG. Seen with Ghent_V5.0/GWG010_CMYK_OP_x3.pdf and the
bitrgbtags device in clist mode.

base/gdevdsha.c
base/gxdevcli.h
devices/gdevbit.c


2017-04-05 11:42:30 +0100
Robin Watts <robin.watts@artifex.com>
9c711b79f1230cbbd346d1cbf7e9bcaa701d2e4c

Scan converter optimisations

Optimise unneeded writes when updating the cursor.

base/gxscanc.c


2017-04-05 12:28:20 +0100
Robin Watts <robin.watts@artifex.com>
d90f7b0782b74201cbca8e40e02800453a48a873

Attempt to fix warning.

./base/gsccode.h:29:20: warning: overflow in implicit constant conversion

base/gsccode.h


2017-04-05 10:38:16 +0100
Robin Watts <robin.watts@artifex.com>
25c8f788cf15829adb5f1e3292f46f9ca9a1c329

Fix scan converter issues.

Commit edba51f ("Bug 697678: Scan converter performance (out of
range lines)." caused 3 SEGVs in the normal tests, but caused
many many more in the overnights.

This commit fixes those. The problems were due to edge effects
on the top/bottom of the edgebuffers, due to differences in
the logic for rising/falling lines.

base/gxscanc.c


2017-03-29 11:08:03 -0700
Ray Johnston <ray.johnston@artifex.com>
ac125ce3320aeb3888c18805cd12136d3e1ebfc7

Fix a problem with tags not being set in dev_color

When the tag is changed, we need to unset the dev_color so that the
device's encode_color gets called to apply the correct tag. Seen with
the bitrgbtags device and the file: tests/pdf/Bug691997.pdf

Also, fix a problem with the hit_detect device (infill PS operator).
If the dev_color is unset in the fill or stroke operation, it would
attempt to remap the dev_color which would fail because the hit detect
device doesn't have a device profile. This sets the grapchis_type_tag
to GS_PATH_TAG so that fill and stroke don't unset (and subsequently
remap in gx_set_dev_color) the dev_color.

base/gdevddrw.c
base/gdevnfwd.c
base/gdevp14.c
base/gscolor3.c
base/gsdps1.c
base/gsimage.c
base/gspaint.c
base/gstext.c
base/gxclrast.c
base/gxdevcli.h
base/gxgstate.h
base/gxpcmap.c
psi/zupath.c


2017-04-04 11:37:35 +0100
Ken Sharp <ken.sharp@artifex.com>
ddb63fcf10ce51416f0921dbb0f7b0dee3cf3849

PDF interpreter - don't remove Filters from streams declared as 0 Length

No bug number for this, the problem arose from a Stack Overflow
question here http://stackoverflow.com/questions/43149372/repairing-pdfs-with-damaged-xref-table/43154410?noredirect=1#comment73447166_43154410

The PDF file is multiply broken, it has invalid xref entries and each
page is an image XObject whose dictionary has an indirect object for
the /Length entry. In every case the Length is defined as 0.

For some obscure reason, sometime in the past someone added code to
remove the /Filter entry from the dictionary when a stream has a
declared Length of 0. I have no idea why, if the stream is compressed
or encoded then removing the Filter can have no useful effect. But
if the Filter is left in place we can still recover from an invalid
Length declaration, provided we properly decode the stream, which
obviously requires us to install the correct Filter(s).

So here we simply remove the code which undefines the Filter in the
stream dictionary.

cluster runs show no differences.

Resource/Init/pdf_base.ps


2017-03-30 14:18:11 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
ea5389d2ff12797df9a1fd932f499223460a3808

Bug 697545: Memory Squeezing fix font cache leak.

Fix font cache leak when memory squeezing:

gs -sDEVICE=bit -o /dev/null: examples/tiger.eps

base/gsfont.c
devices/vector/gdevpdf.c
pcl/pcl/pcfont.c


2017-03-28 22:56:18 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
9fbb9d8695deecfe937ffdd91b9bd69613c1c8df

Bug 697545: Memory Squeezing fix leaks in swproc.

Fix memory leaks in swproc when memory squeezing:

gs -sDEVICE=bit -o /dev/null: examples/tiger.eps

psi/imainarg.c


2017-03-29 20:31:49 -0700
Ray Johnston <ray.johnston@artifex.com>
5499169177746ec62d8440f193be418999f156d4

Change GS_UNTOUCHED_TAG to 0 and GS_UNKNOWN_TAG to 0x40

This is mostly arbitrary, but it sort of makes more sense that UNTOUCHED
be 0 so any marking operation can just OR tag bits into the tag plane or
color (e.g. gdevp14.c).

This will change ALL bitrgbtags regression results.

base/gdevp14.c
base/gscms.h
base/gxblend1.c
base/gxdevice.h
devices/gdevbit.c
lib/viewpbm.ps


2017-03-29 19:26:50 +0100
Robin Watts <robin.watts@artifex.com>
edba51f4647f56b3559451f5fdbfbde04bc87828

Bug 697678: Scan converter performance (out of range lines).

This significantly improves the timings.

Essentially, if we were rendering just a band of a page (say from
Y1 to Y2) and the line extended beyond that (say from Y0 to Y3,
where Y0 < Y1 or Y2 < Y3), we'd have run the bresenham for the
entire range rather than for just the section we needed to.

This was particularly problematic in the example file due to the
use of a clipping device, meaning that we were repeatedly
scan converting lines in 1 pixel high regions.

base/gxscanc.c


2017-03-29 20:36:04 +0100
Robin Watts <robin.watts@artifex.com>
0fe78bcd5eb6cc919e6b0a97aadb6f9259176bc8

Tweak bmpcmp to better handle tags.

toolbin/bmpcmp.c


2017-03-29 21:04:55 +0100
Robin Watts <robin.watts@artifex.com>
7dbcd5da85934c9e437c557c359556f3c67b48d5

Scan converter: Fix restrict in prototypes.

Forgot to change the prototypes while adding restrict.

base/gxscanc.c
base/gxscanc.h


2017-03-29 11:55:40 +0100
Robin Watts <robin.watts@artifex.com>
d6903654402789d60bff227fd916a368991ef3eb

Scan converter: Special case vertical lines.

base/gxscanc.c


2017-03-29 11:55:22 +0100
Robin Watts <robin.watts@artifex.com>
df5be672c357ffc884d0b2f0b7a890e1783ed402

Remove unnecessary assignments from scan converter

base/gxscanc.c


2017-03-28 19:32:26 +0100
Robin Watts <robin.watts@artifex.com>
2342e8533bf55a39226e0c99e75c9d2aae3b3d6b

Tweak Scan Converter.

Mark pointers as restricted to try to alleviate aliasing.

Use static inlines for speed.

base/gxscanc.c


2017-03-28 09:12:05 -0700
Ray Johnston <ray.johnston@artifex.com>
93e2557fb36f69310b7f325c70203ae063ef1fae

Fix clist file to invalidate the read cache upon writing (see bug 697689).

This fixes the unknownerror reported by the bug, but does not totally fix
the use of # false .outputpage with the clist since the data after the
first cmd_opv_end_page is not rendered to the page (stops the clist reader).
The bug is left open for that reason and has been marked bountiable.

base/gxclfile.c


2017-03-24 17:32:14 +0000
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
fa6f17de62fd27cef4005f336afcd1ac656dc9af

Bug 697545: Memory Squeezing fix i_register_root leaks.

Fix memory leak for i_register_root allocation when memory squeezing:

gs -sDEVICE=bit -o /dev/null: examples/tiger.eps

base/gsiodev.c
base/gslibctx.c
base/gslibctx.h
psi/imain.c
psi/zfont.c


2017-03-23 09:20:41 +0000
Chris Liddell <chris.liddell@artifex.com>
2eab4ad4d3e861e8e39a10ba58cfdb217b32db78

Remove a pointless typedef

base/gsmemory.h


2017-03-27 09:38:03 +0100
Ken Sharp <ken.sharp@artifex.com>
c06135acc959dbc0458352579bafe238794f2733

pdfwrite - don't try to allocate a 0 length buffer for metadata

Bug #697684 "Regression - Ghostscript 9.21 fails when pdfmark contains certain Unicode characters"

Under some conditions, specifying a 0 length buffer size when calling
gs_alloc_bytes() can return a NULL pointer. Since we use a NULL return
to indicate a failure to allocate a buffer, this results in a VM error.

In this commit we check the data length and don't try to allocate or
use a 0 length buffer.

We'll tackle the allocation problem separately, it would be better if
gs_alloc_bytes didn't return a NULL pointer.

devices/vector/gdevpdfe.c


2017-03-24 11:47:33 +0000
Ken Sharp <ken.sharp@artifex.com>
0d21a58ab12b9584faa54baa48ce0dab350af53e

jbig2dec - refine test for "Denial of Service" images

Bug 697682 "Incorrectly displayed a PDF file on GSView, MuPDF and GhostScript"

In commit 7366747076f3b75def52079bd4d5021539a16394 Simon introduced a
test to try and detect a JBIG2 compressed image which would take an
unreasonable amount of time to process. Unfortunately, the test also trips
up this real world (if rather extreme) example.

The test looks for an image to be > 16MB and for the segment being
processed to contain less than 1/256 of the image data. However, since
we use this same section for symbol decoding, the segment size can be
considerably smaller than that, and still be legal.

This commit alters the image size to 64MB (as this is, frankly, ridiculously
large for a JBIG2 image) and for the segment size to be less than
1/65536 of the total image data. This means that images less than 64MB,
with segments larger than ~1KB might still cause a DOS, but this seems
to be simply a problem we have to accept.

Since the DOS time is dependent on the size of the data, and the size
of the segment, this is a compromise.

jbig2dec/jbig2_generic.c


2017-03-23 19:36:43 +0000
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
eb6ebd779b24cf36ac8dd13e3553c9b262235b37

Bug 697545: Memory Squeezing fix events 244 to 267

Fix memory leaks for allocation event number 244 to 267
when memory squeezing:

gs -sDEVICE=bit -o /dev/null: examples/tiger.eps

Setting the init_done level earlier in gs_main_init1 means that the
existing code in gs_main_finit will clean up after any failures in
i_plugin_init and i_iodev_init.

psi/imain.c


2017-03-21 22:38:44 +0000
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
6dd92923afc2779975c0c7a128bb12ed92c263ba

Bug 697545: Memory Squeezing updated fix for events 10 to 33

Fix memory leaks for allocation event number 10 to 33
when memory squeezing:

gs -sDEVICE=bit -o /dev/null: examples/tiger.eps

psi/ialloc.c
psi/imain.c


2017-03-21 17:50:14 +0000
Chris Liddell <chris.liddell@artifex.com>
fa182eb185494fae17731f426fb3307d7feda4f0

Bug 697681: fix shared lib build with openjpeg >= 2.1.1

In 2.1.1 openjpeg extended the use of the OPJ_STATIC to use gcc attributes to
hide certain functions, as well as the previous use of preventing the
inclusion of the Windows DllMain function.

As we (in Ghostscript) need the functions the OPJ_STATIC on Linux/Unix hides,
only set the flag for Windows builds.

base/lib.mak
psi/msvc.mak


2017-03-21 17:59:12 +0000
Chris Liddell <chris.liddell@artifex.com>
c17c7bbaad9002b38f4881497fc3ce3cc4eb64e6

Add capability to sign the nsis installer exe

On the nmake command line or in the evironment, it requires the following
variables to be set:
KEYFILE - pfx file containing the key
KEYPWORD - password for using the above key file
TIMESTAMP - URL for the timestamp server

psi/winint.mak


2017-03-21 15:45:34 +0000
Chris Liddell <chris.liddell@artifex.com>
a0e27403bbb991f5a541d39122a92505afb0d1dc

Fix the shared openjpeg build

base/sjpx_openjpeg.c


2017-03-21 12:01:02 +0000
Chris Liddell <chris.liddell@artifex.com>
b8b1d543fe833478c167940110e04ddc353d0f3b

Bug 697677: fix support for --disable-openjpeg

base/lib.mak
base/sjpx_none.c


2017-03-20 09:04:31 +0000
Chris Liddell <chris.liddell@artifex.com>
59d8b2e95d2acd2b7e3f86809fa9ebe8ea7eeb8d

Move invalid_file_stream into gc memory.

At initialisation we create an special stream (in the gs context) to use as an
invalid stream whenever we need one.

It was originally being allocated in non-gc memory. Since the context is in
gc memory, the invalid_file_stream can leak. Rather than add explicit freeing
of the invalid_file_stream, and risk a life span conflict between a gc object
and a non-gc object, it makes it neater, and more sense, to keep the
invalid_file_stream in gc memory. It *is* stable memory (not subject to
save/restore) and allocated as an immovable object (not subject to relocating
by the garbager).

Fixes a problem spotted by Shailesh Mistry while working on memory squeezing
event 170.

psi/icontext.c


2017-03-20 09:34:11 +0000
Ken Sharp <ken.sharp@artifex.com>
309eca4e0a31ea70dcc844812691439312dad091

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


2016-12-29 17:08:58 +0000
Robin Watts <robin.watts@artifex.com>
dd5da2cb3e08398ac6d86598b36b00994d058308

Make the edgebuffer scan converter the default.

Selecting the new (edgebuffer) scan converter (as is now the
default) has the effect of forcing the fill adjust values to
be 0 or 0.5.

base/gslibctx.h
base/gsstate.c
base/gsstate.h
base/gxfill.c
pcl/pcl/pctop.c
psi/zmisc.c


2017-03-16 18:27:54 +0000
Robin Watts <robin.watts@artifex.com>
c4bff06c6c527af4cdddc2bd4cbd6fef8ffa4e22

Set tags correctly for glyphs when sent as masked images.

In gx_image_cached_char we can end up sending the glyph as
an imagemask. When we do so, the tag is incorrectly reset
to image, rather than text.

Here we correct that by adding an 'image_is_text' flag to
gs_image_init and gs_image_begin_typed.

This can be seen by the fact that:

gs -sDEVICE=bitrgbtags -o out.bit -r600 -dMaxBitmap=1000
tests_private/customer_tests/jw202dwo.pcl

and

gs -sDEVICE=bitrgbtags -o out.bit -r600 -dMaxBitmap=400000000
tests_private/customer_tests/jw202dwo.pcl

give different tag values for the text.

base/gsimage.c
base/gsimage.h
base/gsptype1.c
base/gxccache.c
base/gxfapi.c
pcl/pcl/pctext.c
pcl/pcl/rtraster.c
pcl/pl/pldraw.c
psi/zimage.c
psi/zimage2.c
xps/xpsimage.c


2017-03-06 10:31:53 +0000
Chris Liddell <chris.liddell@artifex.com>
66361d261c6cdcf4d01463ac9d1d769951a32bed

Bring master up to date with 9.21 release branch

Update copyrights in "top" makefiles

Update dates and versions

Update News.html and History9.htm

with highlights and changelogs

Date and product string for 9.21 release

Changelog and News + date for 9.21 release

Dates for 9.21 release

Makefile.in
base/gscdef.c
base/version.mak
doc/API.htm
doc/C-style.htm
doc/Commprod.htm
doc/DLL.htm
doc/Deprecated.htm
doc/Details8.htm
doc/Details9.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/Helpers.htm
doc/History1.htm
doc/History2.htm
doc/History3.htm
doc/History4.htm
doc/History5.htm
doc/History6.htm
doc/History7.htm
doc/History8.htm
doc/History9.htm
doc/Install.htm
doc/Issues.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.htm
doc/Projects.htm
doc/Ps-style.htm
doc/Ps2epsi.htm
doc/Psfiles.htm
doc/Readme.htm
doc/Release.htm
doc/SavedPages.htm
doc/Source.htm
doc/Unix-lpr.htm
doc/Use.htm
doc/VectorDevices.htm
doc/WhatIsGS.htm
doc/Xfonts.htm
doc/gs-vms.hlp
doc/sample_downscale_device.htm
doc/thirdparty.htm
man/dvipdf.1
man/font2c.1
man/gs.1
man/gslp.1
man/gsnd.1
man/pdf2dsc.1
man/pdf2ps.1
man/pf2afm.1
man/pfbtopfa.1
man/printafm.1
man/ps2ascii.1
man/ps2epsi.1
man/ps2pdf.1
man/ps2pdfwr.1
man/ps2ps.1
man/wftopfa.1
psi/winint.mak


2017-03-16 15:57:47 +0000
Chris Liddell <chris.liddell@artifex.com>
4237b0bc1155a781de80c0079d72c0bcdacbb95e

Remove two erroneous uses of return_error

psi/idisp.c


2017-03-16 07:54:26 -0700
Ray Johnston <ray.johnston@artifex.com>
ec32c674469fab173c6df5e97bc3f3aff37e6c92

Fix SEGV with tiffsep1 device found by customer 531.

When "warning_given" was set, the device was cast to tiffsep_device,
but the parameter was in a different offset with the tiffsep1_device.
Move the warning_given to the tiffsep_devices_common part of the structure
so the casting works properly.

devices/gdevtsep.c


2017-03-15 14:15:00 +0000
Robin Watts <robin.watts@artifex.com>
6cd467ecdb2678847670fd22a0d5dd39b89e8ca3

Tweak code in gxfapi.c to avoid repetition.

base/gxfapi.c


2017-03-15 19:04:13 +0000
Robin Watts <robin.watts@artifex.com>
8ad42f17df0c9e7afe25f95ecfae8fd005ac589c

Fix typo.

base/gxclimag.c


2017-03-15 19:38:32 +0000
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
e146bb38c20e5b967d89e16db244b2beb74ba345

Bug 697545: Memory squeezing SEGV event in gstate_clone

An allocation failure in gstate_clone caused pgs->color to be
freed too early when memory squeezing:

gs -sDEVICE=bit -o /dev/null: examples/tiger.eps

base/gsstate.c


2017-03-15 15:32:03 +0000
Ken Sharp <ken.sharp@artifex.com>
917b4e28c37d5e9ac3a605658f51b29a2357ab28

PDF interpreter - add B operators to spcial 'W' handling

Previously we had altered the handling of stroke, fill and eofill when
in a 'W' context, to detect changes in the graphics state between the
'W' or 'W*' operation and the terminating path operator.

Unfortunately when this was done the B, b, B* and b* operators were
missed, which meant these always behaved as if an invalid graphics
state change was executed, ignored the graphics state change, and
ended up rednering incorrectly.

This commit adds those operators to the special handling of the W and
W* operators.

Resource/Init/pdf_ops.ps


2017-03-15 14:46:49 +0000
Chris Liddell <chris.liddell@artifex.com>
46ef6bc80bd7388883a00aa866af38fe8f05d45b

pdfwrite: properly handle text outside the clip

Bug 697442:

To work around an Acrobat limitation (related to glyphs with very large
coordinates), we don't emit glyph whose bounding box is outside the current
clipping region.

However, the file in question here uses a combination of show and glyphshow to
display text, and it also measures (in the manner of stringwidth) to position
the text. *But* because it relies on glyphshow, it cannot use stringwidth. It
moves the current point outside the page, draws the text (strings and glyph
names), and records how far the current point has moved.

The previous code would skip out early to avoid emitting the clipped out glyphs,
whilst still apparently updating the current point. *But* the values from which
the current point were updated were not correctly set due to skipping out
early.

We now do everything *except* emit the glyphs, thus the various values are
correct, and the currentpoint is updated properly.

devices/vector/gdevpdte.c


2017-03-12 17:07:18 -0700
Ray Johnston <ray.johnston@artifex.com>
16b7f46fa03a82445784608b8db21f11cd76c884

Fix Bug 697661 -- SEGV with tiffsep1 device and threshold array halftones

Threshold arrays create a different type of gx_ht_order than screen type
halftones so the bit_data is short X,Y coordinates instead of offset,mask
(gx_ht_bit) elements that the tiffsep1 "threshold_from_order" code was
expecting. Using the bit_index proc of the order works for all gx_ht_order
types.

TODO: determine if it is possible to use the gx_ht_construct_threshold
function. This function is used in the FAST_HT_CODE used for some
images to halftone devices that need halftoning.

devices/gdevtsep.c


2017-03-11 15:10:00 -0800
Ray Johnston <ray.johnston@artifex.com>
a5a2862d9503fedfb32f46f1cbc669c40497474f

Fix bug 695280 page mode and clist mode differ

The clist mode "uses_color" was ignoring CombineWithColor if the rop
did not use the texture (rop3_uses_T false). This affects the ps3cet
09-40.PS and pcl5ccet/23-11.BIN files.

Note that this reults in these cases not using high-level images
in the clist since currently the clist cannot accomodate the two
different colorspaces (painting an Indexed colorspace image through
a pattern). Since the number of changed file is minimal, I assume
that the performance impact does not affect many files.

base/gxclimag.c


2017-03-10 19:44:43 +0000
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
cc35e521d8fb162f97252a3509b9041f4253b818

Bug 697545: Memory Squeezing updated fix for events 10 to 33

Fix memory leaks for allocation event number 10 to 33
when memory squeezing:

gs -sDEVICE=bit -o /dev/null: examples/tiger.eps

psi/ialloc.c
psi/imain.c


2017-03-10 13:14:10 +0000
Ken Sharp <ken.sharp@artifex.com>
acf5451a357a8595e692fe86e0be722a69e036dc

PDF interpreter - avoid looping/recursion searching for Default* spaces

Bug #697655 " gswin32c.exe hangs while interpreting some pdf files"

The (insane) PDF file ended up looping through Resources and XObjects
looking for any instances of the Default* colour spaces. We need the
information to set UseCIEColor to true if any are present, in order
to do proper colour management on the input colours.

Follows the same technique we already use for transparency and cpot
colour searches.

Resource/Init/pdf_main.ps


2017-02-23 18:06:53 +0000
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
62a865bbdf2abafabe5971d42c71be2bd1233e5c

Bug 697545: Memory Squeezing fix events 10 to 33

Fix memory leaks for allocation event number 10 to 33
when memory squeezing:

gs -sDEVICE=bit -o /dev/null: examples/tiger.eps

psi/ialloc.c
psi/ialloc.h
psi/imain.c


2017-03-05 20:16:39 +0000
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
1df92f6952038fa70aa9cad8c398f360b0323539

Bug 697545: Memory Squeezing fix.

Fix memory leak for allocation event number 170
when memory squeezing:

gs -sDEVICE=bit -o /dev/null: examples/tiger.eps

psi/interp.c


2017-03-07 14:20:23 +0000
Robin Watts <robin.watts@artifex.com>
67dba2b7fdb5adf4b3f8cdf112c7ac67a89a9ea8

MSVC: Add 2 missing files to solution.

windows/ghostscript.vcproj


2017-03-08 10:15:25 +0000
Ken Sharp <ken.sharp@artifex.com>
f37a69d40a6222d903b48b97b58a26151ea2e493

txtwrite - fix Unicode conversion of glyph names 'unixxxx'

More fallout from the ToUnicode revamp required for pdfwrite, commit
9dba57f0f9a53c130ec2771c0ed1d7bd6bbef6ab

The code to handle converting glyphs whose name conforms to the
uniXXXX form, when there is no better ToUnicode information, was still
returning the number of bytes, not shorts. In addition, the original
change was packing the 2 bytes as two shorts instead of a singe short.

This resulted in incorrect output. Fixed here by packing the 4 nibbles
into a single short and returning a count of 1 short.

devices/vector/gdevtxtw.c


2017-03-03 19:42:29 +0000
Robin Watts <robin.watts@artifex.com>
64f5d62c80176085335d84c24e02cd49d9e032b9

Bug 697545: Extend "separable_and_linear" processing.

First, avoid needless check_separable_and_linear tests.

When we make a memory store for a target device, we use
the encoding/decoding color functions from that target
device. It seems reasonable to copy the "separable_and_linear"
information from that device too, to avoid having to needlessly
retest using the same encoding/decoding functions to get
the same answer.

Next, extend gx_color_enc_sep_lin_t to represent not just
whether we know details about the device colors separability
and linearity (and what those details are if known), but also
to encode whether those are standard encodings or not. The
standard encoding is defined to be "that which is compatible
with the pdf14 compositor".

Finally, we add a function, check_device_separable_encoding,
that 'promotes' the record for a given space from being a
known separable_and_linear one, to one that knows it's
separable_and_linear, but also knows whether it uses the
standard encoding.

Call this in clist_close_writer_and_init_reader to ensure that
the buffer device is created knowing whether it's a standard
encoding or not. If called here, it only ever needs to run once.

Call it again in pdf14_ok_to_optimize (just in case we ever slip
through - this takes no time if it has been run already). This
enables us to make a correct choice, and to avoid skipping
transparency bands if we are not using the standard (pdf14
compositor compatible) encoding.

base/gdevdflt.c
base/gdevmem.c
base/gdevp14.c
base/gscspace.c
base/gsicc.c
base/gsovrc.c
base/gxclread.c
base/gxcmap.c
base/gxdevcli.h
base/gxdevice.h
base/gxshade6.c
psi/zcolor.c


2017-03-07 10:24:37 +0000
Robin Watts <robin.watts@artifex.com>
ddd39cb2ea1773bf001cd4f975856446c2bd7f43

Bug 696915: Second attempt at fix.

In attempting to fix a buffer overrun in mapped8_copy01, I broke it.
This is a proper fix. Previously I'd missed the increment of count
after the loop.

base/gdevm8.c


2017-03-07 10:08:11 +0000
Robin Watts <robin.watts@artifex.com>
1a7bfc5dd6d84a15bba163c0f7328fb766d8be20

Revert "Bug 696915: Fix buffer overread in mapped8_copy01."

This reverts commit 4e646ef8103f3ab2ab9d7de64bd30cc2156f0441.

Cluster testing shows problems with this.

base/gdevm8.c


2017-03-06 10:00:11 +0000
Chris Liddell <chris.liddell@artifex.com>
b46bb757037a18bfcc95e61fbe751df5e4cfdd58

Bump version number.

Resource/Init/gs_init.ps
base/version.mak


2017-03-16 09:20:11 +0000
Chris Liddell <chris.liddell@artifex.com>
f80288c8a4b9c9abfc0fa3ccce3b6d169baa59ff

Dates for 9.21 release

doc/API.htm
doc/C-style.htm
doc/Commprod.htm
doc/DLL.htm
doc/Deprecated.htm
doc/Details8.htm
doc/Details9.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/Helpers.htm
doc/History1.htm
doc/History2.htm
doc/History3.htm
doc/History4.htm
doc/History5.htm
doc/History6.htm
doc/History7.htm
doc/History8.htm
doc/History9.htm
doc/Install.htm
doc/Issues.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/Projects.htm
doc/Ps-style.htm
doc/Ps2epsi.htm
doc/Psfiles.htm
doc/Readme.htm
doc/Release.htm
doc/SavedPages.htm
doc/Source.htm
doc/Unix-lpr.htm
doc/Use.htm
doc/VectorDevices.htm
doc/WhatIsGS.htm
doc/Xfonts.htm
doc/gs-vms.hlp
doc/sample_downscale_device.htm
doc/thirdparty.htm
man/dvipdf.1
man/font2c.1
man/gs.1
man/gslp.1
man/gsnd.1
man/pdf2dsc.1
man/pdf2ps.1
man/pf2afm.1
man/pfbtopfa.1
man/printafm.1
man/ps2ascii.1
man/ps2epsi.1
man/ps2pdf.1
man/ps2pdfwr.1
man/ps2ps.1
man/wftopfa.1


2017-03-16 09:19:16 +0000
Chris Liddell <chris.liddell@artifex.com>
a96ade6b7238764b1a940dafbe2b7d52932f66ec

Changelog and News + date for 9.21 release

doc/History9.htm
doc/News.htm


2017-03-16 09:13:57 +0000
Chris Liddell <chris.liddell@artifex.com>
db6fa66eba7427854f491738500ecf9f179446fc

Date and product string for 9.21 release

base/gscdef.c
base/version.mak


2017-03-12 17:07:18 -0700
Ray Johnston <ray.johnston@artifex.com>
6ffbbb5a389df10d7b7a0a630a910363f75b73d6

Fix Bug 697661 -- SEGV with tiffsep1 device and threshold array halftones

Threshold arrays create a different type of gx_ht_order than screen type
halftones so the bit_data is short X,Y coordinates instead of offset,mask
(gx_ht_bit) elements that the tiffsep1 "threshold_from_order" code was
expecting. Using the bit_index proc of the order works for all gx_ht_order
types.

TODO: determine if it is possible to use the gx_ht_construct_threshold
function. This function is used in the FAST_HT_CODE used for some
images to halftone devices that need halftoning.

devices/gdevtsep.c


2017-03-08 10:15:25 +0000
Ken Sharp <ken.sharp@artifex.com>
a629fb9e9f03d8d5aefd32d3c46f6045dba41ccb

txtwrite - fix Unicode conversion of glyph names 'unixxxx'

More fallout from the ToUnicode revamp required for pdfwrite, commit
9dba57f0f9a53c130ec2771c0ed1d7bd6bbef6ab

The code to handle converting glyphs whose name conforms to the
uniXXXX form, when there is no better ToUnicode information, was still
returning the number of bytes, not shorts. In addition, the original
change was packing the 2 bytes as two shorts instead of a singe short.

This resulted in incorrect output. Fixed here by packing the 4 nibbles
into a single short and returning a count of 1 short.

devices/vector/gdevtxtw.c


2017-03-07 10:24:37 +0000
Robin Watts <robin.watts@artifex.com>
bea6c3e636b0fcf49ab5042fb0506fdb1f5fe4b8

Bug 696915: Second attempt at fix.

In attempting to fix a buffer overrun in mapped8_copy01, I broke it.
This is a proper fix. Previously I'd missed the increment of count
after the loop.

base/gdevm8.c


2017-03-07 10:08:11 +0000
Robin Watts <robin.watts@artifex.com>
d1d0bf5f9776bf2ad26e223bf3d36e85176e7c78

Revert "Bug 696915: Fix buffer overread in mapped8_copy01."

This reverts commit 4e646ef8103f3ab2ab9d7de64bd30cc2156f0441.

Cluster testing shows problems with this.

base/gdevm8.c


2017-03-07 10:42:00 +0000
Robin Watts <robin.watts@artifex.com>
8115fa337c70e08516a9fad6da68edf5b461cb2d

Product string for 9.20RC2

base/gscdef.c


2017-03-06 10:57:03 +0000
Chris Liddell <chris.liddell@artifex.com>
53dc6a1e4bb61ce1aaf689550d42ec6cf706d889

Update News.html and History9.htm

with highlights and changelogs

doc/History9.htm
doc/News.htm


2017-03-06 10:32:53 +0000
Chris Liddell <chris.liddell@artifex.com>
2f4b5eb2cf7d173d69c7a6bdb8008447f8e1b174

Update dates and versions

doc/API.htm
doc/C-style.htm
doc/Commprod.htm
doc/DLL.htm
doc/Deprecated.htm
doc/Details8.htm
doc/Details9.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/Helpers.htm
doc/History1.htm
doc/History2.htm
doc/History3.htm
doc/History4.htm
doc/History5.htm
doc/History6.htm
doc/History7.htm
doc/History8.htm
doc/History9.htm
doc/Install.htm
doc/Issues.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.htm
doc/Projects.htm
doc/Ps-style.htm
doc/Ps2epsi.htm
doc/Psfiles.htm
doc/Readme.htm
doc/Release.htm
doc/SavedPages.htm
doc/Source.htm
doc/Unix-lpr.htm
doc/Use.htm
doc/VectorDevices.htm
doc/WhatIsGS.htm
doc/Xfonts.htm
doc/gs-vms.hlp
doc/sample_downscale_device.htm
doc/thirdparty.htm
man/dvipdf.1
man/font2c.1
man/gs.1
man/gslp.1
man/gsnd.1
man/pdf2dsc.1
man/pdf2ps.1
man/pf2afm.1
man/pfbtopfa.1
man/printafm.1
man/ps2ascii.1
man/ps2epsi.1
man/ps2pdf.1
man/ps2pdfwr.1
man/ps2ps.1
man/wftopfa.1


2017-03-06 10:31:53 +0000
Chris Liddell <chris.liddell@artifex.com>
7d3e8640525cab77feabf33db732e5d1bb4eb652

Update copyrights in "top" makefiles

Makefile.in
psi/winint.mak


2017-03-06 10:28:47 +0000
Chris Liddell <chris.liddell@artifex.com>
8f917db5eb0b94c864cef770022d86b22e45df98

Product string for 9.20RC1

base/gscdef.c



Version 9.21 (2017-03-16)

This is the fifteenth full release in the stable 9.x series.

Highlights in this release include:

For a list of open issues, or to report problems, please visit bugs.ghostscript.com.

Incompatible changes

Changelog

2017-03-16 09:13:57 +0000
Chris Liddell <chris.liddell@artifex.com>
db6fa66eba7427854f491738500ecf9f179446fc

Date and product string for 9.21 release

base/gscdef.c
base/version.mak


2017-03-12 17:07:18 -0700
Ray Johnston <ray.johnston@artifex.com>
6ffbbb5a389df10d7b7a0a630a910363f75b73d6

Fix Bug 697661 -- SEGV with tiffsep1 device and threshold array halftones

Threshold arrays create a different type of gx_ht_order than screen type
halftones so the bit_data is short X,Y coordinates instead of offset,mask
(gx_ht_bit) elements that the tiffsep1 "threshold_from_order" code was
expecting. Using the bit_index proc of the order works for all gx_ht_order
types.

TODO: determine if it is possible to use the gx_ht_construct_threshold
function. This function is used in the FAST_HT_CODE used for some
images to halftone devices that need halftoning.

devices/gdevtsep.c


2017-03-08 10:15:25 +0000
Ken Sharp <ken.sharp@artifex.com>
a629fb9e9f03d8d5aefd32d3c46f6045dba41ccb

txtwrite - fix Unicode conversion of glyph names 'unixxxx'

More fallout from the ToUnicode revamp required for pdfwrite, commit
9dba57f0f9a53c130ec2771c0ed1d7bd6bbef6ab

The code to handle converting glyphs whose name conforms to the
uniXXXX form, when there is no better ToUnicode information, was still
returning the number of bytes, not shorts. In addition, the original
change was packing the 2 bytes as two shorts instead of a singe short.

This resulted in incorrect output. Fixed here by packing the 4 nibbles
into a single short and returning a count of 1 short.

devices/vector/gdevtxtw.c


2017-03-07 10:24:37 +0000
Robin Watts <robin.watts@artifex.com>
bea6c3e636b0fcf49ab5042fb0506fdb1f5fe4b8

Bug 696915: Second attempt at fix.

In attempting to fix a buffer overrun in mapped8_copy01, I broke it.
This is a proper fix. Previously I'd missed the increment of count
after the loop.

base/gdevm8.c


2017-03-07 10:08:11 +0000
Robin Watts <robin.watts@artifex.com>
d1d0bf5f9776bf2ad26e223bf3d36e85176e7c78

Revert "Bug 696915: Fix buffer overread in mapped8_copy01."

This reverts commit 4e646ef8103f3ab2ab9d7de64bd30cc2156f0441.

Cluster testing shows problems with this.

base/gdevm8.c


2017-03-07 10:42:00 +0000
Robin Watts <robin.watts@artifex.com>
8115fa337c70e08516a9fad6da68edf5b461cb2d

Product string for 9.20RC2

base/gscdef.c


2017-03-06 10:32:53 +0000
Chris Liddell <chris.liddell@artifex.com>
2f4b5eb2cf7d173d69c7a6bdb8008447f8e1b174

Update dates and versions

doc/API.htm
doc/C-style.htm
doc/Commprod.htm
doc/DLL.htm
doc/Deprecated.htm
doc/Details8.htm
doc/Details9.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/Helpers.htm
doc/History1.htm
doc/History2.htm
doc/History3.htm
doc/History4.htm
doc/History5.htm
doc/History6.htm
doc/History7.htm
doc/History8.htm
doc/History9.htm
doc/Install.htm
doc/Issues.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.htm
doc/Projects.htm
doc/Ps-style.htm
doc/Ps2epsi.htm
doc/Psfiles.htm
doc/Readme.htm
doc/Release.htm
doc/SavedPages.htm
doc/Source.htm
doc/Unix-lpr.htm
doc/Use.htm
doc/VectorDevices.htm
doc/WhatIsGS.htm
doc/Xfonts.htm
doc/gs-vms.hlp
doc/sample_downscale_device.htm
doc/thirdparty.htm
man/dvipdf.1
man/font2c.1
man/gs.1
man/gslp.1
man/gsnd.1
man/pdf2dsc.1
man/pdf2ps.1
man/pf2afm.1
man/pfbtopfa.1
man/printafm.1
man/ps2ascii.1
man/ps2epsi.1
man/ps2pdf.1
man/ps2pdfwr.1
man/ps2ps.1
man/wftopfa.1


2017-03-06 10:31:53 +0000
Chris Liddell <chris.liddell@artifex.com>
7d3e8640525cab77feabf33db732e5d1bb4eb652

Update copyrights in "top" makefiles

Makefile.in
psi/winint.mak


2017-03-06 10:28:47 +0000
Chris Liddell <chris.liddell@artifex.com>
8f917db5eb0b94c864cef770022d86b22e45df98

Product string for 9.20RC1

base/gscdef.c


2017-03-03 10:20:14 +0000
Chris Liddell <chris.liddell@artifex.com>
278c66866eb41c0d8220d31bd7f12887706eb51c

Change git behaviour broke gitlog2changelog.py

remove the --cc options

toolbin/gitlog2changelog.py


2017-03-03 10:00:05 -0700
Henry <henry.stiles@artifex.com>
1d2da0ae232605c4f62a97f8cf1cedce15c4ba9f

Add error message when resident fonts are not found.

The fix also uncovered a regression. The XL interpreter was checking
if the function to load built in fonts returned a code less than 0
which does not happen anymore. Upon error the function returns 0 (false),
indicating no fonts found.

pcl/pcl/pcfont.c
pcl/pxl/pxsessio.c


2017-03-03 06:58:19 -0700
Henry Stiles <henry.stiles@artifex.com>
c9cb91b2fb59481247aaee88779577ef6c103327

Update the default PCL font search path.

The font search path was never updated when the directory structure
changed, also add a directory entry to allow PCL to find fonts while
cluster testing without an environment variable or command line
setting.

pcl/pl/pjparse.c


2017-03-03 09:30:59 +0000
Chris Liddell <chris.liddell@artifex.com>
62354d822b29006d7e431a2b07c70106647b62c8

Remove the left over Mac specific files.

OS X is basically just a Unix-like system, so building gs for it is now just
like for any other Unix-like system. We haven't supported Mac Classic for some
time.

Several Mac related files were left over, atrophied and no longer any value.

This removes them.

base/gsiomacres.c
base/lib.mak
base/macgenmcpxml.sh
base/macos_carbon_d_pre.h
base/macos_carbon_pre.h
base/macos_classic_d_pre.h
base/macosx.mak
base/macsystypes.h
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2017-03-02 16:35:51 -0800
Ray Johnston <ray.johnston@artifex.com>
ba8d4abaa9c33edd8c79da7022f231e4b21f22e9

fix bug 697621: color_usage.or bits were wrong with transparency

The psdcmykog uses the color_usage.or bits to decide which components need to
be processed, skipping those that are not needed. When the pdf14 device changes
the color_info the color that will actually go on the page cannot be known
without transforming the color to the device color which is too expensive.

Also fix the polarity tests in gx_color_index2usage (it was being ignored)

base/gxclist.c
base/gxclpath.c


2017-03-02 12:26:16 +0000
Chris Liddell <chris.liddell@artifex.com>
ea14e8c7c8f8ece7a7ea2a324bca2c115c61b1a3

Bug 697626: bounds check allocations in the chunk allocator

Ensure the requested memory allocation doesn't overflow the 32 bit variables
in the chunk allocator.

base/gsmchunk.c


2017-03-01 10:26:17 -0800
Ray Johnston <ray.johnston@artifex.com>
670e5d250c6049694f0f1f1c3d15270d6dc2246a

Bug 697615: Only apply CompatibleOverprint handling to some colorspaces

Testing with Adobe shows that only Gray, CMYK, DeviceN and Sep color
spaces should use the special CompatibleOverprint handling specified
in the section "Compatibility with Opaque Overprinting".

Resource/Init/pdf_ops.ps


2017-03-01 12:59:12 +0000
Robin Watts <robin.watts@artifex.com>
0a8f8a53a968a638e828086f0725780aa64793c0

Fix clump handling.

Ray spotted that running:

debugbin/gs -r300 -Z@\$\?: -dJOBSERVER

is enough to send us into an infinite loop.

Tracking this down, it appears that the reason is to do with
the gs_ref_memory_t's use of 'pcc' and 'cc'.

It copies the 'current' chunk out of the splay tree, and then
puts it back later, without realising that the splay tree
may have been altered.

The simplest fix appears to be just to not do this copying.

base/gsalloc.c
base/gxalloc.h
psi/ialloc.c
psi/igc.c
psi/ilocate.c
psi/isave.c


2017-02-28 17:36:00 +0000
Robin Watts <robin.watts@artifex.com>
f8c0d4e78f75de95b0d74210b3e929abef6f3a60

Add sanity check on image sizes.

Inspired by bug 697395, but doesn't actually solve any problem
seen in that bug (or at least, not that I can see, as I can't
reproduce the problem with file2).

jbig2dec/jbig2_image.c


2017-03-01 09:47:58 -0700
Henry Stiles <henry.stiles@artifex.com>
bbb2b961388b028d7d9d8f6454ced8192ad513c1

Fix Bug 697624 - PCL segfaults with --disable-compile inits.

Instead of trying to continue we exit upon initialization if no fonts
are found and the current emulation is PCL.

pcl/pcl/pcfont.c


2017-02-28 18:43:04 +0000
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
ce437b88df500a184ae2ca15d67a019f57a11d20

Bug 697545: Memory Squeezing fix.

Fix memory leaks for allocation event numbers 25 to 32
when memory squeezing:

gs -sDEVICE=bit -o /dev/null: examples/tiger.eps

psi/imain.c
psi/iname.c
psi/inames.h


2017-02-28 19:54:51 +0000
Chris Liddell <chris.liddell@artifex.com>
0ebb37a19ece80fa03af8de5047705722625870b

Bug 697372: Fix crash due to pattern clist being freed

When rendering a pattern from a clist into the pdf14 compositor, the compositor
takes a reference to the pattern clist device. This is fine pre-page-clist, or
with no page clist involved (when the memory is managed by the garbage
collector), but post-page-clist the life span of the pattern clist device is
dicated by the clist replay, *not* by references to it (as in the gc'ed case).
This can result in a dangling pointer, which later causes a crash in the
garbage collector when it cleans up after the page-clist has completed.

So, when pattern fill has been completed, remove the reference to the pattern
clist device.

base/gdevp14.c


2017-02-28 15:36:34 +0000
Robin Watts <robin.watts@artifex.com>
459a0e650ffab1069a6f59c17775f5fd462c45d2

Bug 696364: Restrict size of alphabits buffer

Thanks to Michael for doing the investigation, and leaving a
really good write up of the problem on the bug.

The basic problem is that we have a transparency group that
contains a softmask. The softmask is larger than the transparency
group, so it is restricted to the size of the group and written
into the clist as occupying just a small set of bands.

The content for the softmask is larger, however, so when used with
GraphicsAlphaBits, we create various alphabits devices, draw
the contents, and then send the results with copy_alpha.

These copy_alpha calls are NOT restricted to being within the
reduced region for the softmask. This therefore upsets the clist
reading.

The fix, as suggested by Michael in his bug report is to limit
the size of the softmask contents (by limiting the size of the
alphabits buffers).

Ideally the alphabits device would know what region to limit
itself to just by looking at the graphics state it's passed in.
Unfortunately, that doesn't work as the current softmask/groups
aren't reflected in the graphic state. This feels wrong to me,
but that's the way it is.

Instead, we have to resort to asking the device to limit our
bbox according to the current state. We achieve this by adding
a new dev_spec_op, and adding the required plumbing to the pdf14
device (to pass it on to the target) and the clist device (to
actually do the restriction).

base/gdevp14.c
base/gspaint.c
base/gxclrect.c
base/gxdevsop.h


2017-02-28 07:05:58 -0800
Ray Johnston <ray.johnston@artifex.com>
4a9394e6abc6b0107da4f42675bf35eb031fe068

Fix DEPTH is RAW_DUMP_AS_PAM GRAYSCALE_ALPHA header

base/gxblend.c


2017-02-27 13:37:41 -0800
Ray Johnston <ray.johnston@artifex.com>
ff07b67892c201a0a16d983b05d121ac409b78a0

Bug 697615: color_usage was incorrectly updated for devn with pdf14

When the pdf14 compositor messes with the color space and color_info,
it doesn't change the target (clist) color_info, but sets the new
information in cldev->clist_color_info. In order to properly update the
color_usage cmd_drawing_color_usage needs to set the bits according to the
clist_color_info num_components and polarity in gx_dc_devn_get_nonzero_comps,
so save the cldev->color_info values, set them to the cldev->clist_color_info
values for the calculation and restore them afterwards

base/gxclpath.c
base/gxdcolor.c


2017-02-27 14:15:30 -0700
Henry Stiles <henry.stiles@artifex.com>
97ddb45834c73f697e53839c6b433f65248d9c2a

Improve pcl page marking detection.

Instead of looking at only the character's position to determine if a
character marks the page we now look at the extant of the character's
width. Thanks to Norbert Janssen for the fix.

pcl/pcl/pcpage.c
pcl/pcl/pcpage.h
pcl/pcl/pctext.c


2017-02-27 18:20:39 +0000
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
8bb1aab8a60810aefb67a6d2764a54abc547878b

Bug 697545: Memory Squeezing fix.

Fix memory leak for allocation event number 22
when memory squeezing:

gs -sDEVICE=bit -o /dev/null: examples/tiger.eps

base/fapi_ft.c


2017-02-26 05:23:39 +0000
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
a76a82abca879fcf351fce5aba50a48e7de41963

Bug 697545: Memory Squeezing fix.

Fix memory leak for allocation event number 10
when memory squeezing:

gs -sDEVICE=bit -o /dev/null: examples/tiger.eps

psi/imainarg.c


2017-02-24 18:21:12 +0000
Robin Watts <robin.watts@artifex.com>
009e40a0534e1d11ed5ee353477859b5cdd4faed

Bug 696921: Don't "early decode" when interpolating Lab images

Applying the decode array to Lab source values during the
conversion to fracs that takes place before non-icc based
interpolation causes an overflow.

We therefore leave the application of the decode array until
after the interpolation.

After the interpolation, we don't actually want to apply the
decode array though - in that we want the result in the usual
0...1 float form rather than the 0..100/-128..127/-128...127
ranges that the color would seem to require.

One option would be simply to not apply the decode array. This
will however go wrong when we meet an Lab file with a
non-standard Decode array. We therefore apply the given decode
array (which may well be the default), and 'undo' the default
one to get the values we actually want.

base/gxiscale.c


2017-02-24 19:05:52 +0000
Robin Watts <robin.watts@artifex.com>
af3c1d10726b2d932d951bf021193cbd5bcc734d

Bug 697048: Fix compatible overprint blend mode.

Fix from Michael Vrhel.

Compatible overprint is operating in subtractive color spaces, so
a 'zero' component actually means 0xFF.

base/gxblend.c


2017-02-24 18:40:03 +0000
Robin Watts <robin.watts@artifex.com>
9e38426abd977fbc67c0d91103eb7bd3573409bb

Update clusterpush.pl

Allow "extended", "cull" and "win32".

toolbin/localcluster/clusterpush.pl


2017-02-23 15:20:35 +0000
Robin Watts <robin.watts@artifex.com>
1aebfe56c80bb46bba74c23654d9febcf5f761b5

Correct assert in new scan converter

base/gxscanc.c


2017-02-24 09:33:05 -0800
Ray Johnston <ray.johnston@artifex.com>
13686f5374600d41105587c20a15f3c1e55f3534

Return Fatal errors from PS putdeviceparams to avoid potential SEGV

The change to return Fatal from the display device (commit 269354e)
would segfault with the PS interpreter because zputdeviceparams never
returned an error code, assuming that the interpreter could handle it,
but this resulted in a segfault when setpagedevice tried to erase the
page and the display device did not have a valid bitmap. Return the
Fatal error so the interpreter can exit cleanly.without performing
the usual setpagedevice "configurationerror" recovery.

psi/zdevice.c


2017-02-24 16:10:11 +0000
Ken Sharp <ken.sharp@artifex.com>
dabad3f6e9c2bdbd152f67a66b698262f94b816d

PDF interpreter - remove some (ancient) debug code

This line seems to have been left in accidentally a long, long, time
ago. Surprisingly its never been noticed before....

Resource/Init/pdf_base.ps


2017-02-24 15:50:21 +0000
Ken Sharp <ken.sharp@artifex.com>
269354ea918e4498df67e52a1efd16295e031421

Fix display device for non-PostScript interpreters

commit cf279b8c4773e14045dd6b411c3a524c6ac39124 fixed a potential
crash when memory was exhausted, but used the gs_abort() routine to
tell the interpreter to abort immediately and not carry on.

Unfortunately, and despite the comment in gsexit.h, gs_abort() is only
available in the PostScript interpreter.

So here we opt to return a fatal error, which *should* cause the
interpreter to give up (it does on PCL and PostScript) and will allow
us to build GhostPCL on Windows.

devices/gdevdsp.c


2017-02-24 10:12:43 +0000
Chris Liddell <chris.liddell@artifex.com>
0e9a345e7badf0d53ab19761a938665079883612

Bug 694995: Fix 'wrapped' x11 devices' buffered 'mode'

The x11 devices can either unbuffered (where rendered objects go straight to the
screen) or buffered (where objects are rendered to a memory buffer device, and
then blitted to the screen).

Additionally, the 'real' x11 device always uses the resolution and color specs
of the X11 server on which it is running. Then devices such as x11mono and
x11cmyk using a "wrapper" device in order to keep the x11 device using the
specs of the X11 server, whilst presenting an appropriate character to the rest
of Ghostscript (so, even though x11 is *probably* running 24bit RBG, x11mono
needs to look like a pure monochrome device).

Because we need the 'real' x11 device to handle get_params/put_params, and we
need to temporarily 'patch' the color info of the 'real' x11 device so it
retrieves/applies the params correctly.

The problem arises when we run one of these 'wrapper' devices in buffered mode.
The memory buffer device (particularly after a resizing of the page buffer),
would end up being configured based on the color settings of the 'wrapper'
device, rather than the 'wrapped' device. So we could end up treating a 1bpp
mono bitmap (from the memory buffer device) as a 24bpp RGB pixmap and blitting
to the screen. Causing a buffer overflow, and segfault.

To solve that, store the color info we need away from its place in a
standard device, and use the x11 device's own dedicated copy for setting up
the memory buffer device.

devices/gdevx.c
devices/gdevx.h
devices/gdevxalt.c
devices/gdevxini.c


2017-02-22 07:17:54 -0800
Ray Johnston <ray.johnston@artifex.com>
670c6b29ebbd29fb3238575cb08a6c2c9586ace7

Add support for RGB_TAG PAM files to lib/viewpbm.ps (type from bitrgbtags)

The bitrgbtags device was changed recently to create a PAM (P7) file rather
than a bogus P6 file with 4 components. This means that the pcl/tools/GOT
detag.c and tagimage.c no longer worked. Instead of changing these the
lib/viewpbm.ps was enhanced to process the RGB_TAG P7 files.

By default, it shows the image, and with -dTAG it shows pseudo-color for
the tag values, UNKNOWN/UNMARKED is white, TEXT is black, PATH is yellow
and IMAGE is red.

example usage:
gs -dSCALE=1 -- lib/viewpbm.ps bitrgbags.pam
or
gs -dSCALE=1 -dTAG -- lib/viewpbm.ps bitrgbags.pam

This can also be used to convert the P7 image to another format using
-sDEVICE=___ -o ___ arguments prior to the -- option.

Also, fix numerous problems with FITPAGE and SCALE options. They were
just WRONG!

lib/viewpbm.ps
pcl/tools/GOT/README
pcl/tools/GOT/detag.c
pcl/tools/GOT/dotags.sh
pcl/tools/GOT/tagimage.c


2017-02-22 17:51:17 -0800
Ray Johnston <ray.johnston@artifex.com>
862b31689c3f1c6425f5522adc820b73e352e012

Improve bitrgbtags device so that unmarked areas are preserved.

Similar to pngalpha, the bitrgbtags device needs to have a fillpage
procedure to fill the page to "GS_UNTOUCHED_TAG" | white (0xffffff)
Without this, the page was entirely set to "PATH" by the default
fillpage.

Note this will change EVERY bitrgbtags output in the regression results.

devices/gdevbit.c


2017-02-23 13:04:11 +0000
Chris Liddell <chris.liddell@artifex.com>
b0d12644776ab1517e549903ba3262c082759680

Bug 697607: correctly bounds check glyph index in TTFs

The update to Freetype removed a bounds check in the Freetype code when the
incremental API is in use (leaving it up to the caller to validate the glyph
index). This adds that bounds check to our glyph data callback.

As part of that, return the trueNumGlyphs and numGlyphs varaibles in the
Ghostscript type 42 font structure to their (apparent) original intent:
trueNumGlyphs is the value read from the maxp table, whilst numGlyphs is a value
derived from the size of the loca table (see the bug for a fuller explanation).

base/gstype42.c
psi/zfapi.c


2017-02-23 11:30:22 +0000
Robin Watts <Robin.Watts@artifex.com>
4e646ef8103f3ab2ab9d7de64bd30cc2156f0441

Bug 696915: Fix buffer overread in mapped8_copy01.

If the stars align, we can overread by 1 source byte
in mapped8_copy01. Simple fix.

base/gdevm8.c


2017-02-22 17:24:24 -0800
Ray Johnston <ray.johnston@artifex.com>
cf279b8c4773e14045dd6b411c3a524c6ac39124

Fix SEGV is display device when PageSize needs bitmap > 2Gb

The display_put_params is supposed to revert to the original settings
if an error is encountered, but since it frees the display bitmap before
attempting to allocate the new one, if that allocation fails, the device
is left with a memory device that has an invald bitmap pointer.

Instead revert the settings and attempt to allocate a bitmap with those
settings. If that fails (unlikely) then gs_abort with an error message.

NB: It is preferable to free one bitmap before allocating the new one
in case we are near a system memory constraint.

devices/gdevdsp.c


2017-02-22 23:54:38 +0000
Robin Watts <robin.watts@artifex.com>
340b7c7f79d45ed36cd247ff0c13586e6b6a4763

Bug 696520: Avoid dereferencing NULL in epson devices.

Adopt Peter Cherepanov's patch to avoid dereferencing NULL.

Only calculate the pure color if we know we're going to need
it - by which time we know it's safe to deference.

contrib/eplaser/gdevescv.c


2017-02-20 16:32:51 +0000
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
4c99ddc1dbd610d9d677750d6b1dabcb1cda8fb0

Bug 697545: Memory Squeezing fix.

Fix memory leaks for allocation event number 8 and 9
when memory squeezing:

gs -sDEVICE=bit -o /dev/null: examples/tiger.eps

psi/gs.c
psi/iapi.c
psi/imain.c


2017-02-22 16:41:33 +0000
Robin Watts <robin.watts@artifex.com>
21901b860ca033ed14168d3c191b39ff714946b5

Bug 697602: Remove 2 instances of variable shadowing.

Hard to believe these are right because setting code
and then falling out of scope doesn't achieve much.

base/gp_wxpsprn.cpp


2017-02-22 08:11:48 -0800
Michael Vrhel <michael.vrhel@artifex.com>
f8d299c399312fdd41958843a101db36353ad8e2

Avoid getenv call in openjpeg

getenv is not allowed in certain cases causing linking
issues. This fix should be pushed to the openjpeg
group. Thanks to Chris for the fix.

openjpeg/src/lib/openjp2/j2k.c


2017-02-21 16:46:07 +0000
Chris Liddell <chris.liddell@artifex.com>
8e8831a02f172490d7b175e54c7d15814acacea4

Update bytes_decoded for the non-cache code path.

If a glyph is being rendered without going through the glyph cache, we still
must update the 'bytes_decoded' entry in the text enumerator.

base/gxchar.c


2017-02-20 10:16:32 +0000
Chris Liddell <chris.liddell@artifex.com>
948d880467b2436813f7ffe5d1bd694c9475093c

Bug 694269: valgrind issues in Type 1 charstring interpreter

1) Bounds check the charstring data so we don't run off the end of the buffer

2) Initialise various entries in the Type 1 hinter state: in a well formed
font these will never be used without being set from the charstring, but in
a broken font, they can be used without being set.

3) Initialise the (sacrificial) path we use when retrieving glyph metrics etc.

4) Initialise the contents of the stack

base/gstype1.c
base/gxhintn.c
base/gxpath.c
base/gxtype1.c
base/gxtype1.h


2017-02-17 11:07:41 +0000
Chris Liddell <chris.liddell@artifex.com>
64c433d69b7732ae919a029dbf4b635133c97f03

Bug 694250: bounds check in TTF hinting code

Broken font tries to access *way* off the end of the opcode buffer. Check the
index before using it

base/ttinterp.c


2017-02-17 11:33:36 +0000
Chris Liddell <chris.liddell@artifex.com>
83b54c55a485a17124321d437e8207515396024a

Bug 694268: init stack based data.

devices/vector/gdevpdfd.c


2017-02-16 10:27:22 +0000
Chris Liddell <chris.liddell@artifex.com>
cf60a549d2413ae96b17010f0a69f82b797d33e3

Fix low memory crash in native font enumeration.

psi/zfontenum.c


2017-02-20 10:24:14 -0800
Ray Johnston <ray.johnston@artifex.com>
12091a85336f5c422545f03b4afcd1ea7362a10e

Fix misspelled TUPLTYPE in PAM header for bitrgbtags output.

Also add in DEPTH 4

devices/gdevbit.c


2017-02-20 15:58:03 +0000
Robin Watts <robin.watts@artifex.com>
8e918ac9ca06971534c7e39087ecca05c3809ce7

Update bmpcmp to cope with PAMs with RGB_TAG input.

We treat these as CMYK PAMs for now. This should be enough for
us to spot differences in the false color images produced.

toolbin/bmpcmp.c


2017-02-20 15:48:47 +0000
Robin Watts <robin.watts@artifex.com>
f21824bbf5bd1c0ba8cb19855a8fbc5e0681ff74

Update bitrgbtags device to use better header.

The bit devices output raw data.

The bittagsrgb device outputs rgb + a tag plane, with a PPM header.
The PPM header tells code to expect 3 bytes of image data, not 4,
so is wrong. Here we change it over to use a PAM header (of type
RGB_TAG).

This allows bmpcmp to be amended to cope better.

devices/gdevbit.c


2017-02-20 09:45:18 +0000
Ken Sharp <ken.sharp@artifex.com>
ecceafe3abba2714ef9b432035fe0739d9b1a283

Resolve image enumerator ownership on error

Bug #697596 "Use-After-Free in i_free_object()"

There is confusion over ownership of 'penum' between gx_begin_image1(),
gx_begin_image4() and gx_image_enum_begin() which is called from these
two functions (and only from these two functions).

The enumerator is allocated in gx_begin_image?() and freed there if
gx_image_enum_begin() returns an error. However, gx_image_enum_begin()
also frees the enumerator on an error; except that it doesn't always do
so. Its a large function and there are at least 9 ways to exit it, only
4 of which free the enumerator.

This commit removes the 'free' instances from gx_image_enum_begin()
leaving the cleanup as the responsibility of the calling code, which
performed the allocation.

base/gxipixel.c


2017-02-19 10:13:53 -0800
Ray Johnston <ray.johnston@artifex.com>
8452f9238959a4d518af365812bf031fe4d8d4b7

Fix Coverity CID 141336 -- Indentation gripe.

base/gdevprn.c


2017-02-06 19:21:43 -0800
Ray Johnston <ray.johnston@artifex.com>
eccf38345588ced6595d3414fca10098e9855da3

Add -dDumpXML to toolbin/pdf_info.ps options and fix -dDumpFontsNeeded

As an example of getting even more info from the PDF, add -dDumpXML to
dump the PDF Metadata (if any).

Also a problem found with -dDumpFontsNeeded=false was fixed.

usage to dump the basic info and Metadata:
gs -q -dDumpXML -dDumpMediaSizes=false -dDumpFontsNeeded=false -- \
toolbin/pdf_info.ps examples/annots.pdf

toolbin/pdf_info.ps


2017-02-18 17:57:18 -0700
Henry Stiles <henry.stiles@artifex.com>
e548d290d7d052a32e65493a703e1276230554c3

Fix 697576: false colors with pxlcolor.

PXL high level image processing does not support DeviceN, fall back to
rendering rectangles.

devices/vector/gdevpx.c


2017-02-18 08:50:48 -0700
Henry Stiles <henry.stiles@artifex.com>
cb5ec3dc7d0214ca3a784f9630b0775142c2ec08

Fix bug #687561, bad parsing of intellifont data.

The previous code read the metric offset field at the wrong positon (8
vs. 6) resulting in a value that caused a range check error. Further,
the range checking which checked the offsets were ordered is not
useful or correct, and has been removed. There is nothing in the
documentation to indicate the offsets must be ordered and showing
order does not help in preventing out of bounds access.

pcl/pcl/pcsfont.c


2017-02-16 21:47:47 -0800
Ray Johnston <ray.johnston@artifex.com>
c139c069968a59bc53e45d8373dd70d30278d152

Change -Za output to omit the (mostly useless) opening/closing clump messages

The -ZA is noisier so, keep these messages for that debug level (for now).
I've worked with Ghostscript allocators for MANY years and have yet to
find these messages useful. This is a precursor to totally deleting these
messages.

base/gsalloc.c


2017-02-16 16:37:28 -0800
Ray Johnston <ray.johnston@artifex.com>
88201849f123642dac3920a0bad5e68290280798

Fix incorrect calculation of pdf14 number of components.

This was seen with DeviceN devices (psdcmyk, tiffsep, ...) with the file:
tests_private/comparefiles/Altona_Technical_v20_x4.pdf resulting in
Error messages and warnings that "Output may be incorrect". With the
-dPDFSTOPONERROR option, an reangecheck error is reported.

base/gdevp14.c


2017-02-16 07:56:26 +0000
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
7bb2ad6cce75aae3ebedaa5883e1ecd6ba19b52d

Bug 697545: Memory Squeezing fix.

Fix for 'red 85546'. This is a SEGV seen at allocation event
85546 when memory squeezing:

gs -sDEVICE=bit -o /dev/null: examples/tiger.eps

Also account for all the other places that allocate a new
colorspace without checking the returned value.

base/gsgstate.c
base/gsicc_manage.c
base/gsimage.c
base/gsptype1.c
base/gstrans.c
base/gxclrast.c
devices/vector/gdevpdfb.c
devices/vector/gdevpdfc.c
devices/vector/gdevpdfi.c
devices/vector/gdevpsdi.c


2017-01-29 11:14:39 -0800
Ray Johnston <ray.johnston@artifex.com>
40a82d9e72340b8547f0d45709693e456465ccfd

Fix Bug 697502, problems with NumRenderingThreads exceeding available RAM

The logic that determined the amount of printer buffer space, and allocated it
was including the ESTIMATED pdf14 transparency buffer space, but we only need
to make sure that amount of space is available, not actually allocate it (since
then it wouldn't be availble when needed).

if there wasn't enough memory for the band buffer when a thread's clist reader
was opened, gdev_prn_setup_as_command_list would try reducing the BufferSpace
(by successive dividing by 2) until it could fit. This would result in a
reader band size that did not match what was used to write the clist. This
so we force the BandBufferSpace to be exactly the same as was used in the writer
using the cdev page_info.band_params. The tile_cache_size was added to the
space_params used to set up the thread clist device to make it match that used
by the writer.

In order to make sure we don't "over commit" in creating threads we reserve
an extra amount per thread, currently 2 Mb plus the ht_cache size times the
number of components, plus when the page uses transparency, we increase it by
the ESTIMATED_PDF14_ROW_SPACE times the band_height. We further increase it by
the size of the link profiles and the size of the icclink profiles (CURRENTLY
ESTIMATED). We free the reserve area as we start threads.

Also when an allocation for a thread failed, the 'band' used for next_band was
being decremented but it did not need to be since it was already the correct value.
This had caused a problem with threads getting started for the wrong band.

Fix gx_ht_read_and_install to prevent double free if gx_gstate_dev_ht_install
gets an error (VMerror).

Fix gdevbit so that we don't keep going after get_bits returns an error.

TODO: collect the size of the icclinks rather than a rather worst case value
currently estimated.

base/gdevprn.c
base/gsht.c
base/gsicc_manage.c
base/gxclist.c
base/gxclthrd.c
base/gxdevcli.h
base/gxdhtserial.c
devices/gdevbit.c


2017-02-16 08:52:48 +0000
Ken Sharp <ken.sharp@artifex.com>
89371a73c6d97606ca61884b555b7c13ec1534ac

Fix segfaults in low memory conditions

Bug 697572 "Segfaults when ps2write runs out of memory"

Add some return code checks in pdfwrite/ps2write, check a stream when
trying to close an 'aside', add a check for error return codes when
rendering a cached glyph bitmap.

base/gxccache.c
devices/vector/gdevpdfb.c
devices/vector/gdevpdfi.c
devices/vector/gdevpdfj.c
devices/vector/gdevpdfo.c
devices/vector/gdevpdti.c
devices/vector/gdevpdtt.c


2017-02-11 04:30:56 +0000
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
4d2b25f06c25e6e3e2b1bf319481a7442d42af8a

Bug 697531 : Tidy up unused code.

The first patch for this bug made the error return from
jbig2_word_stream_buf_get_next_word pointless so this
patch removes all the remaining redundant code.

jbig2_word_stream_buf_get_next_word does not need to return
any value so this is now defined as a void type and the rest
of the code has been updated accordingly.

jbig2dec/jbig2.c
jbig2dec/jbig2_arith.c
jbig2dec/jbig2_arith_iaid.c
jbig2dec/jbig2_arith_int.c
jbig2dec/jbig2_generic.c
jbig2dec/jbig2_huffman.c
jbig2dec/jbig2_priv.h
jbig2dec/jbig2_refinement.c


2017-02-15 06:13:55 -0800
Ray Johnston <ray.johnston@artifex.com>
1f8ada0d7e2c19138038bccd585e412b1f7a0267

Fix ignored return code in pdf14 transparency.

This fixes segfaults that pop up later. Found when testing multi-threaded
rendering with (somewhat) constrained memory (-K256000) on the file:
tests_private/pdf/sumatra/x_-_renders_slowly.pdf.ppmraw.300.0

base/gdevp14.c


2017-02-15 14:59:27 +0000
Ken Sharp <ken.sharp@artifex.com>
460ef0691145c8c81e238f61baa5009c29838304

pdfwrite - improve commit ad3e0de3e3ca33f00c81c071560bf6c9f4d5a0f0

Use gs_note_error instead of simply returning an error, and don't
bother checking pdfont, since we check for NULL immediately above.

devices/vector/gdevpdtt.c


2017-02-14 16:47:59 +0000
Chris Liddell <chris.liddell@artifex.com>
120f8533b705142ef83b899736e41e5739df5fc2

Tweak the string that controls the greeting message

For GPL releases we print a greeting message on execution that states the
software is supplied without warranty.

So, we should check for it being the GPL release before printing it.

Resource/Init/gs_init.ps


2017-02-15 10:01:39 +0000
Ken Sharp <ken.sharp@artifex.com>
ad3e0de3e3ca33f00c81c071560bf6c9f4d5a0f0

pdfwrite - don't seg fault for Line Printer font and UFST

Using the PCL Line Printer Font, when built to use UFST, can't be
handled with pdfwrite currently. In fact, using UFST with pdfwrite
results in garbage output anyway.

However, we should not seg fault. So here we check to see if we have a
PDF Font resource associated with a native font, and if we don't have
one when we need it, we give up and signal an invalidfont error.

devices/vector/gdevpdtt.c


2017-02-14 11:50:34 +0000
Robin Watts <robin.watts@artifex.com>
836e9a34c17b8bc2fdb4376f572982dfe1412ae0

Make frac31s hold values in the defined range in all cases.

frac31s are supposed to hold values where 0x7ff..... represents 1.

The code, however, currently converts to and from devn values using
0x00007ff8 as 1.

Either we need to update the docs, or we need to fix the code to be
consistent. This is an attempt at the latter.

base/gdevdsha.c
base/gscicach.c
base/gxcvalue.h
base/gxfrac.h
base/gxshade6.c


2017-02-14 15:37:43 +0000
Ken Sharp <ken.sharp@artifex.com>
b969fb501f59d807d54fcfc186b7b97b55cebe0f

XPS interpreter - fix some Coverity warnings

Check a few values read from TT tables to satisfy Coverity 'tainted
scalar' errors.

May need some additional changes, but I can't see any way to validate
the unsigned 32 bit values.

xps/xpsfont.c


2017-02-14 12:48:10 +0000
Chris Liddell <chris.liddell@artifex.com>
7273aa3cd04e0acb212e335ab6b3f360cbd727c9

Fix SAFER issue with filenameforall

With the change to ensure we only apply SAFER permissions to real file system
operations (so only on '%os%' and not on other PS '%<device>%' devices), the
way filenameforall called the permission checking function meant it did not
work correctly.

Basically, check_file_permissions() and co must have a valid iodev parameter
passed to them to function correctly.

So, fix that call.

psi/zfile.c


2017-02-14 10:22:46 +0000
Chris Liddell <chris.liddell@artifex.com>
b3acfdeaf1eb63a07e8169ea4c30ace7522054bc

Yet more SAFER problems with .libfile

With the change to ensure we only apply SAFER permissions to real file system
operations (so only on '%os%' and not on other PS '%<device>%' devices), the
.libfile call was dropping through without being restricted.

This changes the .libfile code to call the permissions checking function
properly.

psi/zfile.c


2017-02-14 09:37:55 +0000
Chris Liddell <chris.liddell@artifex.com>
3d14e0b20dfdc05cda60f7a9a4c78e9d3ee206e2

Split out $(MAKE) from recursive make calls

Commit 8acec58309 consolidate the common parts of the various recursive make
calls. Turns out, this breaks parallel make, as it defeats the make
algorithm which spots a make command line. As a result, none of those recursive
make calls would do parallel builds.

So, this time, we keep the options consolidated into a make variable, but put
back the $(MAKE) call explicitly for each recursive call

base/unix-end.mak


2017-02-13 16:02:54 +0000
Chris Liddell <chris.liddell@artifex.com>
e36d3979ebcaa1ce28f7c58e7e1c7a5959816eb8

Fix Windows UFST build.

psi/msvc.mak
windows/ghostscript-ufst.vcproj


2017-02-09 20:32:56 +0000
Chris Liddell <chris.liddell@artifex.com>
c7d5567fbc5f98488761ab93eaed60f1ac26023e

Bug 697484: fix mkromfs memory leak

In commit aa28186288 we missed the need to free some of the memory used during
the file name sorting phase.

base/mkromfs.c


2017-02-09 15:54:42 +0000
Chris Liddell <chris.liddell@artifex.com>
e476d710841d8be4d4e56c2b9e468e914f977161

ramfs: fix modes other than (r) and (w)

The (a), (r+) and (w+) modes were not working correctly. The "core" code of the
ramfs was correct, but the "glue" code between the Ghostscript stream API
and the ramfs core was not setting flags to support those.

Conversely, the ramfs "glue" code was not setting the permissions flags
correctly in the stream objects it created, when using the "+" modes.

Also, (w) and (w+) were not truncating the file on opening.

Finally, tweak the definition of the various read/write/etc flags for the
ramfs code so the values match those used in the stream API (this makes fixing
the flags in the stream objects much simpler).

base/gsioram.c
base/lib.mak
base/ramfs.h


2017-02-07 15:44:52 +0000
Chris Liddell <chris.liddell@artifex.com>
42fd2f459098bfda17ca8d29195ada57154cfe06

Change how we check for artibrary file accesses

When we apply the SAFER restrictions, we have to *not* apply the rules
for Postscript devices (such as %rom%, %calendar% etc), we only want to apply
the restrictions to the "real" file system (%os%).

Previously the code was checking if the iodev's "open_file" method was set to
the one for the %os% device, but that is actually not set (it is intentionally
NULL), so here we check the i/o device instance to ensure it is not the
i/o device instance for %os%

psi/zfile.c


2017-02-01 12:46:57 +0000
Chris Liddell <chris.liddell@artifex.com>
dd3c9ba2839ada5162aaccfeb442a958bfea637c

Build exes from static lib builds.

Add targets to build executables linked to the static library builds, meaning we
can actually test the static libs we create.

base/unix-end.mak
base/unixlink.mak


2017-01-12 20:55:11 +0100
Stefan Brüns <stefan.bruens@rwth-aachen.de>
aa2818628843205283c563865cd56b4091f2e37f

Bug 697484: mkromfs: sort gp_enumerate_files output....

for deterministic ROM contents

gp_enumerate_files_next returns dir entries in the same order as returned
by readdir. Sort by name to generate deterministic output.

base/mkromfs.c


2017-01-12 18:04:57 +0100
Stefan Brüns <stefan.bruens@rwth-aachen.de>
98696f718b5c0f9a5fd9c33d61f81da469b9a4e1

Bug 697484: mkromfs: make build reproducible.....

use buildtime from SOURCE_DATE_EPOCH

The environment variable SOURCE_DATE_EPOCH is the common approach for
getting reproducible timestamps and thus builds. In case the variable
is not set, keep using the current time of the mkromfs run.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>

base/mkromfs.c


2017-02-07 22:15:58 +0000
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
4c7b41dff7d57be0e13de15c45b0296602e63472

Bug 697531 : Fix decoder error on JBIG2 compressed image.

The problem is in jbig2_word_stream_buf_get_next_word
returning -1 and sending a fail error causing the whole
file to fail.

Now when the buffer is exhausted, the returned value is set
to zero so that the decoder does not try to use an
unintialised value.

This now means the error return is pointless and another
commit will follow this one to tidy up the unused code.

jbig2dec/jbig2.c


2017-02-08 10:46:58 -0800
Ray Johnston <ray.johnston@artifex.com>
7ca4d2cc269effd69273112ec7ad9d40076abbc1

Increase PDF 1.4 transparency ESTIMATED_ROW_SPACE

Testing showed that the ESTIMATED_PDF14_ROW_SPACE was too optimistic, so
increase NUM_PDF14_BUFFERS to 4 and use the target num_components (primarily
for spot color devices such as tiffsep) to try and make this more robust.
Still a guess, but works better as tested with multi-threaded rendering.

Note, the band height chosen based on the BufferSpace will be different
when the page has transparency, so there are differences. I have reviewed
them and they are all 1 pixel differences or invisible color differences.

base/gstrans.h


2017-02-08 14:49:35 +0000
Robin Watts <robin.watts@artifex.com>
9284128b1a16c21a95570f4c79258590839a10c7

Further fixes to ramfs.

All allocations are made using fs->memory, so all frees should be
done with it too. This wasn't caught by memory squeezing (or other
tests), because we don't actually use the ramdisc.

base/ramfs.c


2017-02-07 20:28:28 -0800
Ray Johnston <ray.johnston@artifex.com>
cffb5712bc10c2c2f46adf311fc74aaae74cb784

Commit a9a58bb95 was incorrect, clearing some values that it shouldn't

The penum->rect values were cleared, and this didn't cover all uses of
gx_image_enum_alloc. Also, return *ppenum NULL if alloc fails in case the
caller doesn't check the return code. Also, if we fail the enum_begin,
free the enum and set *pinfo to NULL.

base/gximage1.c
base/gximage4.c
base/gxipixel.c


2017-02-07 19:32:08 +0000
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
a1b951c274a1d48340cfbaddb1308c92836dbc61

Bug 697545: Memory Squeezing fix.

Fix for 'red 242'. This is a SEGV seen at allocation event
242 when memory squeezing:

gs -sDEVICE=bit -o /dev/null: examples/tiger.eps

base/ramfs.c


2017-02-07 19:52:51 +0000
Ken Sharp <ken.sharp@artifex.com>
6084cc0a0cb1cd6e0d5b9be044622c74a16a0573

XPS interpreter - add a reverse GID lookup for the benefit of pdfwrite

Bug #697304 "Encoding gets lost when generating PDF"

Prior to this commit the XPS interpreter, like the PCL interpreter, did
not really return a character code when asked for an equivalent for a
GID. Instead it returned the 'last' character code.

For strings with multiple characters processed at once, this meant that
all the characters in the string were assigned the same 'code' as the
last character in the string. Also there was no reason to assume that
code was even a Unicode value.

This commit adds code to reverse the TrueType CMAP subtable lookup;
given a GID it will return a character code. We then use the resulting
character code in pdfwrite (which is the only device to use this method)
to build a ToUnicode CMap in the output PDF file.

There are a number of caveats with this commit;

I've only been able to create XPS files with fonts containing format 4
CMAP subtables. While I've coded the others (but not 2 or 8 because the
normal character code -> GID mapping doesn't support them either) I
have no way to actually test whether they work

I'm not certain whether its possible to get an XPS file containing a
font which does not have a 3,1 CMAP. Again I've not been able to create
such a file, if we ever encounter one this code will likely not work
properly.


I have tested Latin and Far Eastern scripts, and files which use more
than 256 glyphs from a single font. All of these appear to work as
expected. When more than 256 glyphs are used from the same font, we
create a PDF file with multiple simple subsets of the font, each with
less than 256 glyphs. Each subset has its own ToUnicode CMap and so
cut&paste works as expected.

No differences expected, we cannot cluster test this code.

xps/ghostxps.h
xps/xpsfont.c
xps/xpsttf.c


2017-02-07 09:42:43 -0800
Ray Johnston <ray.johnston@artifex.com>
a9a58bb95e4a41014f42cae9393767b26da3aa80

Fix dangling pointer in gx_image_enum after malloc fail.

Yet another, probably a squeezing failure since it failed with:
-K30000 -dMaxBitmap=0 -r300 -sDEVICE=pkmraw -o nul: tests/pdf/cmyk_blend.pdf

base/gximage1.c


2017-02-06 19:20:40 +0000
Robin Watts <robin.watts@artifex.com>
a65893f973c65d2ba22f8b2a2c6cf0822fc8c1da

Bug 697555: Fix UTF-8 handling of args.

The logic for checking for continuation bytes in UTF-8 was
broken. Continuation bytes have the top bit set, but not the top 2
bits set.

This leaves the issue of @files on windows always being taken
as UTF-8.

base/gsargs.c


2017-02-01 16:31:03 +0000
Chris Liddell <chris.liddell@artifex.com>
c1834eb0cf024cf51231a19b975d97f33c559e0c

Fix Luratech Linux build use if "inline"

Compilers don't seem to like "inline" being used without "static", so tweak the
build flags for Luratech so that doesn't happen.

configure.ac


2017-02-06 12:31:12 +0000
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
aaf0b87aa5e0c41a32a290c836a5b3811433c561

Fix memory leak in psi/imain.c

Remove unused "paths" allocation.

psi/imain.c


2017-02-06 09:49:45 +0000
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
e4439a505ed3ac582d7f65260678bc9dca03ce54

Bug 697545: Memory Squeezing fix.

Fix for 'red 62'. This is a SEGV seen at allocation event
62 when memory squeezing:

gs -sDEVICE=bit -o /dev/null: examples/tiger.eps

Also, improve the macro for FREE in base/gxclmem.c

base/gsmemory.h
base/gxclmem.c


2016-11-27 16:38:26 +0000
Ken Sharp <ken.sharp@artifex.com>
2bf2b4cebe44b74229e086380c3c25110f37aed0

pdfwrite - where possible, preserve annotations

This allows us to preserve many (but not all) annotation from an
input PDF file as annotations in the output PDF file. This only
works with the pdfwrite device, the ps2write device does not
write pdfmarks to the output.

Certain kinds of annotations (eg Link annotations) cannot be
preserved, because they require a page (or other object) destination
which we can't easily know at the time we create the pdfmark.

Widget annotations are not preserved as these only have relvance
in AcroForms, and since we don't preserve AcroForms, its much
better to render the Widgets, otherwise their appearance will
be lost along with the AcroForm data.

It is possible that this behaviour may not be desirable, and
that there could be bugs in this code, so a new switch
'-dPreserveAnnots' is defined for use with the pdfwrite device
only. If set to false the old behaviour returns, and annotations
will be rendered instead of preserved.

There are a few differences with this code; a few progressions,
a few 'differences' and one file where the Stamp annotation no
longer renders. THis is because the Form for the Apperance is
invliad (leaves junk on the stack) and attempts to work around
this ran into al kinds of trouble. In the end I ran out of time
and chose to accept the error, the form is incorrect after all.

Resource/Init/pdf_draw.ps
Resource/Init/pdf_main.ps
base/gdevp14.c
base/gsform1.h
base/gxdevsop.h
devices/vector/gdevpdfb.h
devices/vector/gdevpdfi.c
devices/vector/gdevpdfu.c
devices/vector/gdevpdfx.h
doc/VectorDevices.htm
psi/zform.c
psi/zpdfops.c


2017-02-04 08:36:05 +0000
Robin Watts <robin.watts@artifex.com>
678e660cd4efcbf155675539c13a584cdffb5258

Fix memento builds.

base/gsrefct.h
base/lib.mak


2017-02-03 12:29:20 +0000
Robin Watts <robin.watts@artifex.com>
59d509244ddb6fe9719a6205bf5657268efcb6d6

Add missing \n to error message.

psi/interp.c


2017-02-03 02:53:02 -0800
Robin Watts <Robin.Watts@artifex.com>
1392f5d2e7fe73bce8ff56cef62e4205f8a53bfd

Memory squeezing fixes (PCL)

Harden PCL (and gslibctx etc) against memory failures
during initialisation.

base/gsicc_manage.c
base/gslibctx.c
base/gslibctx.h
base/gsmalloc.c
pcl/pl/plalloc.c
pcl/pl/plmain.c


2017-02-03 02:48:52 -0800
Robin Watts <Robin.Watts@artifex.com>
92ecd60a5218eb5bd1ba5e497e5fd2550112b5ed

Destructors should cope with being called with NULL.

Tweak pl level so that neat error closedown is easier.

pcl/pl/pltop.c


2017-02-02 20:12:33 +0000
Robin Watts <robin.watts@artifex.com>
dd6fdc6dd668776d7b9570dd07e1e1790fcba8fb

Fix Memento builds.

Some headers were sometimes being used with memento.h having
been included, and sometimes not. This lead to differing
redefinitions of 'free'.

base/gsfunc.h
base/lib.mak
base/ttfoutl.h


2017-01-27 16:32:07 +0000
Robin Watts <robin.watts@artifex.com>
9060c91ef75d7d36cfc1fd975e3368415df69b3a

New scan converter fix.

Don't convert ex and ey from endpoints to distance until *after*
we have finished using it as an endpoint.

base/gxscanc.c


2017-02-02 04:07:47 -0800
Robin Watts <Robin.Watts@artifex.com>
d8af3708a4907e98b5db54860d379702355dc077

Tweak gs to enable fast Memento memory squeezing.

Memento can memory squeeze in 2 modes; firstly it can repeatedly
run the same job again and again failing at subsequent points.

This has the advantage of being simple, but it has the problem
of being slow, in that processing is repeated again and again.

A faster mode is available where we run to the point of failure,
then fork. The child proceeds to fail, and once failed, the
parent then continues for 1 more allocation then repeats the
process. Thus the only repeated work is in the failure cases.

The downside to this is that fork copes very badly with
multi-threaded programs. Firstly, it only duplicates the current
thread - this means that we can only use it with single
threaded programs. Secondly, even with single threaded programs
the forked child goes wrong if you try to use mutexes etc.

This means that in order to use GS with the fast memento memory
squeezer, we need to ensure we don't create mutexes etc. We
do this by adding a MEMENTO_SQUEEZE_BUILD define to gs.

base/gp_psync.c
base/gsicc_cache.c
base/gsicc_lcms2.c
base/gsicc_manage.c
base/gsmalloc.c
base/sjpx_openjpeg.c


2017-02-02 03:34:22 -0800
Robin Watts <Robin.Watts@artifex.com>
8cca94c736bb4babc676bd2ce49176d93058b8b3

Memento memory squeezing tweaks.

Add Memento_bt() - a function to output the backtrace
to stderr.

Call this when we fork for a memory squeeze.

Forking only clones the active thread, so we can only use
the forking memory squeezer on single threaded tasks. Even
with single threaded tasks, you can't unlock mutexes in
the child that were taken in the parent. This means that
we need to disable mutexes in the main application if we
want to memory squeeze safely.

Also tweak the time we spend sleeping while waiting for a child
to die. This makes a huge difference to the runtime.

If we die during squeezing due to a SEGV, then don't bother
listing the blocks that we leaked.

base/memento.c
base/memento.h


2017-02-01 19:46:29 -0800
Ray Johnston <ray.johnston@artifex.com>
de2314431f400a439cb2bcebb1152fc206b8804d

Fix ignored return code for ICC profile device parameters.

All of the uses of gx_default_put_icc_colorants and gx_default_put_icc
ignored the return code which might be VMerror. Found when testing with
multi-threaded rendering and low memory conditions.

base/gsdparam.c


2017-02-01 08:40:01 -0800
Robin Watts <Robin.Watts@artifex.com>
cead170cb9e8dc25e59e3c8d7d8616d8b2f7119a

Memento: Improve memory squeezing.

It seems that Memory squeezing can sometimes run into
problems with the child hanging after a fork. This seems
to be related to the child process SEGVing and the
signal handler not picking it up.

I've introduced a workaround so that the parent now only
waits a maximum of 30 seconds before killing the child and
continuing.

base/memento.c


2017-01-25 21:42:53 -0800
Michael Vrhel <michael.vrhel@artifex.com>
3a9d6ebe560689930eaf3aca00652b22cef26423

Bug 626295 Text Knockout Transparency

When we have transparency, text knockout set,
with either a non-normal blend mode or an
opacity less than 1.0, we need to push a
non-isolated knockout group. Graphic state
changes can occur between the BT and ET commands.
As such, we will need to handling the push
operation in pdf14_text_begin (and the clist version)
when the conditions are right. This is a special
group that indicates its uniqueness with a text_group
flag. This flag is included through the clist, the
group as well as the device. Once set, subsequent
calls to pdf14_text_begin will not push another group.
The group is popped with ET is encountered through the
zendtransparencytextgroup command from the interpreter.
If the pdf14 device is not currently in a text group,
this group pop is ignored (and not even placed in
the clist). The pdfwrite compositor logic, ignores
and group pushes that occur with the text_group set
as well as all PDF14_END_TRANS_TEXT_GROUP types.
Due to confusion of with the annotation text writing
methods, I had to add a PDF14_BEGIN_TRANS_TEXT_GROUP
to denote when we encounter a BT in the source file
to ensure that we are only going to push groups if
our conditions are right and we are in a BT/ET pair and
not drawing a text annotation.

One optimization we may want to look at doing later, is
determining the bbox for the area between BT and ET.
Currently the group push is the same size as the parent
group which is likely much to large.

Resource/Init/pdf_ops.ps
base/gdevp14.c
base/gdevp14.h
base/gstparam.h
base/gstrans.c
base/gstrans.h
devices/vector/gdevpdft.c
psi/ztrans.c


2017-01-31 19:05:05 +0000
Chris Liddell <chris.liddell@artifex.com>
04c75cebae5912610526c997604f8d15fb933682

Fix a typo/thinko in the static lib build changes.

I'd mistakenly used $(TOP_OBJ) instead of $(XPS_TOP_OBJS) for the XPS
static library.

base/unixlink.mak


2017-01-31 15:04:55 +0000
Chris Liddell <chris.liddell@artifex.com>
ba07b2df0ea519b1a6e9fcdfe6f7a25be92264fa

Fix Windows build

In adding/tidying the Unix-like static library targets, I forgot to tweak the
VS nmake Makefiles to cope with the revisions. Done here.

psi/msvc.mak


2017-01-31 10:05:11 +0000
Chris Liddell <chris.liddell@artifex.com>
8acec5830978b1199b3cda4eae3064deb4d91818

Consolidate recurive make calls

We have various classes of target (e.g. debug, profile etc) that rely on
recursively calling make with specific sets of options per class.

Put the make call and the options into a macro for each class

base/unix-end.mak


2017-01-31 09:12:34 +0000
Chris Liddell <chris.liddell@artifex.com>
d9e40fcbf0a213e6717e1ab3bd234f5b20ca1270

Add debug static lib targets.

For neatness, I've moved the "visible" targets to unix-end.mak with the other
Unix-like targets.

And then added the recursive make calls to build debug versions.

base/unix-end.mak
base/unixlink.mak


2017-01-31 08:57:30 +0000
Chris Liddell <chris.liddell@artifex.com>
7718fe48373ff62f140d33080af9f49fc21b9f39

Tidy/Add static lib target(s).

Tidy up the libgs target for the gs static library on Unix-like systems (since
we're now using it).

Rejig the PCL, XPS and PDL executable builds to a) more closely match the gs
one, and b) facilitate static library targets for those, too.

Add the static library targets for the PCL/XPS/PDL builds (libgpcl6, libgxps
and libgpdl respectively).

base/gs.mak
base/unixlink.mak
gpdl/gpdl.mak


2017-01-30 15:05:36 -0800
Michael Vrhel <michael.vrhel@artifex.com>
94278ad478278567dbdfcb87137676ff73e86c22

XPS Transparency check remote resource dictionary

The XPS interpreter checks for the presence of transparency
on the page. It was not checking remote resource dictionaries
but rather was assuming that they always had transparency
which resulted in an unneeded push of the pdf14 device when
going to a raster output device.

xps/xpsanalyze.c


2017-01-30 14:08:52 -0800
Michael Vrhel <michael.vrhel@artifex.com>
587d0a7edfd3519bd28981eb2703cfaaf11c747c

Fix coverity issues 140991 and 140990

Introduced from http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=91741e126688807cd086dad55158cd0cad63725a

xps/xpszip.c


2017-01-27 12:17:00 -0800
Michael Vrhel <michael.vrhel@artifex.com>
8cde4bc582904132bd8bb78e6c5da5ab2ebdb6ce

XPS Transparency check

The XPS interpreter code was not setting the device param to
indicate if a page had transparency. As such, the fact that
a page had transparency was not getting used in the decision
to invoke or not invoke the command list.

xps/ghostxps.h
xps/xpspage.c


2017-01-30 07:25:59 -0800
Ray Johnston <ray.johnston@artifex.com>
827ab0227853b9ee5491ceb76b178757aa2ab733

Fix a potential de-reference of a NULL pointer with -Zv

base/gdevp14.c


2017-01-27 13:24:32 -0800
Michael Vrhel <michael.vrhel@artifex.com>
91741e126688807cd086dad55158cd0cad63725a

xps: low memory null dereference

If the allocation in xps_new_part fails, it returns
a null object which is then getting dereferenced.

xps/xpszip.c


2017-01-26 11:35:38 -0800
Ray Johnston <ray.johnston@artifex.com>
c27947491f9b4bc87b09bff0648e1816ebd2af19

Segfault in low memory configurations

Testing with -K values for bug 697504, I was able to reproduce some
segfaults, but don't know if they relate to the one mentioned here and
on bug 691170 (which was closed as fixed), but these need to get fixed
in any case.

These occured because the init2 had not completed, but the interp was
being called to do more stuff than it could reasonably hope to do in
this case. Testing with -K values from 15000 down to 100 by 100 now
no longer segfaults.

psi/imain.c


2017-01-26 18:09:06 +0000
Robin Watts <robin.watts@artifex.com>
0734126eafa7c9212341886626d15d90ccce400f

Add XPS_INDIRECTED_FILE_ACCESS define

If defined, then the xps interpreter looks to use user
supplied xps_{fopen,ftell,fseek,getc,fread,fclose} functions
rather than gp_fopen,ftell,fseek,getc,fread,fclose.

xps/ghostxps.h
xps/xpsjxr.c
xps/xpszip.c


2017-01-25 14:41:17 +0000
Chris Liddell <chris.liddell@artifex.com>
68af8c3b1584d0b001c7bd96456caf7547a0229e

Bug 697503: Check resource path, and GenericResourceDir...

...paths when searching for resources.

This relates back to bug 694509.

If GenericResourceDir is set as a relative path, relative to a non-standard
GS_LIB search path, we have to prefix the resource path (Category/Key) with
the GenericResourceDir for the search path machinery to find the resource
file.

*However*, if the GenericResourceDir is set in the normal way (automagically
by the initialization), then just using the plan resource path is required.

So, try both the plain 'Category/Key' path, and the
'GenericResourceDir/Category/Key' path.

Resource/Init/gs_res.ps


2017-01-25 16:00:40 +0000
Robin Watts <Robin.Watts@artifex.com>
4d07b45685976bd38e5cec8062b3a61d2ada5575

Hide more JPEG entries.

base/gsjconf.h


2017-01-24 18:07:11 +0000
Robin Watts <Robin.Watts@artifex.com>
aeb0bfb6c99e1e1683a21f684c18c1363ccc16cb

Add more jpeg symbols to be hidden.

It seems these clash with the devboards software too.

base/gsjconf.h


2017-01-20 17:02:39 +0000
Robin Watts <Robin.Watts@artifex.com>
c7d005ac1c92a6fee43554fffd9a6f38c0a6b962

Add GS_NO_FILESYSTEM define for systems with no FS.

Some systems (such as ThreadX), have std headers that
define FILE, but do not actually have a real filing
system implementation. As such, they don't support
filing system enumeration.

We therefore introduce a GS_NO_FILESYSTEM define that
stubs out the code in these entrypoints.

At some point we may split the contents out to a different
platform, but this will probably require some careful
thinking about other functions in these files to avoid
duplication of code.

base/gdevpipe.c
base/gp_unifs.c
base/gp_unix.c
pcl/pl/pjparse.c


2017-01-19 18:49:01 +0000
Robin Watts <Robin.Watts@artifex.com>
9568153b12b80d477f3031b88631910082a55bc8

Add option to hide jpeg entrypoints.

If we define GS_HIDE_INTERNAL_JPEG on build, then a series of macros
is used to rename internal JPEG entrypoints. This can prevent
symbol clashes when linking with other libraries.

There may well be more symbols to add here in future, but this
seems to be enough to solve it for me now.

base/gsjconf.h


2017-01-24 12:41:12 +0000
Robin Watts <Robin.Watts@artifex.com>
aafd60bddbb3d5cfc0d9fb726d0cf81c51805c4c

Remove opj_clock.c from build.

Only defines one function, that isn't used, and doesn't compile
on all platforms.

base/openjpeg.mak


2017-01-24 12:41:05 +0000
Robin Watts <Robin.Watts@artifex.com>
ea534adfd0a3deed4f2a70d47fc9d78c1911d928

Fix icc34.h header to compile on ThreadX.

Honour HAVE_STDINT_H predefine.

Also, tweak the #ifdeffery to be more readable (IMHO).
Less nesting and rightward creep, and a more straightforward

base/icc34.h


2017-01-21 15:01:14 -0800
Ray Johnston <ray.johnston@artifex.com>
eead75f44a03517ad50702f3c65d8c5784b4bfbb

Fizes for the ramfs (%ram% device) (Bug 226943)

There were problems with the GC not tracing the s->file pointer from the
stream (assumed to be an OS item) so change to using non_gc_memory. Also
problems with writing buffers more that a single block (not advancing
in the source buffer).

The bytesavailable operator didn't work because there was a bogus file_limit
in the stream, and s_ram_available was wrong.

Change the "this" to "thisdirent" so that C++ debuggers (like VS) can
show the structure contents correctly.

The bug shows an example that can be used to run a PDF file from stdin
without needing to write a file to disk.

base/gsioram.c
base/ramfs.c


2017-01-23 12:33:22 +0000
Robin Watts <robin.watts@artifex.com>
024e9bd9a07ff906e91f78594c9d547f5228b3c6

Force some typedef enums to be 32 bits.

Modern C's are allowed to shrink typedef enums so that they are
only as large as required to cover all the values in the
enumeration. This can mean that typedef enums can now be byte
sized.

This works very badly when we have an array of them, take the
address and cast it to an int *. That int * is no longer
appropriately aligned for some compilers. This happens in the
get_param code.

We therefore add a trailing 'large' enum value to force the
enums to be large. This will break down if we ever have a platform
where ints are larger than 32bits.

base/gscms.h


2017-01-23 11:48:11 +0000
Robin Watts <robin.watts@artifex.com>
24cb576dd60e903466b2d78cc718b3dd4da19529

MSVC: Add %ram% FS to VS project.

windows/ghostscript.vcproj


2017-01-16 18:33:25 +0000
Robin Watts <Robin.Watts@artifex.com>
e6753115b8a4c72c5e526f2a0a3849391a255962

Use consistent types in API and C implementation.

base/gssprintf.c


2017-01-19 11:44:18 -0800
Michael Vrhel <michael.vrhel@artifex.com>
79d6e96a8db2956c8317fd8bdeb8d8db5fd0e212

Bug 697489 xps transparency issue

The xps interpreter was pushing transparency groups without
pushing the pdf14 device. The problem was that the interpreter
was not checking the glyphs in the resource dictionaries.

I also optimized the code to stop checking for transparency
once it finds transparency.

xps/xpsanalyze.c
xps/xpspage.c


2017-01-18 14:49:40 -0800
Michael Vrhel <michael.vrhel@artifex.com>
a9bd0b6d95b16d594983682ae387922507e70b98

Bug 697489 bitrgbtags segv

The clist compositor call was not returning the existing
compositing device in certain cases causing an issue
later in the code.

base/gdevp14.c


2017-01-18 13:24:20 -0800
Michael Vrhel <michael.vrhel@artifex.com>
56879003723e608173cdc063a8f2da4172f29a95

Bug 697488 segv in pattern code

The transparency code was not updating the bit depth
properly when we had a color space change in the presence
of spot colors

base/gdevp14.c


2017-01-18 09:43:24 -0800
Michael Vrhel <michael.vrhel@artifex.com>
b12adcc4c201e94e1f726c8fa6ad7eea8a5f4ca7

Bug 697435 bitrgbtags device

The bit depth in the device was not getting set correctly
during a color space change in the transparency code when
the target device includes tags.

base/gdevp14.c


2017-01-18 14:18:29 +0000
Chris Liddell <chris.liddell@artifex.com>
b5abd7391d4d065e6b4d05c119d2dd243bda2f4d

Bug 697482: handle cff with broken /Private data

The problem in this case is that the offset into the cff data for the /Private
dictionary definition is well beyond the end of the cff stream.

Bounds check the offset, and if it's nonsense, treat it as a zero length
/Private dictionary (in the hope that the font doesn't actually need it.

NOTE: /Private *is* a required entry, so *using* the font may throw an error.

psi/zfont2.c


2017-01-18 14:29:18 +0000
Chris Liddell <chris.liddell@artifex.com>
90d3fb2e75aea47501dceb298ccd4f4229d4a6f3

Fix error check/return logic in the CFF parser

psi/zfont2.c


2017-01-17 10:48:07 -0800
Michael Vrhel <michael.vrhel@artifex.com>
51c5aa09762602b5dd3982ff3b92e182f1637dd4

Bug 697435 bittags device blending color space

In the clist case, there was a mixup with the ICC profile
during playback. This fixes that issue. While the small
file in Bug 697433 works with this fix, the large file
(regression3.pdf) still shows 2 issues. When the blending
color space is -sBlendColorProfile=default_cmyk.icc at 300dpi
we see a dropped band (likely some confusion about the
pdf14/clist optimization). When we use no blending color
space we end up with a segv in clist_playback_band

base/gdevp14.c


2017-01-13 19:16:56 -0800
Michael Vrhel <michael.vrhel@artifex.com>
0dbfbb773e40d23de5052fc5641387dad5d79bae

Code cleanup. Remove unused code in transparency code.

base/gdevp14.c
base/gscolorbuffer.c
base/gscolorbuffer.h
base/lib.mak
windows/ghostscript.vcproj


2017-01-13 12:33:05 -0800
Michael Vrhel <michael.vrhel@artifex.com>
8aa6b2ae6b27912339548380b602b8e3e6d17db3

Bug 697435 Tags device with Blending color space

Allow the use of put_image when we specified a blending color space.

base/gdevp14.c


2017-01-12 13:25:04 -0800
Ray Johnston <ray.johnston@artifex.com>
7d97633daa0679a688a85a8a8805c261bd828a7e

Add bitrgbtags device to Windows default build.

psi/msvc.mak


2017-01-12 13:16:58 -0800
Ray Johnston <ray.johnston@artifex.com>
3434578b240b1e4bc34a0ce108595653e0994a11

Add basic support for CMYK PAM (P7) format files.

This works for the files generated by Ghostscript and mupdf, so it
is useful enough to add.

lib/viewpbm.ps


2017-01-11 09:58:34 -0800
Ray Johnston <ray.johnston@artifex.com>
0130e9cc9f196b4bd2e107cd71826210a8274c9d

Fix SEGV bug 697473 bitrgbtags device with transparency

The SEGV was caused by setting tos->n_planes to the wrong value if we
converted colors to a different number of color components. Also fix
clearing of the tags if the backdrop was NULL (leave it set as it was
by pdf14_buf_new to GS_UNKNOWN_TAG).

Lastly, the pdf14_put_image wasn't setting up the buffer pointers for
all of the planes (alpha and tag), so bit_put_image choked. This
probably would have caused a problem with pngalpha.

base/gdevp14.c


2017-01-11 10:08:42 +0000
Chris Liddell <chris.liddell@artifex.com>
e424a42d269a626db054fb76e481df011ec6f1d6

pdfwrite: set the 'bytes_decoded' value in the text enum

For CIDFont subsitutions (and spotting single byte space characters), we need
to know how many bytes were read from the input string for the current glyph,
hence we have the 'bytes_decoded' value. For one code path, pdfwrite was
failing to set the value.

devices/vector/gdevpdtc.c


2017-01-11 09:16:59 +0000
Chris Liddell <chris.liddell@artifex.com>
aedc5a96d855086711b8accd48bd014dd57b18fa

Fix the profile (pg) build.

base/unix-end.mak


2017-01-11 09:19:07 +0000
Ken Sharp <ken.sharp@artifex.com>
40869fa69cdb74126977e35c2028d4176d350cdb

Improve CIDFont rearranged font handling slightly

Noticed while investigating a customer problem. We do not handle
rearranged fonts (because they are a hideous hack) but we do have code
to at least process them. Unfortunately there's a typo in the code which
causes it to throw an error if its ever executed.

Fix the typo here.

The fact that this has never come up indicates how often this mess is
used; ie never.

Resource/Init/gs_cmap.ps


2017-01-04 13:13:14 +0000
Chris Liddell <chris.liddell@artifex.com>
8360852efab5643d93cc3b040832075e199cd205

Bug 697462: pdfwrite: avoid cached glyph use

When pdfwrite is accumulating a Type 3 font, and we want to try to capture the
CharProc (rather than falling back to a bitmap), we need to stop the core
font code from using a previously cached glyph bitmap (for example, from an
earlier stringwidth operation), so we're sure the CharProc gets executed.

If we don't ensure the cache doesn't get used, we end up in an infinite loop,
where pdfwrite repeatedly returns to the core to run the CharProc.

devices/vector/gdevpdtt.c


2017-01-06 15:37:08 -0800
Michael Vrhel <michael.vrhel@artifex.com>
3f4e699c31368a08b0146ef62f5b196315bd700d

Update color document with new GS logo

doc/GS9_Color_Management.pdf


2017-01-06 09:59:29 -0800
Michael Vrhel <michael.vrhel@artifex.com>
434ae2a49e9b6026a3ae1eeceb0f32b78a894ee1

Color code clean up.

base/gdevp14.c
base/gsicc_cache.c
base/gsicc_manage.c
base/gsicc_manage.h
psi/zicc.c


2017-01-06 09:56:15 -0800
Michael Vrhel <michael.vrhel@artifex.com>
32765969861bee5773b5f1207dae2500fa1fd506

Update color management documentation

doc/GS9_Color_Management.pdf
doc/GS9_Color_Management.tex


2017-01-05 15:21:22 +0000
Robin Watts <robin.watts@artifex.com>
2259f4c693d02a43c007cab6cb268fa4e6d6c542

Tidy variable naming in iapi.{c,h}

Use 'instance' consistently.

psi/iapi.c
psi/iapi.h


2017-01-03 14:37:26 +0000
Robin Watts <robin.watts@artifex.com>
2f45ea017e9691c2b817884746306d27e06e0199

Windows gs: Avoid unininitialised read.

pcl/pl/plwmainc.c
psi/dpmain.c
psi/dwmain.c
psi/dwmainc.c
psi/dxmain.c


2017-01-03 10:17:13 +0000
Robin Watts <robin.watts@artifex.com>
8071bb2950068a3c6a1b5a405d16548177503a14

New scan converter: Fix some warnings.

"ey is set and then never used" in some release builds.

Rejig the code to avoid this.

base/gxscanc.c


2017-01-02 18:27:50 +0000
Robin Watts <robin.watts@artifex.com>
06e756898579cd21dbff40ad30efff9571a549fe

New scan converter: Fix problems in trap fills.

I was calculating trapezium fills slightly wrong.

Also, I was filling the 'centre of a pixel' cases edgebuffers
with slightly incorrect values. Now the debugging shows that
we are getting exactly what we want in the example files I
have tried.

This results in much smoother edges on some shapes.

base/gxscanc.c


2017-01-02 18:25:08 +0000
Robin Watts <robin.watts@artifex.com>
fb1f10f6eaed79016dd924b2e5730160e9267fd3

New scan converter: Improved debugging.

Update the debugging output from the new scan converter to be
more useful.

base/gxscanc.c


2016-12-29 14:00:21 -0800
Michael Vrhel <michael.vrhel@artifex.com>
90fd0c7ca3efc1ddff64a86f4104b13b3ac969eb

Bug 697456. Dont create new ctx when pdf14 device reenabled

This bug had yet another weird case where the user created a
file that pushed the pdf14 device twice. We were in that case,
creating a new ctx and blowing away the original one with out
proper clean up. To avoid, only create a new one when we need it.

base/gdevp14.c


2016-12-29 12:00:40 -0800
Michael Vrhel <michael.vrhel@artifex.com>
d621292fb2c8157d9899dcd83fd04dd250e30fe4

Bug 697444 Unmatched transparency group pop

This issue can only occur if there is an unmatched group pop.
If the interpreter is doing that, then the interpreter is
broken. With this bug the user is intentionally doing it.
We now throw and error when it occurs.

base/gdevp14.c


2016-12-29 15:57:43 +0000
Robin Watts <Robin.Watts@artifex.com>
4bef1a1d32e29b68855616020dbff574b9cda08f

Bug 697453: Avoid divide by 0 in scan conversion code.

Arithmetic overflow due to extreme values in the scan conversion
code can cause a division by 0.

Avoid this with a simple extra check.

dx_old=cf814d81
endp->x_next=b0e859b9
alp->x_next=8069a73a

leads to dx_den = 0

base/gxfill.c


2016-12-29 13:39:50 +0000
Robin Watts <robin.watts@artifex.com>
0aeb0bbd41cc16e70ab6e4b1d56e0c510bf2a758

Bug 697423: Fix overflow in pngalpha.

The composite creation maths in the copy_alpha method overflowed
due to the alpha range being changed from 0..15 to 0..255 in
commit d9f041d6fe7eda89364df1424f85ace974ed0fec. Changing to
unsigned solves this.

devices/gdevpng.c


2016-12-28 18:34:03 +0000
Robin Watts <robin.watts@artifex.com>
a7f3177cb0ae8f56cfec52ea38a4f6f613c91055

New scan converter: Fix problems seen at local minima/maxima.

Sometimes the fill isn't quite right at the extremes of shapes.

This is due to a problem when we exactly align with scanlines.

See the output of tests_private/comparefiles/Bug696174.ps at 300dpi
for some examples. Look at the tie lines for the first notes in the
last line of page 2 - a scanlines worth of pixels are missing from
the top.

base/gxscanc.c


2016-12-28 14:16:00 +0000
Robin Watts <robin.watts@artifex.com>
79572779090e4f777bfd21996f04ff9bddcd3cbc

New scan converter: Fix zero height rectangle behaviour.

base/gxscanc.c


2016-12-27 16:18:40 +0000
Robin Watts <robin.watts@artifex.com>
290c044b5156b8111326da25738cbc3c1ad2b182

Add some debug code to new scan converter.

Output the rectangles/traps filled by the scan converter as
postscript.

base/gxscanc.c


2016-12-23 19:39:23 +0000
Robin Watts <robin.watts@artifex.com>
deb69ac011df1cc58a0da4c08123e2aebf819c7e

New scanconverter; fix various problems

1) Fix problems seen when stroke and fills don't line up.

This turns out to be because fills done with traps and "any
part of a pixel" (APP) were being rounded wrongly. Fixed here.

2) Fix some debug statements.

3) Fix some centre of pixel trap filling code - the code to
look for the 'end' of traps was failing due to only comparing
the first half of the intercepts on a given line.

base/gxscanc.c


2016-12-22 17:27:11 +0000
Robin Watts <robin.watts@artifex.com>
8d722263343e7c17769cc4026a76cc28046a8e1a

Fix new scan converter.

When filling by traps with any part of a pixel in the new scan
converter, we were hitting cases where we we missing parts
of lines.

As seen in the borders of the "CPU" and "CACHE" boxes on:

gs -dSCANCONVERTERTYPE=2 -o out.png -sDEVICE=png16m -r72
-dFirstPage3 -dLastPage3 tests/pdf/Bug6901014_SMP_Warwick_14.pdf

base/gxscanc.c


2016-12-22 17:26:24 +0000
Robin Watts <robin.watts@artifex.com>
0c625d998fb85d87b6184bd52bfeee954746a2cd

Improve debugging in new scan converter.

base/gxscanc.c


2016-12-22 10:34:31 +0000
Ken Sharp <ken.sharp@artifex.com>
64fcc1460ef1af131c17d3ced0f01ec755243986

Fix a scan-build warning

The return value stored in code wasn't being actioned, move it to
code1 instead.

devices/vector/gdevpdfv.c


2016-12-21 18:16:28 +0000
Robin Watts <robin.watts@artifex.com>
5924a809c21ce8564c72b9917e4a5fbd278049ad

Fix double pixels writes in new scanconverter.

When scan converting to scanlines with any part of a pixel
we have to be careful not to double write pixels. The logic
for this was broken. Fix it here.

Seen with:

gs -dSCANCONVERTERTYPE=2 -o out.png -sDEVICE=png16m -r72
tests_private/comparefiles/Bug687295c.pdf

base/gxscanc.c


2016-12-21 16:54:14 +0000
Ken Sharp <ken.sharp@artifex.com>
daf85701dab05f17e924a48a81edc9195b4a04e8

fix crash with bad data supplied to makeimagedevice

Bug #697450 "Null pointer dereference in gx_device_finalize()"

The problem here is that the code to finalise a device unconditionally
frees the icc_struct member of the device structure. However this
particular (weird) device is not setup as a normal device, probably
because its very, very ancient. Its possible for the initialisation
of the device to abort with an error before calling gs_make_mem_device()
which is where the icc_struct member gets allocated (or set to NULL).

If that happens, then the cleanup code tries to free the device, which
calls finalize() which tries to free a garbage pointer.

Setting the device memory to 0x00 after we allocate it means that the
icc_struct member will be NULL< and our memory manager allows for that
happily enough, which avoids the problem.

base/gsdevmem.c


2016-12-21 15:42:36 +0000
Ken Sharp <ken.sharp@artifex.com>
2299c9a25fc9ae7b59752f1795f8b53920901c80

pdfwrite - don't emit degenerate Matrix for type 2 Patterns

Bug 697451 "shfill with degenerate matrix leads to PDF unreadable with Acrobat"

The original file deliberately makes the CTM degenerate before drawing
a shfill. Although all PostScript consumers handle this without complaint.
When converted to PDF most PDF consumers also are happy with the
situation, however Adobe Acrobat recoils in horror and aborts the
processing of the page stream with an error.

Adobe Acrobat Distiller simply refuses (silently!) to embed the shfill
in the PDF file.

We don't have a way to drop the fill, so instead, if the Matrix is
degenerate, replace it with the smallest scale matrix we can. Acrobat
is happy with this.

No differences expected.

devices/vector/gdevpdfv.c


2016-12-20 10:40:56 +0000
Ken Sharp <ken.sharp@artifex.com>
7d820556974dbafaed04cfe5356fc66556907128

Fix accuracy of bbox device with curves in filled paths

Bug #697446 "bbox device is inaccurate with certain curves, when filled"

The problem here is that, when a path is not clipped, is composed of
certain types of flattish curves at the boundary, we used an inaccurate
method to determine the bounds of the path.

The old code used gx_path_bbox, which only considers the points in a path
which is a problem for curves, because it considers the control points
to be part of the curve, which they are not, and with some curves
they can lie a long way from the actual path, as in this case.

This commit simply forces the code through the scan-converter in order
to get an accurate result, the same as the stroked code.

No differences expected.

base/gdevbbox.c


2016-12-19 16:24:37 +0000
Robin Watts <Robin.Watts@artifex.com>
79a594c9bd95239ee975e930563e7fb567018372

Fix SEGV seen with new scan converter.

The following command:

gs -sOutputFile=out.ppm -dMaxBitmap=400000000 -sDEVICE=ppmraw -r300
-Z: -sDEFAULTPAPERSIZE=letter -dNOPAUSE -dBATCH -K2000000 -dClusterJob
-dJOBSERVER -dSCANCONVERTERTYPE=2 %rom%Resource/Init/gs_cet.ps ~/11-11.PS

was failing, due to a problem in the scan conversion code with
extreme paths.

base/gxscanc.c


2016-12-17 10:33:18 +0000
Ken Sharp <ken.sharp@artifex.com>
2d46dd9e83edc813f2047a89cd260ab4de48fdf4

More heuristic fixes from ToUnicode CMap changes

Bug #697436 "Chinese character can not be copied out correctly"

The changes in commit 9dba57f0f9a53c130ec2771c0ed1d7bd6bbef6ab to
properly handle ToUnicde CMaps had rippling effects throughout the
code wherever ToUnicode CMaps are read or generated. In this case the
code which turned glyph names of the form uniXXXX into Unicode code
point XXXX (in the absence of a GlyphNames2Unicode table) was not
updated correctly.

This commit changes the allocation from two shorts to a single unsigned
short, and fill sin the data from the glyph name in big-endian format
(as required throughout the ToUnicode code now), which results in
the correct ToUnicode CMap being generated.

devices/vector/gdevpdte.c


2016-12-13 09:20:45 -0800
Michael Vrhel <michael.vrhel@artifex.com>
00dfdefe5d38871c0c67b08ede10a208b6897d10

Bug 693307 Overprint issues

Remove the portions of code used to simulate
the overprinting of CMYK and spot colorants while
in an RGB device. This really can't work and
we are doing a real separation compositor device for
this process. The code parts removed only confuse
understanding of the overprint compositor. Also fix
problems related to Bug 693307 which were caused by
some confusion in the code with regard to the overprint
mode. Fix other issues related to the Ghent overprint
tests where we were not handling properly the case
of overprinting with a gray color when the output
device was CMYK based. Finally there were multiple
issues with the testing and setting of the overprint
settings and the use of the effective overprint mode

base/gdevp14.c
base/gdevp14.h
base/gscdevn.c
base/gscolor.c
base/gscsepr.c
base/gscspace.c
base/gsicc.c
base/gsovrc.c
base/gsovrc.h
base/gstrans.h
base/gxblend.h
base/gxblend1.c
base/gxcmap.c
base/gxcspace.h
base/gxdevcli.h
base/gxoprect.c
base/gxoprect.h


2016-12-15 13:56:43 -0800
Michael Vrhel <michael.vrhel@artifex.com>
46de0c56a0132356084b320a9f7e4d2ac1396c1c

Bug 697435 add blending color space

This adds the ability to specify the default (based) blending
color space for a target device when we have transparency blending.
-sBlendColorProfile="my_profile.icc" is used for the specification.
Only Gray, RGB, or CMYK ICC profiles are allowed. Also, separation
devices (e.g. tiffsep and psdcmyk) will not support the use of this
at this time. Note also that if a target device has a put_image
procedure where it did its own blending or tag processing, this command
proc is not called if the blending color space is specified as the final color
conversion is applied through begin_typed_image.

base/gdevp14.c
base/gdevp14.h
base/gscms.h
base/gsdparam.c
base/gsequivc.c
base/gsicc_manage.c


2016-12-14 15:56:31 +0100
Tor Andersson <tor.andersson@artifex.com>
73060a27e554f8e64ae2aba4a1b03822207346c7

Fix warnings: remove unsigned < 0 tests that are always false.

jbig2dec/jbig2_image.c
jbig2dec/jbig2_mmr.c
jbig2dec/jbig2_symbol_dict.c


2016-12-12 17:47:17 +0000
Robin Watts <robin.watts@artifex.com>
cecf6b592945d247bf932f6a4f50065db4acfba8

Squash signed/unsigned warnings in MSVC jbig2 build.

Also rename "new" to "new_dict", because "new" is a bad
variable name.

jbig2dec/jbig2.c
jbig2dec/jbig2.h
jbig2dec/jbig2_generic.c
jbig2dec/jbig2_halftone.c
jbig2dec/jbig2_huffman.c
jbig2dec/jbig2_huffman.h
jbig2dec/jbig2_image.c
jbig2dec/jbig2_mmr.c
jbig2dec/jbig2_page.c
jbig2dec/jbig2_priv.h
jbig2dec/jbig2_segment.c
jbig2dec/jbig2_symbol_dict.c
jbig2dec/jbig2_symbol_dict.h
jbig2dec/jbig2_text.c
jbig2dec/jbig2_text.h


2016-12-12 08:31:34 -0800
Michael Vrhel <michael.vrhel@artifex.com>
0efaa8dff5b82169313a086861597e0f455892d3

Bug 697350. Fix isolated knockout group rendering

The blending code in the knockout isolate case had issues
and the only difference compared to the non-isolated case
is that we don't need to do the blend with the backdrop.

base/gdevp14.c
base/gxblend.c
base/gxblend.h
base/gxblend1.c


2016-12-12 17:53:23 +0000
Robin Watts <robin.watts@artifex.com>
15d9aaac64334776284310f5cbfe8ae79edae540

Squash annoying MSVC warning.

base/gxpcmap.c


2016-12-09 19:29:37 +0000
Robin Watts <robin.watts@artifex.com>
f5ac81f27674c54540c6313ed31b027f1385ceb5

Add ETS to Downscaler.

Currently only hooked up for tiffscaled and tiffscaled4.

Enable using -dDownScaleETS=1 along with the usual other downscaler
hooks.

No control over all the myriad ETS flags as yet.

base/ets.c
base/ets.h
base/ets_tm.h
base/gxdownscale.c
base/gxdownscale.h
base/lib.mak
devices/gdevtifs.c
devices/gdevtifs.h
devices/gdevtsep.c
doc/Devices.htm
windows/ghostscript.vcproj


2016-12-09 12:33:41 -0800
Michael Vrhel <michael.vrhel@artifex.com>
dd50b33582901eda25fce78a40552de91db3c8e5

Use normal blend mode for spots when mode is non-white preserving

When we are doing the group compositing, make sure to catch the
cases where we have spot colorants and the blend modes is either
non-separable or non-white preserving. In those cases, the spot
colorants have to use the normal blend mode.

base/gxblend.c
base/gxblend.h
base/gxblend1.c


2016-12-09 10:43:57 +0000
Chris Liddell <chris.liddell@artifex.com>
8894abf2985a58900e778957f93151b6cec1c17a

Address a segfault and error introduced in 4b3be09

In the zbegintransparencymaskgroup with a '/None' SMask parameter with the clist
in use, we get to clist_create_compositor().

In there, the return value of the get_cropping method can be either an error
(negative) or a specific cropping operation (positive). We assign it to 'code',
and if it's an error, return it, if not, assign it to another variable. But
don't set 'code' to anything else. It is then possible to get to the end of the
function without going through the path where 'code' is used again.

Setting 'code' to 0 after storing the cropping op solves the problem.

base/gxclimag.c


2016-12-08 18:09:58 +0000
Chris Liddell <chris.liddell@artifex.com>
4b3be091fa0384e679baaf04b14ea195da5adf21

Bug 697415: 'clean up' after images with SMask entries

Our handling of images with SMasks depends on telling the transparency
compositor to expect an SMask image, draw the SMask as a regular image,
tell the compositor the SMask is done, and then draw the 'main' image (to
which the compositor will apply the SMask).

The problem was that the compositor treats SMasks from images and SMasks from
ExtGState as the same (which they really are), but the image drawing code
took no action to inform the compositor we were done with the SMask, thus
leaving it place.

By adding a call to "unset" the SMask from the current graphics state (in this
case, it's really the current group in the compositor), we ensure the SMask
is only applied to the current image).

Resource/Init/pdf_draw.ps


2016-12-05 18:30:06 +0000
Ken Sharp <ken.sharp@artifex.com>
c875bf7490447579e850fa4722874848c3be4657

PDF Interpreter - more indirect object foolishness

Bug #697402 "PDF rendered as blank in PDF with unusual font width array"

Not ony the /Widths array of one of the fonts, but also an entry in a
/W array for a CIDFont specify a value using an indirect object
reference.

While this is silly (it makes the PDF file larger and slower) it is legal
so this commit copes with it by dereferencing any indirect references.

We alos now handle W2 arrays with references, even though this file
doesn't use one.

Resource/Init/pdf_font.ps


2016-12-03 06:40:17 -0800
Michael Vrhel <michael.vrhel@artifex.com>
0e16bd592aaccde9b384415a87d8a9bef9c57f83

Fix debug output for pattern bitmaps

base/gxpcmap.c


2016-12-03 12:25:58 +0000
Ken Sharp <ken.sharp@artifex.com>
cc746214644deacd5233a1453ce660573af09443

txtwrite - sort out endian-ness of Unicode based on architecture

Bug #697339 "Device txtwrite seems to be broken"

decode_glyph sppears always to return big-endian shorts for Unicode
code points. On litlee-endian platforms, reverse the byte order so
that we can treat the data as shorts instead of bytes.

As I don't have a big endian device to test this on, further work may
be required.

devices/vector/gdevtxtw.c


2016-12-02 09:00:20 -0800
Ray Johnston <ray.johnston@artifex.com>
d05c99ba9f3c1539a5b02a96ed050422677d9704

Remove MarginsHWResolution non-standard device parameter

base/gdevp14.c
base/gscoord.c
base/gsdevice.c
base/gsdevmem.c
base/gsdparam.c
base/gspath.c
base/gxclist.c
base/gxdevcli.h
base/gxdevice.h
devices/gdevbit.c
devices/gdevupd.c
devices/gdevxalt.c
devices/gdevxini.c
lib/align.ps


2016-12-02 19:03:42 +0000
Ken Sharp <ken.sharp@artifex.com>
b880332b899e0e59d17c7e48033e5cc816e5a831

pdfwrite - adjust Mono Subsample resolution to integer

Bug #697351 "/Subsample filter needs to make non-integer scales integer for monochrome images"

The only downsampling filter available for monochrome images and
imagemasks (1 bpp images and masks) is the /Subsample filter. However
the Subsample filter only works when the downsampling factor is an
exact integer.

Its unreasonable to insist that all the monochrome images in a given
document can be downsampled to a specific resolution and that the downsample
factor for all those images will be an integer.

So here, if the image is monochrome (so we canot switch to the Bicubic
filter) and the factor is not an integer, we force the factor to the
nearest integer.

Also, update the documentation which incorrectly stated that when
/PDFSETTINGS was set to 'prepress', monochrome images used the Bicubic
filter, it actually uses the Subsample filter.

devices/vector/gdevpsdi.c
doc/VectorDevices.htm


2016-12-02 17:13:35 +0000
Ken Sharp <ken.sharp@artifex.com>
26acbbb980a44d9610080876afeef5bb834d21e3

Documentation - Document the fact that setpagedevice resets distiller params

doc/VectorDevices.htm


2016-12-02 16:33:25 +0000
Ken Sharp <ken.sharp@artifex.com>
336c69b8be32c7193909a7f25b1a073b0ac2d92f

PDF Interpreter - have warning messages respect QUIET

Bug #697394 "stderr is included with stdout when result is set to stdout"

We do want the warnings to go to stdout, for debugging purposes,
because it is easier to use -dPDFDEBUG if the warnings are interleaved.

For the benefit of user piping the output to stdout, have the warning
messages respect -dQUIET so they don't end up in the output file.

Error messages (which are directed to stderr anyway) are not suppressed
as these are important.

No differences expected

Resource/Init/pdf_main.ps


2016-11-24 12:26:17 -0800
Ray Johnston <ray.johnston@artifex.com>
a8d6c4074ee8cfc251ebdd44ce4d2f97cdf20517

Revert commit 3cde6d6d, require %d OutputFile spec for multi-page tiffsep

The previous commit allowed multi-page separation files, but this would only
work if all pages had the same spot colors. If a later page added a spot color
it would be appended to the set of spot colors, but then the separation layer
would be emitted with the previous spot color name (according to the order)
and the CMYK equivalent for that previous spot color would be used to make the
CMYK composite.

Now multi-page tiffsep requires the use of %d (or some other format that uses
the page number in the filename). The first page can be output without %d, and
the second page will issue an error message and quit with ioerror.

In theory we could wait to issue the error until we encounter a spot color order
that was not the same as the first page, but this is of little utility, and
this change makes tiffsep operate similarly to the psdcmyk device.

devices/gdevtsep.c
doc/Devices.htm


2016-11-24 09:56:12 +0000
Ken Sharp <ken.sharp@artifex.com>
f42898997f249062f5da8fcf9c3a46cd6443fb39

PDF interpreter - skip 'R' operator in invalid context

Bug #697365 "corrupted content stream causes error"

The file has 2 Form XObject whose content streams have a single garbage
byte at the end of the stream, and which forms part of the 'endstream'.

In one case this simply leads to garbage on the stack, which we deal with
already, but in the other case the garbage happens to be a 'R character
which we attempt to process as a token.

Now attempting to process an R operator fails in this case, because the
stack contents are not a pair of integers. However, in the process, it
removes two stack objects which we require for further processing.

There's no way to restore those to the operand stack, and there is no
way to not process the 'R' as a token. We also cannot temporarily
define 'R' as a no-op for the course of a stream, because if the
stream uses named objects which have not already been dereferenced
we need to execute the R operator to resolve them.

This commit modifies the definition of R so that it checks the type
of the expected operands before consuming them. If they are not both
integers then it flags an error, leaves the stack alone and exits.

THis will, of course, be slightly slower than the current approach
which doesn't check types, but it should only be executed once
for each object in the file. Even for a large file that should only
be a few tens of thousands, and this is likely to be lost among
the processing time for real operations. However, shuold this
causew significant performance problems we may remove this in the
future.

No differences expected.

Resource/Init/pdf_base.ps
Resource/Init/pdf_main.ps


2016-11-23 09:26:16 -0800
Michael Vrhel <michael.vrhel@artifex.com>
b7ea690782c306241ed94fa3bdaf296f6bcc455f

Bug 697366

Partial fix. Pattern now renders correctly. Issues
with a few other spots though.

base/gdevdsha.c


2016-11-23 06:58:19 -0800
Michael Vrhel <michael.vrhel@artifex.com>
2237813596c8703de6008dd6c05460f9dac3ed75

Fix segv due to improper depth computation

Commit
47294ff5b168d25bfc7db64f51572d64b8ebde91
had an issue that was found when running
eci_altona-test-suite-v2_technical2_x4.pdf
(the Altona file with ALL the pages on one page)
with tiffsep and psdcmyk. This fixes the segv.
A rending issue remains on this issue.
Bug http://bugs.ghostscript.com/show_bug.cgi?id=697366
was opened to address.

base/gdevp14.c


2016-11-21 10:03:24 +0000
Chris Liddell <chris.liddell@artifex.com>
5b87f18df814aaa9f0036c843a4b24b1638aa4cf

libtiff: update to 4.0.7

Add in portability changes to tiffiop.h

Portability tiffiop.h

Remove globals from tif_pixarlog.c

tiff/CMakeLists.txt
tiff/ChangeLog
tiff/HOWTO-RELEASE
tiff/Makefile.am
tiff/Makefile.in
tiff/RELEASE-DATE
tiff/VERSION
tiff/aclocal.m4
tiff/build/CMakeLists.txt
tiff/build/Makefile.am
tiff/build/Makefile.in
tiff/config/compile
tiff/config/depcomp
tiff/config/ltmain.sh
tiff/config/missing
tiff/config/test-driver
tiff/configure
tiff/configure.ac
tiff/configure.com
tiff/contrib/CMakeLists.txt
tiff/contrib/Makefile.am
tiff/contrib/Makefile.in
tiff/contrib/addtiffo/CMakeLists.txt
tiff/contrib/addtiffo/Makefile.am
tiff/contrib/addtiffo/Makefile.in
tiff/contrib/addtiffo/addtiffo.c
tiff/contrib/addtiffo/tif_overview.c
tiff/contrib/addtiffo/tif_ovrcache.c
tiff/contrib/dbs/CMakeLists.txt
tiff/contrib/dbs/Makefile.am
tiff/contrib/dbs/Makefile.in
tiff/contrib/dbs/xtiff/CMakeLists.txt
tiff/contrib/dbs/xtiff/Makefile.am
tiff/contrib/dbs/xtiff/Makefile.in
tiff/contrib/dbs/xtiff/xtiff.c
tiff/contrib/iptcutil/CMakeLists.txt
tiff/contrib/iptcutil/Makefile.am
tiff/contrib/iptcutil/Makefile.in
tiff/contrib/iptcutil/iptcutil.c
tiff/contrib/mfs/CMakeLists.txt
tiff/contrib/mfs/Makefile.am
tiff/contrib/mfs/Makefile.in
tiff/contrib/pds/CMakeLists.txt
tiff/contrib/pds/Makefile.am
tiff/contrib/pds/Makefile.in
tiff/contrib/ras/CMakeLists.txt
tiff/contrib/ras/Makefile.am
tiff/contrib/ras/Makefile.in
tiff/contrib/stream/CMakeLists.txt
tiff/contrib/stream/Makefile.am
tiff/contrib/stream/Makefile.in
tiff/contrib/tags/CMakeLists.txt
tiff/contrib/tags/Makefile.am
tiff/contrib/tags/Makefile.in
tiff/contrib/win_dib/CMakeLists.txt
tiff/contrib/win_dib/Makefile.am
tiff/contrib/win_dib/Makefile.in
tiff/html/CMakeLists.txt
tiff/html/Makefile.am
tiff/html/Makefile.in
tiff/html/addingtags.html
tiff/html/bugs.html
tiff/html/build.html
tiff/html/contrib.html
tiff/html/document.html
tiff/html/images.html
tiff/html/images/CMakeLists.txt
tiff/html/images/Makefile.am
tiff/html/images/Makefile.in
tiff/html/index.html
tiff/html/internals.html
tiff/html/intro.html
tiff/html/libtiff.html
tiff/html/man/CMakeLists.txt
tiff/html/man/HtmlDoc.cmake
tiff/html/man/Makefile.am
tiff/html/man/Makefile.in
tiff/html/man/TIFFClose.3tiff.html
tiff/html/man/TIFFDataWidth.3tiff.html
tiff/html/man/TIFFError.3tiff.html
tiff/html/man/TIFFFieldDataType.3tiff.html
tiff/html/man/TIFFFieldName.3tiff.html
tiff/html/man/TIFFFieldPassCount.3tiff.html
tiff/html/man/TIFFFieldReadCount.3tiff.html
tiff/html/man/TIFFFieldTag.3tiff.html
tiff/html/man/TIFFFieldWriteCount.3tiff.html
tiff/html/man/TIFFFlush.3tiff.html
tiff/html/man/TIFFGetField.3tiff.html
tiff/html/man/TIFFRGBAImage.3tiff.html
tiff/html/man/TIFFReadDirectory.3tiff.html
tiff/html/man/TIFFReadEncodedStrip.3tiff.html
tiff/html/man/TIFFReadEncodedTile.3tiff.html
tiff/html/man/TIFFReadRGBAImage.3tiff.html
tiff/html/man/TIFFReadRGBAStrip.3tiff.html
tiff/html/man/TIFFReadRGBATile.3tiff.html
tiff/html/man/TIFFReadRawStrip.3tiff.html
tiff/html/man/TIFFReadRawTile.3tiff.html
tiff/html/man/TIFFReadScanline.3tiff.html
tiff/html/man/TIFFReadTile.3tiff.html
tiff/html/man/TIFFSetDirectory.3tiff.html
tiff/html/man/TIFFSetField.3tiff.html
tiff/html/man/TIFFWarning.3tiff.html
tiff/html/man/TIFFWriteDirectory.3tiff.html
tiff/html/man/TIFFWriteEncodedStrip.3tiff.html
tiff/html/man/TIFFWriteEncodedTile.3tiff.html
tiff/html/man/TIFFWriteRawStrip.3tiff.html
tiff/html/man/TIFFWriteRawTile.3tiff.html
tiff/html/man/TIFFWriteScanline.3tiff.html
tiff/html/man/TIFFWriteTile.3tiff.html
tiff/html/man/TIFFbuffer.3tiff.html
tiff/html/man/TIFFcodec.3tiff.html
tiff/html/man/TIFFcolor.3tiff.html
tiff/html/man/TIFFmemory.3tiff.html
tiff/html/man/TIFFsize.3tiff.html
tiff/html/man/TIFFstrip.3tiff.html
tiff/html/man/TIFFswab.3tiff.html
tiff/html/man/TIFFtile.3tiff.html
tiff/html/man/fax2ps.1.html
tiff/html/man/fax2tiff.1.html
tiff/html/man/gif2tiff.1.html
tiff/html/man/index.html
tiff/html/man/pal2rgb.1.html
tiff/html/man/ppm2tiff.1.html
tiff/html/man/ras2tiff.1.html
tiff/html/man/raw2tiff.1.html
tiff/html/man/rgb2ycbcr.1.html
tiff/html/man/sgi2tiff.1.html
tiff/html/man/thumbnail.1.html
tiff/html/man/tiff2bw.1.html
tiff/html/man/tiff2pdf.1.html
tiff/html/man/tiff2ps.1.html
tiff/html/man/tiff2rgba.1.html
tiff/html/man/tiffcmp.1.html
tiff/html/man/tiffcp.1.html
tiff/html/man/tiffcrop.1.html
tiff/html/man/tiffdither.1.html
tiff/html/man/tiffdump.1.html
tiff/html/man/tiffgt.1.html
tiff/html/man/tiffinfo.1.html
tiff/html/man/tiffmedian.1.html
tiff/html/man/tiffset.1.html
tiff/html/man/tiffsplit.1.html
tiff/html/man/tiffsv.1.html
tiff/html/misc.html
tiff/html/support.html
tiff/html/tools.html
tiff/html/v3.4beta007.html
tiff/html/v3.4beta016.html
tiff/html/v3.4beta018.html
tiff/html/v3.4beta024.html
tiff/html/v3.4beta028.html
tiff/html/v3.4beta029.html
tiff/html/v3.4beta031.html
tiff/html/v3.4beta032.html
tiff/html/v3.4beta033.html
tiff/html/v3.4beta034.html
tiff/html/v3.4beta035.html
tiff/html/v3.4beta036.html
tiff/html/v3.5.1.html
tiff/html/v3.5.2.html
tiff/html/v3.5.3.html
tiff/html/v3.5.4.html
tiff/html/v3.5.5.html
tiff/html/v3.5.6-beta.html
tiff/html/v3.5.7.html
tiff/html/v3.6.0.html
tiff/html/v3.6.1.html
tiff/html/v3.7.0.html
tiff/html/v3.7.0alpha.html
tiff/html/v3.7.0beta.html
tiff/html/v3.7.0beta2.html
tiff/html/v3.7.1.html
tiff/html/v3.7.2.html
tiff/html/v3.7.3.html
tiff/html/v3.7.4.html
tiff/html/v3.8.0.html
tiff/html/v3.8.1.html
tiff/html/v3.8.2.html
tiff/html/v3.9.0beta.html
tiff/html/v3.9.1.html
tiff/html/v3.9.2.html
tiff/html/v4.0.0.html
tiff/html/v4.0.1.html
tiff/html/v4.0.2.html
tiff/html/v4.0.3.html
tiff/html/v4.0.4.html
tiff/html/v4.0.4beta.html
tiff/html/v4.0.5.html
tiff/html/v4.0.6.html
tiff/html/v4.0.7.html
tiff/libtiff/CMakeLists.txt
tiff/libtiff/Makefile.am
tiff/libtiff/Makefile.in
tiff/libtiff/Makefile.vc
tiff/libtiff/libtiff.def
tiff/libtiff/mkg3states.c
tiff/libtiff/tif_aux.c
tiff/libtiff/tif_close.c
tiff/libtiff/tif_codec.c
tiff/libtiff/tif_color.c
tiff/libtiff/tif_compress.c
tiff/libtiff/tif_config.h.cmake.in
tiff/libtiff/tif_config.h.in
tiff/libtiff/tif_config.vc.h
tiff/libtiff/tif_dir.c
tiff/libtiff/tif_dirinfo.c
tiff/libtiff/tif_dirread.c
tiff/libtiff/tif_dirwrite.c
tiff/libtiff/tif_dumpmode.c
tiff/libtiff/tif_extension.c
tiff/libtiff/tif_fax3.c
tiff/libtiff/tif_fax3.h
tiff/libtiff/tif_getimage.c
tiff/libtiff/tif_jpeg.c
tiff/libtiff/tif_jpeg_12.c
tiff/libtiff/tif_luv.c
tiff/libtiff/tif_lzma.c
tiff/libtiff/tif_lzw.c
tiff/libtiff/tif_next.c
tiff/libtiff/tif_ojpeg.c
tiff/libtiff/tif_open.c
tiff/libtiff/tif_packbits.c
tiff/libtiff/tif_pixarlog.c
tiff/libtiff/tif_predict.c
tiff/libtiff/tif_predict.h
tiff/libtiff/tif_print.c
tiff/libtiff/tif_read.c
tiff/libtiff/tif_stream.cxx
tiff/libtiff/tif_strip.c
tiff/libtiff/tif_swab.c
tiff/libtiff/tif_thunder.c
tiff/libtiff/tif_tile.c
tiff/libtiff/tif_unix.c
tiff/libtiff/tif_win32.c
tiff/libtiff/tif_write.c
tiff/libtiff/tif_zip.c
tiff/libtiff/tiff.h
tiff/libtiff/tiffconf.h.cmake.in
tiff/libtiff/tiffconf.vc.h
tiff/libtiff/tiffio.h
tiff/libtiff/tiffiop.h
tiff/libtiff/tiffvers.h
tiff/libtiff/uvcode.h
tiff/man/CMakeLists.txt
tiff/man/Makefile.am
tiff/man/Makefile.in
tiff/man/TIFFClose.3tiff
tiff/man/TIFFDataWidth.3tiff
tiff/man/TIFFError.3tiff
tiff/man/TIFFFieldDataType.3tiff
tiff/man/TIFFFieldName.3tiff
tiff/man/TIFFFieldPassCount.3tiff
tiff/man/TIFFFieldReadCount.3tiff
tiff/man/TIFFFieldTag.3tiff
tiff/man/TIFFFieldWriteCount.3tiff
tiff/man/TIFFFlush.3tiff
tiff/man/TIFFGetField.3tiff
tiff/man/TIFFRGBAImage.3tiff
tiff/man/TIFFReadDirectory.3tiff
tiff/man/TIFFReadEncodedStrip.3tiff
tiff/man/TIFFReadEncodedTile.3tiff
tiff/man/TIFFReadRGBAImage.3tiff
tiff/man/TIFFReadRGBAStrip.3tiff
tiff/man/TIFFReadRGBATile.3tiff
tiff/man/TIFFReadRawStrip.3tiff
tiff/man/TIFFReadRawTile.3tiff
tiff/man/TIFFReadScanline.3tiff
tiff/man/TIFFReadTile.3tiff
tiff/man/TIFFSetDirectory.3tiff
tiff/man/TIFFSetField.3tiff
tiff/man/TIFFWarning.3tiff
tiff/man/TIFFWriteDirectory.3tiff
tiff/man/TIFFWriteEncodedStrip.3tiff
tiff/man/TIFFWriteEncodedTile.3tiff
tiff/man/TIFFWriteRawStrip.3tiff
tiff/man/TIFFWriteRawTile.3tiff
tiff/man/TIFFWriteScanline.3tiff
tiff/man/TIFFWriteTile.3tiff
tiff/man/TIFFbuffer.3tiff
tiff/man/TIFFcodec.3tiff
tiff/man/TIFFcolor.3tiff
tiff/man/TIFFmemory.3tiff
tiff/man/TIFFsize.3tiff
tiff/man/TIFFstrip.3tiff
tiff/man/TIFFswab.3tiff
tiff/man/TIFFtile.3tiff
tiff/man/bmp2tiff.1
tiff/man/fax2ps.1
tiff/man/fax2tiff.1
tiff/man/gif2tiff.1
tiff/man/libtiff.3tiff
tiff/man/pal2rgb.1
tiff/man/ppm2tiff.1
tiff/man/ras2tiff.1
tiff/man/raw2tiff.1
tiff/man/rgb2ycbcr.1
tiff/man/sgi2tiff.1
tiff/man/thumbnail.1
tiff/man/tiff2bw.1
tiff/man/tiff2pdf.1
tiff/man/tiff2ps.1
tiff/man/tiff2rgba.1
tiff/man/tiffcmp.1
tiff/man/tiffcp.1
tiff/man/tiffcrop.1
tiff/man/tiffdither.1
tiff/man/tiffdump.1
tiff/man/tiffgt.1
tiff/man/tiffinfo.1
tiff/man/tiffmedian.1
tiff/man/tiffset.1
tiff/man/tiffsplit.1
tiff/man/tiffsv.1
tiff/nmake.opt
tiff/port/CMakeLists.txt
tiff/port/Makefile.am
tiff/port/Makefile.in
tiff/port/Makefile.vc
tiff/port/libport.h
tiff/port/snprintf.c
tiff/port/strcasecmp.c
tiff/test/CMakeLists.txt
tiff/test/Makefile.am
tiff/test/Makefile.in
tiff/test/TiffSplitTest.cmake
tiff/test/TiffTest.cmake
tiff/test/TiffTestCommon.cmake
tiff/test/ascii_tag.c
tiff/test/bmp2tiff_palette.sh
tiff/test/bmp2tiff_rgb.sh
tiff/test/common.sh
tiff/test/custom_dir.c
tiff/test/gif2tiff.sh
tiff/test/images/palette-1c-8b.bmp
tiff/test/images/palette-1c-8b.gif
tiff/test/images/quad-tile.jpg.tiff
tiff/test/images/rgb-3c-8b.bmp
tiff/test/long_tag.c
tiff/test/raw_decode.c
tiff/test/rewrite_tag.c
tiff/test/short_tag.c
tiff/test/strip.c
tiff/test/tiff2rgba-quad-tile.jpg.sh
tiff/tools/CMakeLists.txt
tiff/tools/Makefile.am
tiff/tools/Makefile.in
tiff/tools/Makefile.vc
tiff/tools/bmp2tiff.c
tiff/tools/fax2ps.c
tiff/tools/fax2tiff.c
tiff/tools/gif2tiff.c
tiff/tools/pal2rgb.c
tiff/tools/ppm2tiff.c
tiff/tools/ras2tiff.c
tiff/tools/rasterfile.h
tiff/tools/raw2tiff.c
tiff/tools/rgb2ycbcr.c
tiff/tools/sgi2tiff.c
tiff/tools/sgisv.c
tiff/tools/thumbnail.c
tiff/tools/tiff2bw.c
tiff/tools/tiff2pdf.c
tiff/tools/tiff2ps.c
tiff/tools/tiff2rgba.c
tiff/tools/tiffcmp.c
tiff/tools/tiffcp.c
tiff/tools/tiffcrop.c
tiff/tools/tiffdither.c
tiff/tools/tiffdump.c
tiff/tools/tiffgt.c
tiff/tools/tiffinfo.c
tiff/tools/tiffmedian.c
tiff/tools/tiffset.c
tiff/tools/tiffsplit.c
tiff/tools/ycbcr.c


2016-11-08 09:50:00 +0000
Chris Liddell <chris.liddell@artifex.com>
6655712ee1d0bf2a7818044613bbed226b7abddd

Update freetype to 2.7.0

Tweak makefile for new freetype version

Force use of the v35 Freetype bytecode interpreter

base/fapi_ft.c
base/freetype.mak
freetype/CMakeLists.txt
freetype/ChangeLog
freetype/ChangeLog.20
freetype/ChangeLog.21
freetype/ChangeLog.22
freetype/ChangeLog.23
freetype/ChangeLog.24
freetype/ChangeLog.25
freetype/ChangeLog.26
freetype/Jamfile
freetype/Jamrules
freetype/Makefile
freetype/README
freetype/README.git
freetype/autogen.sh
freetype/builds/amiga/README
freetype/builds/amiga/include/config/ftconfig.h
freetype/builds/amiga/include/config/ftmodule.h
freetype/builds/amiga/makefile
freetype/builds/amiga/makefile.os4
freetype/builds/amiga/smakefile
freetype/builds/amiga/src/base/ftdebug.c
freetype/builds/amiga/src/base/ftsystem.c
freetype/builds/ansi/ansi-def.mk
freetype/builds/ansi/ansi.mk
freetype/builds/atari/ATARI.H
freetype/builds/atari/README.TXT
freetype/builds/beos/beos-def.mk
freetype/builds/beos/beos.mk
freetype/builds/beos/detect.mk
freetype/builds/cmake/FindHarfBuzz.cmake
freetype/builds/cmake/iOS.cmake
freetype/builds/cmake/testbuild.sh
freetype/builds/compiler/ansi-cc.mk
freetype/builds/compiler/bcc-dev.mk
freetype/builds/compiler/bcc.mk
freetype/builds/compiler/emx.mk
freetype/builds/compiler/gcc-dev.mk
freetype/builds/compiler/gcc.mk
freetype/builds/compiler/intelc.mk
freetype/builds/compiler/unix-lcc.mk
freetype/builds/compiler/visualage.mk
freetype/builds/compiler/visualc.mk
freetype/builds/compiler/watcom.mk
freetype/builds/compiler/win-lcc.mk
freetype/builds/detect.mk
freetype/builds/dos/detect.mk
freetype/builds/dos/dos-def.mk
freetype/builds/dos/dos-emx.mk
freetype/builds/dos/dos-gcc.mk
freetype/builds/dos/dos-wat.mk
freetype/builds/exports.mk
freetype/builds/freetype.mk
freetype/builds/link_dos.mk
freetype/builds/link_std.mk
freetype/builds/mac/FreeType.m68k_cfm.make.txt
freetype/builds/mac/FreeType.m68k_far.make.txt
freetype/builds/mac/FreeType.ppc_carbon.make.txt
freetype/builds/mac/FreeType.ppc_classic.make.txt
freetype/builds/mac/ftmac.c
freetype/builds/modules.mk
freetype/builds/os2/detect.mk
freetype/builds/os2/os2-def.mk
freetype/builds/os2/os2-dev.mk
freetype/builds/os2/os2-gcc.mk
freetype/builds/symbian/bld.inf
freetype/builds/symbian/freetype.mmp
freetype/builds/toplevel.mk
freetype/builds/unix/aclocal.m4
freetype/builds/unix/config.guess
freetype/builds/unix/config.sub
freetype/builds/unix/configure.ac
freetype/builds/unix/configure.raw
freetype/builds/unix/detect.mk
freetype/builds/unix/freetype-config.in
freetype/builds/unix/freetype2.in
freetype/builds/unix/freetype2.m4
freetype/builds/unix/ft-munmap.m4
freetype/builds/unix/ftconfig.in
freetype/builds/unix/ftsystem.c
freetype/builds/unix/install-sh
freetype/builds/unix/install.mk
freetype/builds/unix/ltmain.sh
freetype/builds/unix/mkinstalldirs
freetype/builds/unix/unix-cc.in
freetype/builds/unix/unix-def.in
freetype/builds/unix/unix-dev.mk
freetype/builds/unix/unix-lcc.mk
freetype/builds/unix/unix.mk
freetype/builds/unix/unixddef.mk
freetype/builds/vms/ftconfig.h
freetype/builds/vms/ftsystem.c
freetype/builds/wince/ftdebug.c
freetype/builds/wince/vc2005-ce/freetype.sln
freetype/builds/wince/vc2005-ce/freetype.vcproj
freetype/builds/wince/vc2005-ce/index.html
freetype/builds/wince/vc2008-ce/freetype.sln
freetype/builds/wince/vc2008-ce/freetype.vcproj
freetype/builds/wince/vc2008-ce/index.html
freetype/builds/windows/detect.mk
freetype/builds/windows/ftdebug.c
freetype/builds/windows/vc2005/freetype.vcproj
freetype/builds/windows/vc2005/index.html
freetype/builds/windows/vc2008/freetype.vcproj
freetype/builds/windows/vc2008/index.html
freetype/builds/windows/vc2010/freetype.sln
freetype/builds/windows/vc2010/freetype.vcxproj
freetype/builds/windows/vc2010/freetype.vcxproj.filters
freetype/builds/windows/vc2010/index.html
freetype/builds/windows/visualc/freetype.dsp
freetype/builds/windows/visualc/freetype.vcproj
freetype/builds/windows/visualc/index.html
freetype/builds/windows/visualce/freetype.dsp
freetype/builds/windows/visualce/freetype.vcproj
freetype/builds/windows/visualce/index.html
freetype/builds/windows/w32-bcc.mk
freetype/builds/windows/w32-bccd.mk
freetype/builds/windows/w32-dev.mk
freetype/builds/windows/w32-gcc.mk
freetype/builds/windows/w32-icc.mk
freetype/builds/windows/w32-intl.mk
freetype/builds/windows/w32-lcc.mk
freetype/builds/windows/w32-mingw32.mk
freetype/builds/windows/w32-vcc.mk
freetype/builds/windows/w32-wat.mk
freetype/builds/windows/win32-def.mk
freetype/configure
freetype/devel/ft2build.h
freetype/devel/ftoption.h
freetype/docs/CHANGES
freetype/docs/CUSTOMIZE
freetype/docs/DEBUG
freetype/docs/FTL.TXT
freetype/docs/INSTALL
freetype/docs/INSTALL.ANY
freetype/docs/INSTALL.CROSS
freetype/docs/INSTALL.GNU
freetype/docs/INSTALL.UNIX
freetype/docs/INSTALL.VMS
freetype/docs/LICENSE.TXT
freetype/docs/TODO
freetype/docs/VERSION.DLL
freetype/docs/VERSIONS.TXT
freetype/docs/formats.txt
freetype/docs/freetype-config.1
freetype/docs/raster.txt
freetype/docs/reference/ft2-auto_hinter.html
freetype/docs/reference/ft2-base_interface.html
freetype/docs/reference/ft2-basic_types.html
freetype/docs/reference/ft2-bdf_fonts.html
freetype/docs/reference/ft2-bitmap_handling.html
freetype/docs/reference/ft2-bzip2.html
freetype/docs/reference/ft2-cache_subsystem.html
freetype/docs/reference/ft2-cff_driver.html
freetype/docs/reference/ft2-cid_fonts.html
freetype/docs/reference/ft2-computations.html
freetype/docs/reference/ft2-error_code_values.html
freetype/docs/reference/ft2-error_enumerations.html
freetype/docs/reference/ft2-font_formats.html
freetype/docs/reference/ft2-gasp_table.html
freetype/docs/reference/ft2-glyph_management.html
freetype/docs/reference/ft2-glyph_stroker.html
freetype/docs/reference/ft2-glyph_variants.html
freetype/docs/reference/ft2-gx_validation.html
freetype/docs/reference/ft2-gzip.html
freetype/docs/reference/ft2-header_file_macros.html
freetype/docs/reference/ft2-header_inclusion.html
freetype/docs/reference/ft2-incremental.html
freetype/docs/reference/ft2-index.html
freetype/docs/reference/ft2-lcd_filtering.html
freetype/docs/reference/ft2-list_processing.html
freetype/docs/reference/ft2-lzw.html
freetype/docs/reference/ft2-mac_specific.html
freetype/docs/reference/ft2-module_management.html
freetype/docs/reference/ft2-multiple_masters.html
freetype/docs/reference/ft2-ot_validation.html
freetype/docs/reference/ft2-outline_processing.html
freetype/docs/reference/ft2-pfr_fonts.html
freetype/docs/reference/ft2-quick_advance.html
freetype/docs/reference/ft2-raster.html
freetype/docs/reference/ft2-sfnt_names.html
freetype/docs/reference/ft2-sizes_management.html
freetype/docs/reference/ft2-system_interface.html
freetype/docs/reference/ft2-toc.html
freetype/docs/reference/ft2-truetype_engine.html
freetype/docs/reference/ft2-truetype_tables.html
freetype/docs/reference/ft2-tt_driver.html
freetype/docs/reference/ft2-type1_tables.html
freetype/docs/reference/ft2-user_allocation.html
freetype/docs/reference/ft2-version.html
freetype/docs/reference/ft2-winfnt_fonts.html
freetype/docs/release
freetype/include/config/ftconfig.h
freetype/include/config/ftheader.h
freetype/include/config/ftmodule.h
freetype/include/config/ftoption.h
freetype/include/config/ftstdlib.h
freetype/include/freetype.h
freetype/include/freetype/config/ftconfig.h
freetype/include/freetype/config/ftheader.h
freetype/include/freetype/config/ftmodule.h
freetype/include/freetype/config/ftoption.h
freetype/include/freetype/config/ftstdlib.h
freetype/include/freetype/freetype.h
freetype/include/freetype/ftadvanc.h
freetype/include/freetype/ftautoh.h
freetype/include/freetype/ftbbox.h
freetype/include/freetype/ftbdf.h
freetype/include/freetype/ftbitmap.h
freetype/include/freetype/ftbzip2.h
freetype/include/freetype/ftcache.h
freetype/include/freetype/ftcffdrv.h
freetype/include/freetype/ftchapters.h
freetype/include/freetype/ftcid.h
freetype/include/freetype/fterrdef.h
freetype/include/freetype/fterrors.h
freetype/include/freetype/ftfntfmt.h
freetype/include/freetype/ftgasp.h
freetype/include/freetype/ftglyph.h
freetype/include/freetype/ftgxval.h
freetype/include/freetype/ftgzip.h
freetype/include/freetype/ftimage.h
freetype/include/freetype/ftincrem.h
freetype/include/freetype/ftlcdfil.h
freetype/include/freetype/ftlist.h
freetype/include/freetype/ftlzw.h
freetype/include/freetype/ftmac.h
freetype/include/freetype/ftmm.h
freetype/include/freetype/ftmodapi.h
freetype/include/freetype/ftmoderr.h
freetype/include/freetype/ftotval.h
freetype/include/freetype/ftoutln.h
freetype/include/freetype/ftpfr.h
freetype/include/freetype/ftrender.h
freetype/include/freetype/ftsizes.h
freetype/include/freetype/ftsnames.h
freetype/include/freetype/ftstroke.h
freetype/include/freetype/ftsynth.h
freetype/include/freetype/ftsystem.h
freetype/include/freetype/fttrigon.h
freetype/include/freetype/ftttdrv.h
freetype/include/freetype/fttypes.h
freetype/include/freetype/ftwinfnt.h
freetype/include/freetype/internal/autohint.h
freetype/include/freetype/internal/ftcalc.h
freetype/include/freetype/internal/ftdebug.h
freetype/include/freetype/internal/ftdriver.h
freetype/include/freetype/internal/ftgloadr.h
freetype/include/freetype/internal/fthash.h
freetype/include/freetype/internal/ftmemory.h
freetype/include/freetype/internal/ftobjs.h
freetype/include/freetype/internal/ftpic.h
freetype/include/freetype/internal/ftrfork.h
freetype/include/freetype/internal/ftserv.h
freetype/include/freetype/internal/ftstream.h
freetype/include/freetype/internal/fttrace.h
freetype/include/freetype/internal/ftvalid.h
freetype/include/freetype/internal/internal.h
freetype/include/freetype/internal/psaux.h
freetype/include/freetype/internal/pshints.h
freetype/include/freetype/internal/services/svbdf.h
freetype/include/freetype/internal/services/svcid.h
freetype/include/freetype/internal/services/svfntfmt.h
freetype/include/freetype/internal/services/svgldict.h
freetype/include/freetype/internal/services/svgxval.h
freetype/include/freetype/internal/services/svkern.h
freetype/include/freetype/internal/services/svmm.h
freetype/include/freetype/internal/services/svotval.h
freetype/include/freetype/internal/services/svpfr.h
freetype/include/freetype/internal/services/svpostnm.h
freetype/include/freetype/internal/services/svprop.h
freetype/include/freetype/internal/services/svpscmap.h
freetype/include/freetype/internal/services/svpsinfo.h
freetype/include/freetype/internal/services/svsfnt.h
freetype/include/freetype/internal/services/svttcmap.h
freetype/include/freetype/internal/services/svtteng.h
freetype/include/freetype/internal/services/svttglyf.h
freetype/include/freetype/internal/services/svwinfnt.h
freetype/include/freetype/internal/sfnt.h
freetype/include/freetype/internal/t1types.h
freetype/include/freetype/internal/tttypes.h
freetype/include/freetype/t1tables.h
freetype/include/freetype/ttnameid.h
freetype/include/freetype/tttables.h
freetype/include/freetype/tttags.h
freetype/include/freetype/ttunpat.h
freetype/include/ft2build.h
freetype/include/ftadvanc.h
freetype/include/ftautoh.h
freetype/include/ftbbox.h
freetype/include/ftbdf.h
freetype/include/ftbitmap.h
freetype/include/ftbzip2.h
freetype/include/ftcache.h
freetype/include/ftcffdrv.h
freetype/include/ftchapters.h
freetype/include/ftcid.h
freetype/include/fterrdef.h
freetype/include/fterrors.h
freetype/include/ftgasp.h
freetype/include/ftglyph.h
freetype/include/ftgxval.h
freetype/include/ftgzip.h
freetype/include/ftimage.h
freetype/include/ftincrem.h
freetype/include/ftlcdfil.h
freetype/include/ftlist.h
freetype/include/ftlzw.h
freetype/include/ftmac.h
freetype/include/ftmm.h
freetype/include/ftmodapi.h
freetype/include/ftmoderr.h
freetype/include/ftotval.h
freetype/include/ftoutln.h
freetype/include/ftpfr.h
freetype/include/ftrender.h
freetype/include/ftsizes.h
freetype/include/ftsnames.h
freetype/include/ftstroke.h
freetype/include/ftsynth.h
freetype/include/ftsystem.h
freetype/include/fttrigon.h
freetype/include/ftttdrv.h
freetype/include/fttypes.h
freetype/include/ftwinfnt.h
freetype/include/ftxf86.h
freetype/include/internal/autohint.h
freetype/include/internal/ftcalc.h
freetype/include/internal/ftdebug.h
freetype/include/internal/ftdriver.h
freetype/include/internal/ftgloadr.h
freetype/include/internal/ftmemory.h
freetype/include/internal/ftobjs.h
freetype/include/internal/ftpic.h
freetype/include/internal/ftrfork.h
freetype/include/internal/ftserv.h
freetype/include/internal/ftstream.h
freetype/include/internal/fttrace.h
freetype/include/internal/ftvalid.h
freetype/include/internal/internal.h
freetype/include/internal/psaux.h
freetype/include/internal/pshints.h
freetype/include/internal/services/svbdf.h
freetype/include/internal/services/svcid.h
freetype/include/internal/services/svgldict.h
freetype/include/internal/services/svgxval.h
freetype/include/internal/services/svkern.h
freetype/include/internal/services/svmm.h
freetype/include/internal/services/svotval.h
freetype/include/internal/services/svpfr.h
freetype/include/internal/services/svpostnm.h
freetype/include/internal/services/svprop.h
freetype/include/internal/services/svpscmap.h
freetype/include/internal/services/svpsinfo.h
freetype/include/internal/services/svsfnt.h
freetype/include/internal/services/svttcmap.h
freetype/include/internal/services/svtteng.h
freetype/include/internal/services/svttglyf.h
freetype/include/internal/services/svwinfnt.h
freetype/include/internal/services/svxf86nm.h
freetype/include/internal/sfnt.h
freetype/include/internal/t1types.h
freetype/include/internal/tttypes.h
freetype/include/t1tables.h
freetype/include/ttnameid.h
freetype/include/tttables.h
freetype/include/tttags.h
freetype/include/ttunpat.h
freetype/modules.cfg
freetype/src/Jamfile
freetype/src/autofit/Jamfile
freetype/src/autofit/afangles.c
freetype/src/autofit/afblue.c
freetype/src/autofit/afblue.cin
freetype/src/autofit/afblue.dat
freetype/src/autofit/afblue.h
freetype/src/autofit/afblue.hin
freetype/src/autofit/afcjk.c
freetype/src/autofit/afcjk.h
freetype/src/autofit/afcover.h
freetype/src/autofit/afdummy.c
freetype/src/autofit/afdummy.h
freetype/src/autofit/aferrors.h
freetype/src/autofit/afglobal.c
freetype/src/autofit/afglobal.h
freetype/src/autofit/afhints.c
freetype/src/autofit/afhints.h
freetype/src/autofit/afindic.c
freetype/src/autofit/afindic.h
freetype/src/autofit/aflatin.c
freetype/src/autofit/aflatin.h
freetype/src/autofit/aflatin2.c
freetype/src/autofit/aflatin2.h
freetype/src/autofit/afloader.c
freetype/src/autofit/afloader.h
freetype/src/autofit/afmodule.c
freetype/src/autofit/afmodule.h
freetype/src/autofit/afpic.c
freetype/src/autofit/afpic.h
freetype/src/autofit/afranges.c
freetype/src/autofit/afranges.h
freetype/src/autofit/afscript.h
freetype/src/autofit/afshaper.c
freetype/src/autofit/afshaper.h
freetype/src/autofit/afstyles.h
freetype/src/autofit/aftypes.h
freetype/src/autofit/afwarp.c
freetype/src/autofit/afwarp.h
freetype/src/autofit/afwrtsys.h
freetype/src/autofit/autofit.c
freetype/src/autofit/hbshim.c
freetype/src/autofit/hbshim.h
freetype/src/autofit/module.mk
freetype/src/autofit/rules.mk
freetype/src/base/Jamfile
freetype/src/base/basepic.c
freetype/src/base/basepic.h
freetype/src/base/ftadvanc.c
freetype/src/base/ftapi.c
freetype/src/base/ftbase.c
freetype/src/base/ftbase.h
freetype/src/base/ftbbox.c
freetype/src/base/ftbdf.c
freetype/src/base/ftbitmap.c
freetype/src/base/ftcalc.c
freetype/src/base/ftcid.c
freetype/src/base/ftdbgmem.c
freetype/src/base/ftdebug.c
freetype/src/base/ftfntfmt.c
freetype/src/base/ftfstype.c
freetype/src/base/ftgasp.c
freetype/src/base/ftgloadr.c
freetype/src/base/ftglyph.c
freetype/src/base/ftgxval.c
freetype/src/base/fthash.c
freetype/src/base/ftinit.c
freetype/src/base/ftlcdfil.c
freetype/src/base/ftmac.c
freetype/src/base/ftmm.c
freetype/src/base/ftobjs.c
freetype/src/base/ftotval.c
freetype/src/base/ftoutln.c
freetype/src/base/ftpatent.c
freetype/src/base/ftpfr.c
freetype/src/base/ftpic.c
freetype/src/base/ftrfork.c
freetype/src/base/ftsnames.c
freetype/src/base/ftstream.c
freetype/src/base/ftstroke.c
freetype/src/base/ftsynth.c
freetype/src/base/ftsystem.c
freetype/src/base/fttrigon.c
freetype/src/base/fttype1.c
freetype/src/base/ftutil.c
freetype/src/base/ftwinfnt.c
freetype/src/base/ftxf86.c
freetype/src/base/md5.c
freetype/src/base/rules.mk
freetype/src/bdf/Jamfile
freetype/src/bdf/bdf.h
freetype/src/bdf/bdfdrivr.c
freetype/src/bdf/bdfdrivr.h
freetype/src/bdf/bdferror.h
freetype/src/bdf/bdflib.c
freetype/src/bdf/rules.mk
freetype/src/bzip2/Jamfile
freetype/src/bzip2/ftbzip2.c
freetype/src/bzip2/rules.mk
freetype/src/cache/Jamfile
freetype/src/cache/ftcache.c
freetype/src/cache/ftcbasic.c
freetype/src/cache/ftccache.c
freetype/src/cache/ftccache.h
freetype/src/cache/ftccback.h
freetype/src/cache/ftccmap.c
freetype/src/cache/ftcerror.h
freetype/src/cache/ftcglyph.c
freetype/src/cache/ftcglyph.h
freetype/src/cache/ftcimage.c
freetype/src/cache/ftcimage.h
freetype/src/cache/ftcmanag.c
freetype/src/cache/ftcmanag.h
freetype/src/cache/ftcmru.c
freetype/src/cache/ftcmru.h
freetype/src/cache/ftcsbits.c
freetype/src/cache/ftcsbits.h
freetype/src/cache/rules.mk
freetype/src/cff/Jamfile
freetype/src/cff/cf2arrst.c
freetype/src/cff/cf2arrst.h
freetype/src/cff/cf2blues.h
freetype/src/cff/cf2error.h
freetype/src/cff/cf2fixed.h
freetype/src/cff/cf2font.h
freetype/src/cff/cf2ft.c
freetype/src/cff/cf2ft.h
freetype/src/cff/cf2glue.h
freetype/src/cff/cf2hints.c
freetype/src/cff/cf2hints.h
freetype/src/cff/cf2intrp.c
freetype/src/cff/cf2intrp.h
freetype/src/cff/cf2read.h
freetype/src/cff/cf2stack.c
freetype/src/cff/cf2stack.h
freetype/src/cff/cf2types.h
freetype/src/cff/cff.c
freetype/src/cff/cffcmap.c
freetype/src/cff/cffcmap.h
freetype/src/cff/cffdrivr.c
freetype/src/cff/cffdrivr.h
freetype/src/cff/cfferrs.h
freetype/src/cff/cffgload.c
freetype/src/cff/cffgload.h
freetype/src/cff/cffload.c
freetype/src/cff/cffload.h
freetype/src/cff/cffobjs.c
freetype/src/cff/cffobjs.h
freetype/src/cff/cffparse.c
freetype/src/cff/cffparse.h
freetype/src/cff/cffpic.c
freetype/src/cff/cffpic.h
freetype/src/cff/cfftoken.h
freetype/src/cff/cfftypes.h
freetype/src/cff/module.mk
freetype/src/cff/rules.mk
freetype/src/cid/Jamfile
freetype/src/cid/ciderrs.h
freetype/src/cid/cidgload.c
freetype/src/cid/cidgload.h
freetype/src/cid/cidload.c
freetype/src/cid/cidload.h
freetype/src/cid/cidobjs.c
freetype/src/cid/cidobjs.h
freetype/src/cid/cidparse.c
freetype/src/cid/cidparse.h
freetype/src/cid/cidriver.c
freetype/src/cid/cidriver.h
freetype/src/cid/cidtoken.h
freetype/src/cid/module.mk
freetype/src/cid/rules.mk
freetype/src/cid/type1cid.c
freetype/src/gxvalid/Jamfile
freetype/src/gxvalid/README
freetype/src/gxvalid/gxvalid.c
freetype/src/gxvalid/gxvalid.h
freetype/src/gxvalid/gxvbsln.c
freetype/src/gxvalid/gxvcommn.c
freetype/src/gxvalid/gxvcommn.h
freetype/src/gxvalid/gxverror.h
freetype/src/gxvalid/gxvfeat.c
freetype/src/gxvalid/gxvfeat.h
freetype/src/gxvalid/gxvfgen.c
freetype/src/gxvalid/gxvjust.c
freetype/src/gxvalid/gxvkern.c
freetype/src/gxvalid/gxvlcar.c
freetype/src/gxvalid/gxvmod.c
freetype/src/gxvalid/gxvmod.h
freetype/src/gxvalid/gxvmort.c
freetype/src/gxvalid/gxvmort.h
freetype/src/gxvalid/gxvmort0.c
freetype/src/gxvalid/gxvmort1.c
freetype/src/gxvalid/gxvmort2.c
freetype/src/gxvalid/gxvmort4.c
freetype/src/gxvalid/gxvmort5.c
freetype/src/gxvalid/gxvmorx.c
freetype/src/gxvalid/gxvmorx.h
freetype/src/gxvalid/gxvmorx0.c
freetype/src/gxvalid/gxvmorx1.c
freetype/src/gxvalid/gxvmorx2.c
freetype/src/gxvalid/gxvmorx4.c
freetype/src/gxvalid/gxvmorx5.c
freetype/src/gxvalid/gxvopbd.c
freetype/src/gxvalid/gxvprop.c
freetype/src/gxvalid/gxvtrak.c
freetype/src/gxvalid/module.mk
freetype/src/gxvalid/rules.mk
freetype/src/gzip/Jamfile
freetype/src/gzip/ftgzip.c
freetype/src/gzip/rules.mk
freetype/src/gzip/zlib.h
freetype/src/lzw/Jamfile
freetype/src/lzw/ftlzw.c
freetype/src/lzw/ftzopen.c
freetype/src/lzw/ftzopen.h
freetype/src/lzw/rules.mk
freetype/src/otvalid/Jamfile
freetype/src/otvalid/module.mk
freetype/src/otvalid/otvalid.c
freetype/src/otvalid/otvalid.h
freetype/src/otvalid/otvbase.c
freetype/src/otvalid/otvcommn.c
freetype/src/otvalid/otvcommn.h
freetype/src/otvalid/otverror.h
freetype/src/otvalid/otvgdef.c
freetype/src/otvalid/otvgpos.c
freetype/src/otvalid/otvgpos.h
freetype/src/otvalid/otvgsub.c
freetype/src/otvalid/otvjstf.c
freetype/src/otvalid/otvmath.c
freetype/src/otvalid/otvmod.c
freetype/src/otvalid/otvmod.h
freetype/src/otvalid/rules.mk
freetype/src/pcf/Jamfile
freetype/src/pcf/pcf.h
freetype/src/pcf/pcfdrivr.c
freetype/src/pcf/pcfdrivr.h
freetype/src/pcf/pcferror.h
freetype/src/pcf/pcfread.c
freetype/src/pcf/pcfread.h
freetype/src/pcf/pcfutil.h
freetype/src/pcf/rules.mk
freetype/src/pfr/Jamfile
freetype/src/pfr/module.mk
freetype/src/pfr/pfr.c
freetype/src/pfr/pfrcmap.c
freetype/src/pfr/pfrcmap.h
freetype/src/pfr/pfrdrivr.c
freetype/src/pfr/pfrdrivr.h
freetype/src/pfr/pfrerror.h
freetype/src/pfr/pfrgload.c
freetype/src/pfr/pfrgload.h
freetype/src/pfr/pfrload.c
freetype/src/pfr/pfrload.h
freetype/src/pfr/pfrobjs.c
freetype/src/pfr/pfrobjs.h
freetype/src/pfr/pfrsbit.c
freetype/src/pfr/pfrsbit.h
freetype/src/pfr/pfrtypes.h
freetype/src/pfr/rules.mk
freetype/src/psaux/Jamfile
freetype/src/psaux/afmparse.c
freetype/src/psaux/afmparse.h
freetype/src/psaux/module.mk
freetype/src/psaux/psaux.c
freetype/src/psaux/psauxerr.h
freetype/src/psaux/psauxmod.c
freetype/src/psaux/psauxmod.h
freetype/src/psaux/psconv.c
freetype/src/psaux/psconv.h
freetype/src/psaux/psobjs.c
freetype/src/psaux/psobjs.h
freetype/src/psaux/rules.mk
freetype/src/psaux/t1cmap.c
freetype/src/psaux/t1cmap.h
freetype/src/psaux/t1decode.c
freetype/src/psaux/t1decode.h
freetype/src/pshinter/Jamfile
freetype/src/pshinter/module.mk
freetype/src/pshinter/pshalgo.c
freetype/src/pshinter/pshalgo.h
freetype/src/pshinter/pshglob.c
freetype/src/pshinter/pshglob.h
freetype/src/pshinter/pshinter.c
freetype/src/pshinter/pshmod.c
freetype/src/pshinter/pshmod.h
freetype/src/pshinter/pshnterr.h
freetype/src/pshinter/pshpic.c
freetype/src/pshinter/pshpic.h
freetype/src/pshinter/pshrec.c
freetype/src/pshinter/pshrec.h
freetype/src/pshinter/rules.mk
freetype/src/psnames/Jamfile
freetype/src/psnames/module.mk
freetype/src/psnames/psmodule.c
freetype/src/psnames/psmodule.h
freetype/src/psnames/psnamerr.h
freetype/src/psnames/psnames.c
freetype/src/psnames/pspic.c
freetype/src/psnames/pspic.h
freetype/src/psnames/pstables.h
freetype/src/psnames/rules.mk
freetype/src/raster/Jamfile
freetype/src/raster/ftmisc.h
freetype/src/raster/ftraster.c
freetype/src/raster/ftraster.h
freetype/src/raster/ftrend1.c
freetype/src/raster/ftrend1.h
freetype/src/raster/module.mk
freetype/src/raster/raster.c
freetype/src/raster/rasterrs.h
freetype/src/raster/rastpic.c
freetype/src/raster/rastpic.h
freetype/src/raster/rules.mk
freetype/src/sfnt/Jamfile
freetype/src/sfnt/module.mk
freetype/src/sfnt/pngshim.c
freetype/src/sfnt/pngshim.h
freetype/src/sfnt/rules.mk
freetype/src/sfnt/sfdriver.c
freetype/src/sfnt/sfdriver.h
freetype/src/sfnt/sferrors.h
freetype/src/sfnt/sfnt.c
freetype/src/sfnt/sfntpic.c
freetype/src/sfnt/sfntpic.h
freetype/src/sfnt/sfobjs.c
freetype/src/sfnt/sfobjs.h
freetype/src/sfnt/ttbdf.c
freetype/src/sfnt/ttbdf.h
freetype/src/sfnt/ttcmap.c
freetype/src/sfnt/ttcmap.h
freetype/src/sfnt/ttcmapc.h
freetype/src/sfnt/ttkern.c
freetype/src/sfnt/ttkern.h
freetype/src/sfnt/ttload.c
freetype/src/sfnt/ttload.h
freetype/src/sfnt/ttmtx.c
freetype/src/sfnt/ttmtx.h
freetype/src/sfnt/ttpost.c
freetype/src/sfnt/ttpost.h
freetype/src/sfnt/ttsbit.c
freetype/src/sfnt/ttsbit.h
freetype/src/smooth/Jamfile
freetype/src/smooth/ftgrays.c
freetype/src/smooth/ftgrays.h
freetype/src/smooth/ftsmerrs.h
freetype/src/smooth/ftsmooth.c
freetype/src/smooth/ftsmooth.h
freetype/src/smooth/ftspic.c
freetype/src/smooth/ftspic.h
freetype/src/smooth/module.mk
freetype/src/smooth/rules.mk
freetype/src/smooth/smooth.c
freetype/src/tools/afblue.pl
freetype/src/tools/apinames.c
freetype/src/tools/chktrcmp.py
freetype/src/tools/docmaker/content.py
freetype/src/tools/docmaker/docmaker.py
freetype/src/tools/docmaker/formatter.py
freetype/src/tools/docmaker/sources.py
freetype/src/tools/docmaker/tohtml.py
freetype/src/tools/docmaker/utils.py
freetype/src/tools/ftfuzzer/README
freetype/src/tools/ftfuzzer/ftfuzzer.cc
freetype/src/tools/ftfuzzer/ftmutator.cc
freetype/src/tools/ftfuzzer/rasterfuzzer.cc
freetype/src/tools/ftfuzzer/runinput.cc
freetype/src/tools/ftrandom/Makefile
freetype/src/tools/ftrandom/README
freetype/src/tools/ftrandom/ftrandom.c
freetype/src/tools/glnames.py
freetype/src/tools/no-copyright
freetype/src/tools/test_afm.c
freetype/src/tools/update-copyright
freetype/src/tools/update-copyright-year
freetype/src/truetype/Jamfile
freetype/src/truetype/module.mk
freetype/src/truetype/rules.mk
freetype/src/truetype/truetype.c
freetype/src/truetype/ttdriver.c
freetype/src/truetype/ttdriver.h
freetype/src/truetype/tterrors.h
freetype/src/truetype/ttgload.c
freetype/src/truetype/ttgload.h
freetype/src/truetype/ttgxvar.c
freetype/src/truetype/ttgxvar.h
freetype/src/truetype/ttinterp.c
freetype/src/truetype/ttinterp.h
freetype/src/truetype/ttobjs.c
freetype/src/truetype/ttobjs.h
freetype/src/truetype/ttpic.c
freetype/src/truetype/ttpic.h
freetype/src/truetype/ttpload.c
freetype/src/truetype/ttpload.h
freetype/src/truetype/ttsubpix.c
freetype/src/truetype/ttsubpix.h
freetype/src/type1/Jamfile
freetype/src/type1/module.mk
freetype/src/type1/rules.mk
freetype/src/type1/t1afm.c
freetype/src/type1/t1afm.h
freetype/src/type1/t1driver.c
freetype/src/type1/t1driver.h
freetype/src/type1/t1errors.h
freetype/src/type1/t1gload.c
freetype/src/type1/t1gload.h
freetype/src/type1/t1load.c
freetype/src/type1/t1load.h
freetype/src/type1/t1objs.c
freetype/src/type1/t1objs.h
freetype/src/type1/t1parse.c
freetype/src/type1/t1parse.h
freetype/src/type1/t1tokens.h
freetype/src/type1/type1.c
freetype/src/type42/Jamfile
freetype/src/type42/module.mk
freetype/src/type42/rules.mk
freetype/src/type42/t42drivr.c
freetype/src/type42/t42drivr.h
freetype/src/type42/t42error.h
freetype/src/type42/t42objs.c
freetype/src/type42/t42objs.h
freetype/src/type42/t42parse.c
freetype/src/type42/t42parse.h
freetype/src/type42/t42types.h
freetype/src/type42/type42.c
freetype/src/winfonts/Jamfile
freetype/src/winfonts/fnterrs.h
freetype/src/winfonts/module.mk
freetype/src/winfonts/rules.mk
freetype/src/winfonts/winfnt.c
freetype/src/winfonts/winfnt.h
freetype/vms_make.com


2016-11-15 09:58:58 +0000
Chris Liddell <chris.liddell@artifex.com>
99c6a18eb430a9091c79369b2bdd2952d481c7d5

Document use of string for subsituted CIDFont name

Add a comment and example at the top of cidfmap with details of dealing with
CIDFont names with spaces in them.

Resource/Init/cidfmap


2016-11-07 14:52:28 +0000
Chris Liddell <chris.liddell@artifex.com>
23dc144b3c3d3dbafd83dca7b9c09e6977b774d6

Update lcms2 to 2.8

Tweak makefile for lcms2 2.8

Delete mac file system specific files from lcms2 tree

Bug 697056: Fix LCMS static init of critical section.

LCMS2 relies on being able to statically init a mutex
(actually a Critical Section on windows). Windows has
no official API for statically initing a critical
section, so lcms2 uses a hack (albeit it a safe one)
to do this.

Unfortunately ApplicationVerifier (and presumably other
similar tools) don't understand this idiom, and get
confused by not seeing an explicit initialisation call.
This is causing problems for a customer.

This commit therefore introduces code to properly
initialise it on Windows. In order to avoid any possible
multithreaded startup issues, we use the Windows
InterlockedCompareExchangePointer API (introduced in
Windows XP).

If anyone wants to avoid this code (so they can work
on pre-Windows XP), they can build with:

CMS_RELY_ON_WINDOWS_STATIC_MUTEX_INIT

defined, and get the old behaviour. We automatically
set this when building with any version of MSVC older
than VS2005 (i.e. those that don't have that API
available).

base/lcms2.mak
lcms2/AUTHORS
lcms2/ChangeLog
lcms2/Makefile.am
lcms2/Makefile.in
lcms2/Projects/BorlandC_5.5/lcms2.rc
lcms2/Projects/BorlandC_5.5/lcmsdll.lst
lcms2/Projects/VC2008/jpegicc/jpegicc.vcproj
lcms2/Projects/VC2008/lcms2.rc
lcms2/Projects/VC2008/lcms2.sln
lcms2/Projects/VC2008/lcms2_DLL/lcms2_DLL.vcproj
lcms2/Projects/VC2008/lcms2_static/lcms2_static.vcproj
lcms2/Projects/VC2008/linkicc/linkicc.vcproj
lcms2/Projects/VC2008/psicc/psicc.vcproj
lcms2/Projects/VC2008/resource.h
lcms2/Projects/VC2008/testbed/testbed.vcproj
lcms2/Projects/VC2008/tiffdiff/tiffdiff.vcproj
lcms2/Projects/VC2008/tifficc/tifficc.vcproj
lcms2/Projects/VC2008/transicc/transicc.vcproj
lcms2/Projects/VC2010/jpegicc/jpegicc.vcproj
lcms2/Projects/VC2010/jpegicc/jpegicc.vcxproj
lcms2/Projects/VC2010/lcms2.rc
lcms2/Projects/VC2010/lcms2.sln
lcms2/Projects/VC2010/lcms2_DLL/lcms2_DLL.vcproj
lcms2/Projects/VC2010/lcms2_static/lcms2_static.vcproj
lcms2/Projects/VC2010/linkicc/linkicc.vcproj
lcms2/Projects/VC2010/psicc/psicc.vcproj
lcms2/Projects/VC2010/testbed/testbed.vcproj
lcms2/Projects/VC2010/tiffdiff/tiffdiff.vcproj
lcms2/Projects/VC2010/tifficc/tifficc.vcproj
lcms2/Projects/VC2010/transicc/transicc.vcproj
lcms2/Projects/VC2012/jpegicc/jpegicc.vcproj
lcms2/Projects/VC2012/jpegicc/jpegicc.vcxproj
lcms2/Projects/VC2012/jpegicc/jpegicc.vcxproj.filters
lcms2/Projects/VC2012/lcms2.rc
lcms2/Projects/VC2012/lcms2.sln
lcms2/Projects/VC2012/lcms2_DLL/lcms2_DLL.vcproj
lcms2/Projects/VC2012/lcms2_DLL/lcms2_DLL.vcxproj
lcms2/Projects/VC2012/lcms2_DLL/lcms2_DLL.vcxproj.filters
lcms2/Projects/VC2012/lcms2_static/lcms2_static.vcproj
lcms2/Projects/VC2012/lcms2_static/lcms2_static.vcxproj
lcms2/Projects/VC2012/lcms2_static/lcms2_static.vcxproj.filters
lcms2/Projects/VC2012/linkicc/linkicc.vcproj
lcms2/Projects/VC2012/linkicc/linkicc.vcxproj
lcms2/Projects/VC2012/linkicc/linkicc.vcxproj.filters
lcms2/Projects/VC2012/psicc/psicc.vcproj
lcms2/Projects/VC2012/psicc/psicc.vcxproj
lcms2/Projects/VC2012/psicc/psicc.vcxproj.filters
lcms2/Projects/VC2012/resource.h
lcms2/Projects/VC2012/testbed/testbed.vcproj
lcms2/Projects/VC2012/testbed/testbed.vcxproj
lcms2/Projects/VC2012/testbed/testbed.vcxproj.filters
lcms2/Projects/VC2012/tiffdiff/tiffdiff.vcproj
lcms2/Projects/VC2012/tiffdiff/tiffdiff.vcxproj
lcms2/Projects/VC2012/tiffdiff/tiffdiff.vcxproj.filters
lcms2/Projects/VC2012/tifficc/tifficc.vcproj
lcms2/Projects/VC2012/tifficc/tifficc.vcxproj
lcms2/Projects/VC2012/tifficc/tifficc.vcxproj.filters
lcms2/Projects/VC2012/transicc/transicc.vcproj
lcms2/Projects/VC2012/transicc/transicc.vcxproj
lcms2/Projects/VC2012/transicc/transicc.vcxproj.filters
lcms2/Projects/VC2013/jpegicc/jpegicc.vcxproj
lcms2/Projects/VC2013/jpegicc/jpegicc.vcxproj.filters
lcms2/Projects/VC2013/lcms2.rc
lcms2/Projects/VC2013/lcms2.sln
lcms2/Projects/VC2013/lcms2_DLL/lcms2_DLL.vcxproj
lcms2/Projects/VC2013/lcms2_DLL/lcms2_DLL.vcxproj.filters
lcms2/Projects/VC2013/lcms2_static/lcms2_static.vcxproj
lcms2/Projects/VC2013/lcms2_static/lcms2_static.vcxproj.filters
lcms2/Projects/VC2013/linkicc/linkicc.vcxproj
lcms2/Projects/VC2013/linkicc/linkicc.vcxproj.filters
lcms2/Projects/VC2013/psicc/psicc.vcxproj
lcms2/Projects/VC2013/psicc/psicc.vcxproj.filters
lcms2/Projects/VC2013/resource.h
lcms2/Projects/VC2013/testbed/testbed.vcxproj
lcms2/Projects/VC2013/testbed/testbed.vcxproj.filters
lcms2/Projects/VC2013/tiffdiff/tiffdiff.vcxproj
lcms2/Projects/VC2013/tiffdiff/tiffdiff.vcxproj.filters
lcms2/Projects/VC2013/tifficc/tifficc.vcxproj
lcms2/Projects/VC2013/tifficc/tifficc.vcxproj.filters
lcms2/Projects/VC2013/transicc/transicc.vcxproj
lcms2/Projects/VC2013/transicc/transicc.vcxproj.filters
lcms2/Projects/VC2015/jpegicc/jpegicc.vcxproj
lcms2/Projects/VC2015/jpegicc/jpegicc.vcxproj.filters
lcms2/Projects/VC2015/lcms2.rc
lcms2/Projects/VC2015/lcms2.sln
lcms2/Projects/VC2015/lcms2_DLL/lcms2_DLL.vcxproj
lcms2/Projects/VC2015/lcms2_DLL/lcms2_DLL.vcxproj.filters
lcms2/Projects/VC2015/lcms2_static/lcms2_static.vcxproj
lcms2/Projects/VC2015/lcms2_static/lcms2_static.vcxproj.filters
lcms2/Projects/VC2015/linkicc/linkicc.vcxproj
lcms2/Projects/VC2015/linkicc/linkicc.vcxproj.filters
lcms2/Projects/VC2015/psicc/psicc.vcxproj
lcms2/Projects/VC2015/psicc/psicc.vcxproj.filters
lcms2/Projects/VC2015/resource.h
lcms2/Projects/VC2015/testbed/testbed.vcxproj
lcms2/Projects/VC2015/testbed/testbed.vcxproj.filters
lcms2/Projects/VC2015/tiffdiff/tiffdiff.vcxproj
lcms2/Projects/VC2015/tiffdiff/tiffdiff.vcxproj.filters
lcms2/Projects/VC2015/tifficc/tifficc.vcxproj
lcms2/Projects/VC2015/tifficc/tifficc.vcxproj.filters
lcms2/Projects/VC2015/transicc/transicc.vcxproj
lcms2/Projects/VC2015/transicc/transicc.vcxproj.filters
lcms2/Projects/cppcheck/lcms2.cppcheck
lcms2/Projects/mac/LittleCMS/._Info.plist
lcms2/Projects/mac/LittleCMS/._LittleCMS.xcodeproj
lcms2/Projects/mac/LittleCMS/English.lproj/InfoPlist.strings
lcms2/Projects/mac/LittleCMS/Info.plist
lcms2/Projects/mac/LittleCMS/LittleCMS.xcodeproj/mariama.mode1v3
lcms2/Projects/mac/LittleCMS/LittleCMS.xcodeproj/mariama.pbxuser
lcms2/Projects/mac/LittleCMS/LittleCMS.xcodeproj/project.pbxproj
lcms2/Projects/mac/LittleCMS/LittleCMS.xcodeproj/project.xcworkspace/contents.xcworkspacedata
lcms2/Projects/mac/LittleCMS/LittleCMS.xcodeproj/project.xcworkspace/xcuserdata/User.xcuserdatad/UserInterfaceState.xcuserstate
lcms2/Projects/mac/LittleCMS/LittleCMS.xcodeproj/project.xcworkspace/xcuserdata/User.xcuserdatad/WorkspaceSettings.xcsettings
lcms2/Projects/mac/LittleCMS/LittleCMS.xcodeproj/xcuserdata/User.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
lcms2/Projects/mac/LittleCMS/LittleCMS.xcodeproj/xcuserdata/User.xcuserdatad/xcschemes/LittleCMS.xcscheme
lcms2/Projects/mac/LittleCMS/LittleCMS.xcodeproj/xcuserdata/User.xcuserdatad/xcschemes/testbed.xcscheme
lcms2/Projects/mac/LittleCMS/LittleCMS.xcodeproj/xcuserdata/User.xcuserdatad/xcschemes/xcschememanagement.plist
lcms2/Projects/mac/LittleCMS/LittleCMS_Prefix.pch
lcms2/Projects/mac/LittleCMS/TestBed-Info.plist
lcms2/aclocal.m4
lcms2/autogen.sh
lcms2/compile
lcms2/config.guess
lcms2/config.sub
lcms2/configure
lcms2/configure.ac
lcms2/depcomp
lcms2/doc/LittleCMS2.6 API.pdf
lcms2/doc/LittleCMS2.6 Plugin API.pdf
lcms2/doc/LittleCMS2.6 tutorial.pdf
lcms2/doc/LittleCMS2.8 API.pdf
lcms2/doc/LittleCMS2.8 Plugin API.pdf
lcms2/doc/LittleCMS2.8 tutorial.pdf
lcms2/doc/src.zip
lcms2/include/Makefile.in
lcms2/include/lcms2.h
lcms2/include/lcms2_plugin.h
lcms2/install-sh
lcms2/ltmain.sh
lcms2/m4/acx_pthread.m4
lcms2/m4/libtool.m4
lcms2/m4/ltoptions.m4
lcms2/m4/ltsugar.m4
lcms2/m4/ltversion.m4
lcms2/m4/lt~obsolete.m4
lcms2/missing
lcms2/src/Makefile.am
lcms2/src/Makefile.in
lcms2/src/cmsalpha.c
lcms2/src/cmscam02.c
lcms2/src/cmscgats.c
lcms2/src/cmscnvrt.c
lcms2/src/cmserr.c
lcms2/src/cmsgamma.c
lcms2/src/cmsgmt.c
lcms2/src/cmshalf.c
lcms2/src/cmsintrp.c
lcms2/src/cmsio0.c
lcms2/src/cmsio1.c
lcms2/src/cmslut.c
lcms2/src/cmsmd5.c
lcms2/src/cmsmtrx.c
lcms2/src/cmsnamed.c
lcms2/src/cmsopt.c
lcms2/src/cmspack.c
lcms2/src/cmspcs.c
lcms2/src/cmsplugin.c
lcms2/src/cmsps2.c
lcms2/src/cmssamp.c
lcms2/src/cmssm.c
lcms2/src/cmstypes.c
lcms2/src/cmsvirt.c
lcms2/src/cmswtpnt.c
lcms2/src/cmsxform.c
lcms2/src/extra_xform.h
lcms2/src/lcms2.def
lcms2/src/lcms2_internal.h
lcms2/testbed/Makefile.am
lcms2/testbed/Makefile.in
lcms2/testbed/crayons.icc
lcms2/testbed/ibm-t61.icc
lcms2/testbed/new.icc
lcms2/testbed/test1.icc
lcms2/testbed/test2.icc
lcms2/testbed/test3.icc
lcms2/testbed/test4.icc
lcms2/testbed/test5.icc
lcms2/testbed/testcms2.c
lcms2/testbed/testcms2.h
lcms2/testbed/testplugin.c
lcms2/testbed/toosmall.icc
lcms2/testbed/zoo_icc.c
lcms2/utils/common/utils.h
lcms2/utils/common/vprf.c
lcms2/utils/delphi/delphidemo.res
lcms2/utils/delphi/demo1.dfm
lcms2/utils/delphi/lcms2.dll
lcms2/utils/delphi/lcms2dll.pas
lcms2/utils/jpgicc/LICENSE_iccjpeg
lcms2/utils/jpgicc/Makefile.am
lcms2/utils/jpgicc/Makefile.in
lcms2/utils/jpgicc/iccjpeg.c
lcms2/utils/jpgicc/jpgicc.1
lcms2/utils/jpgicc/jpgicc.c
lcms2/utils/linkicc/Makefile.am
lcms2/utils/linkicc/Makefile.in
lcms2/utils/linkicc/linkicc.1
lcms2/utils/linkicc/linkicc.c
lcms2/utils/psicc/Makefile.am
lcms2/utils/psicc/Makefile.in
lcms2/utils/psicc/psicc.1
lcms2/utils/psicc/psicc.c
lcms2/utils/samples/Makefile.am
lcms2/utils/samples/roundtrip.c
lcms2/utils/samples/wtpt.c
lcms2/utils/tificc/Makefile.am
lcms2/utils/tificc/Makefile.in
lcms2/utils/tificc/tifdiff.c
lcms2/utils/tificc/tificc.1
lcms2/utils/tificc/tificc.c
lcms2/utils/transicc/Makefile.am
lcms2/utils/transicc/Makefile.in
lcms2/utils/transicc/transicc.1
lcms2/utils/transicc/transicc.c


2016-11-07 10:42:05 +0000
Chris Liddell <chris.liddell@artifex.com>
64ad2a92195fd05e9ba34995ae994eb250fc9c7c

Update libpng to 1.6.26

libpng/ANNOUNCE
libpng/CHANGES
libpng/CMakeLists.txt
libpng/INSTALL
libpng/LICENSE
libpng/Makefile.am
libpng/Makefile.in
libpng/README
libpng/TODO
libpng/arm/arm_init.c
libpng/arm/filter_neon_intrinsics.c
libpng/autogen.sh
libpng/config.h.in
libpng/configure
libpng/configure.ac
libpng/contrib/README.txt
libpng/contrib/arm-neon/README
libpng/contrib/arm-neon/linux-auxv.c
libpng/contrib/arm-neon/linux.c
libpng/contrib/conftest/pngcp.dfa
libpng/contrib/examples/README.txt
libpng/contrib/examples/iccfrompng.c
libpng/contrib/examples/pngpixel.c
libpng/contrib/examples/pngtopng.c
libpng/contrib/examples/simpleover.c
libpng/contrib/gregbook/README
libpng/contrib/gregbook/readpng2.c
libpng/contrib/gregbook/rpng-win.c
libpng/contrib/gregbook/rpng2-win.c
libpng/contrib/gregbook/rpng2-x.c
libpng/contrib/intel/INSTALL
libpng/contrib/intel/filter_sse2_intrinsics.c
libpng/contrib/intel/intel_init.c
libpng/contrib/intel/intel_sse.patch
libpng/contrib/libtests/fakepng.c
libpng/contrib/libtests/makepng.c
libpng/contrib/libtests/pngimage.c
libpng/contrib/libtests/pngstest-errors.h
libpng/contrib/libtests/pngstest.c
libpng/contrib/libtests/pngunknown.c
libpng/contrib/libtests/pngvalid.c
libpng/contrib/libtests/readpng.c
libpng/contrib/libtests/tarith.c
libpng/contrib/libtests/timepng.c
libpng/contrib/mips-msa/README
libpng/contrib/mips-msa/linux.c
libpng/contrib/pngminus/README
libpng/contrib/pngminus/png2pnm.c
libpng/contrib/pngminus/pnm2png.c
libpng/contrib/pngsuite/README
libpng/contrib/tools/README.txt
libpng/contrib/tools/chkfmt
libpng/contrib/tools/genpng.c
libpng/contrib/tools/png-fix-itxt.c
libpng/contrib/tools/pngcp.c
libpng/contrib/tools/pngfix.c
libpng/contrib/tools/reindent
libpng/contrib/visupng/PngFile.c
libpng/example.c
libpng/libpng-manual.txt
libpng/libpng.3
libpng/libpngpf.3
libpng/mips/filter_msa_intrinsics.c
libpng/mips/mips_init.c
libpng/png.5
libpng/png.c
libpng/png.h
libpng/pngconf.h
libpng/pngdebug.h
libpng/pngerror.c
libpng/pngget.c
libpng/pnginfo.h
libpng/pngmem.c
libpng/pngpread.c
libpng/pngpriv.h
libpng/pngread.c
libpng/pngrio.c
libpng/pngrtran.c
libpng/pngrutil.c
libpng/pngset.c
libpng/pngstruct.h
libpng/pngtest.c
libpng/pngtrans.c
libpng/pngwio.c
libpng/pngwrite.c
libpng/pngwtran.c
libpng/pngwutil.c
libpng/projects/vstudio/README.txt
libpng/projects/vstudio/WARNING
libpng/projects/vstudio/libpng/libpng.vcxproj
libpng/projects/vstudio/pnglibconf/pnglibconf.vcxproj
libpng/projects/vstudio/pngstest/pngstest.vcxproj
libpng/projects/vstudio/pngtest/pngtest.vcxproj
libpng/projects/vstudio/pngunknown/pngunknown.vcxproj
libpng/projects/vstudio/pngvalid/pngvalid.vcxproj
libpng/projects/vstudio/readme.txt
libpng/projects/vstudio/zlib.props
libpng/projects/vstudio/zlib/zlib.vcxproj
libpng/scripts/README.txt
libpng/scripts/def.c
libpng/scripts/genchk.cmake.in
libpng/scripts/genout.cmake.in
libpng/scripts/gensrc.cmake.in
libpng/scripts/libpng-config-head.in
libpng/scripts/libpng.pc.in
libpng/scripts/makefile.cegcc
libpng/scripts/makefile.linux
libpng/scripts/makefile.msys
libpng/scripts/makefile.ne12bsd
libpng/scripts/makefile.netbsd
libpng/scripts/makefile.openbsd
libpng/scripts/makefile.sco
libpng/scripts/pnglibconf.dfa
libpng/scripts/pnglibconf.h.prebuilt
libpng/scripts/symbols.def
libpng/scripts/test.cmake.in
libpng/tests/pngimage-full
libpng/tests/pngimage-quick
libpng/tests/pngstest
libpng/tests/pngstest-0g01
libpng/tests/pngstest-0g02
libpng/tests/pngstest-0g04
libpng/tests/pngstest-0g08
libpng/tests/pngstest-0g16
libpng/tests/pngstest-2c08
libpng/tests/pngstest-2c16
libpng/tests/pngstest-3p01
libpng/tests/pngstest-3p02
libpng/tests/pngstest-3p04
libpng/tests/pngstest-3p08
libpng/tests/pngstest-4a08
libpng/tests/pngstest-4a16
libpng/tests/pngstest-6a08
libpng/tests/pngstest-6a16
libpng/tests/pngstest-error
libpng/tests/pngtest
libpng/tests/pngunknown-IDAT
libpng/tests/pngunknown-discard
libpng/tests/pngunknown-if-safe
libpng/tests/pngunknown-sAPI
libpng/tests/pngunknown-sTER
libpng/tests/pngunknown-save
libpng/tests/pngunknown-vpAg
libpng/tests/pngvalid-gamma-16-to-8
libpng/tests/pngvalid-gamma-alpha-mode
libpng/tests/pngvalid-gamma-background
libpng/tests/pngvalid-gamma-expand16-alpha-mode
libpng/tests/pngvalid-gamma-expand16-background
libpng/tests/pngvalid-gamma-expand16-transform
libpng/tests/pngvalid-gamma-sbit
libpng/tests/pngvalid-gamma-threshold
libpng/tests/pngvalid-gamma-transform
libpng/tests/pngvalid-progressive-interlace-size
libpng/tests/pngvalid-progressive-interlace-standard
libpng/tests/pngvalid-progressive-interlace-transform
libpng/tests/pngvalid-progressive-standard
libpng/tests/pngvalid-standard


2016-11-22 09:14:28 +0000
Ken Sharp <ken.sharp@artifex.com>
1b1e7f3f4abf7a97101ff7f4e2389ca2edd9af0a

PDF Interpreter - ensure /Separation ink names are not indirect objects

Bug #697358 "PDF interpreter throws an error on a colour space"

Another bizarre file that thinks its a good idea to reference items
as indirect objects instead of a simple inclusion. This time its the
ink name in a /Separation space.

Simply make sure it is not an indirect object.

Resource/Init/pdf_draw.ps


2016-10-20 13:53:06 -0700
Michael Vrhel <michael.vrhel@artifex.com>
47294ff5b168d25bfc7db64f51572d64b8ebde91

Bug 697345 Blend Color Space Support for Separation devices

This is a rather large commit that brings support for transparency
blend color spaces to the separation devices. Previously the
transparency compositor always used CMYK for the blend color space
if the output device was a separation device.

With this commit:

If the blend space is RGB or Gray based, then we now ensure that the
alternate tint transform is not used when we encounter a separation or DeviceN color space.
(assuming we have not run out of spot color space at the target device). Note that
if the any of the spot colors in a DeviceN color space are CMYK process colorants and the
blend space is Gray or RGB, the alternate tint transform IS used.

2) The pdf14 compositor now handles a mixture of additive and subtractive components.
I.e. RGB + spots or Gray + spots.

3) If the blend mode is non white preserving or not separable, then the spot colors
use the normal blend mode while the process colorants use the specified blend mode.

4) In the process there was a bit of code clean up. But much remains to be cleaned.

base/gdevdevn.c
base/gdevdevn.h
base/gdevdsha.c
base/gdevp14.c
base/gdevp14.h
base/gscdevn.c
base/gscsepr.c
base/gxblend.c
base/gxblend.h
base/gxblend1.c
base/gxclrast.c
base/gxcmap.h
base/gxdcolor.c
base/gxdevsop.h
base/gxshade6.c
base/lib.mak


2016-11-17 16:45:04 +0000
Robin Watts <robin.watts@artifex.com>
c9d8618934ebf682f72dd9b3ebef48b2be535a8d

Change API for put_image

base/gdevflp.c
base/gdevmpla.c
base/gdevoflt.c
base/gdevp14.c
base/gdevsclass.c
base/gxblend1.c
base/gxdevcli.h
devices/gdevbit.c
devices/gdevpng.c


2016-11-21 15:43:14 +0000
Ken Sharp <ken.sharp@artifex.com>
b33ffc0e958b613cd6ba114d42720694b11219ff

PDF interpreter - ensure Rect array entries are not indirect objects

Bug #697357 "Can't handle annots where /Rect entries are indirect"

The example file has an insanely constructed Rect entry, where not only
is the /Rect value itself an indirect object, but each of the entries
in the array is also an indirect object.

Here we ensure that the entries in a /Rect for an annotation are
fully resolved.

Resource/Init/pdf_draw.ps


2016-11-21 11:30:50 +0000
Ken Sharp <ken.sharp@artifex.com>
737da8a64a873ea128c5830519d3327baecc6444

PDF interpreter - when detecting transparent pages, include Form 'Groups'

Bug #697354 "PDF Interpreter fails to push pdf14 compositor"

We have an optimisation in the PDF interpreter which ignores page
level Group definitions, as these have no effect on the output.

However, the way this is performed meant that we also did not detect
Group entries in Form XObjects. So if the only transparency on a page
was a Form XObject with a Group entry, then we would incorrectly
decide that the page had no transparency.

We do still want to do the performance check at the page level, but its
important that we include Form XObject Groups in the resources check. So
here we specifically check Form XObjects to see if they have a Group.

This produces differences in a few files, surprisingly miniscule
differences. It appears that we have a number of files which include
Forms with Group entries which, as is so often the case with PDF
files produced by naive graphics libraries, don't actually *do* any
real transparency.

Unfortunately this does mean we now process those files slower than
we did before (and ps2write now produces images for them), but I don't
see any real prospect of detecting pointless transparency at this depth
in a PDF file.

So the only differences are small colour changes depending on the
ProcessColorModel of the destination device. None of these appear to
be significant to me.

Resource/Init/pdf_main.ps


2016-11-16 14:13:18 -0200
Till Kamppeter <till.kamppeter@gmail.com>
36269a8e76b7b495eba9cc061ebf52163188876a

"rpdl" output device: Allow 5pt tolerance for page size selection

The "rpdl" printer driver required an exact match of the page size in
points so that the correct command for selecting the page size was
sent to the printer. Otherwise the printer received the command for a
custom size. Tis is fixed now, allowing a 5-point tolerance (Bug
697348).

contrib/japanese/gdevrpdl.c


2016-11-15 15:06:58 +0000
Robin Watts <robin.watts@artifex.com>
99e9ca317adbd28b5faf3e9eda4c63d636478f43

Bug 697045: Skip over broken tile data rather than aborting.

openjpeg/src/lib/openjp2/j2k.c


2016-11-01 18:50:30 +0000
Robin Watts <robin.watts@artifex.com>
2f6ddae95676585717159445001fda2ebb00db8d

Squash compiler warning.

base/gxccman.c


2016-11-14 16:59:45 +0000
Ken Sharp <ken.sharp@artifex.com>
90b7603c1afb3ad79a6a0dfee97560b1c3565379

PCL - fix pdfmark parsing for PUTFILE

Bug #697285 "Not able to produce a valid PDF/A - Invalid ColorSpace error opening a PDF"

We have a special pdfmark type '/PUTFILE' for dealing with files,
because unlike PostScript we can't deal with these as file objects in
PJL. The code reading the file had a bug, I think caused by altering
for error detection.

Fixed here, and returned the error back up the tree. However, note that
the PCL interpreter still ignores error returns from PJL parsing.

No differences expected.

pcl/pl/plparams.c


2016-11-14 15:06:49 +0000
Ken Sharp <ken.sharp@artifex.com>
0f6067d2531298060392d0e25fa759d320e03021

ps2write - don't try to alter /pagesave when modifying media size

Bug #697245 " Generated postscript by ps2write causes limitcheck for save error"

When altering the media size for a page the code defined the save object
'pagesave' with the new media size. I believe the intention was probably
to have the new media size persist, in order to avoid calling setpagdevice
for every subsequent page with the modified media.

Unfortunately, this does not remove the prior 'save' object attached to
/pagesave. The only way to get rid of that is to actually 'restore' it.

So, fundamentally, we need to remove the definition of pagesave from
the code which sets the media size. We can achieve the same effect in a
rather more roundabout fashion by also moving the definition of pagesave
within the page stream to a point after the definition of the page
dictionary.

Less neat, but it works.

For some obscure reason this results in some pages being rendered
very slightly different sizes on the cluster. I've checked and the
current sizes are correct. I have no idea why this was wrong before
and I'm not interested enough to go looking, since they are now
correct.

devices/vector/gdevpdf.c
devices/vector/opdfread.h
lib/opdfread.ps


2016-11-14 10:14:01 +0000
Ken Sharp <ken.sharp@artifex.com>
8cefc79359e14fdb8b967697bba33b754e83bcad

pdfwrite - fix calculation of a bounding box

Bug #697237 "ps2pdf not producing correct PDF with a rotated character in the PS"

The code for detecting a glyph which is completely clipped out of the
output had a fault; after calculating the Font BoundingBox in current
user space, it only considered three of the points of the resulting
rectangle to calculate the largest rectangle.

This erroneous rectangle was then used to decide if a glyph was entirely
outside the clipping area. Since the top left corner was not considered
a sufficiently large glyph rotated to an acute enough anti-clockwise
angle could appear to be totally clipped when in fact it is only
partially clipped.

Fix this here by considering all four points.

This show two very minor progressions in Quality Logic tests and some
PXL->PDF conversions are now larger. The reason is that we use the
font bounding box and a couple of glyphs are now considered to be
unclipped when in fact they are totally clipped out, but we can't tell.
This results in not only the glyphs but also a font being embedded
in the output and increasing the size slightly.

devices/vector/gdevpdte.c


2016-11-12 11:24:18 +0000
Ken Sharp <ken.sharp@artifex.com>
a46245139253b2ec607fcd06c549a6293d05a3a8

Fix a bug in device subclassing

If we free the memory used by a child device, we must not then try
to write to that memory.

Chanced upon while working on bug #697279

base/gdevdflt.c


2016-11-10 17:45:38 +0000
Ken Sharp <ken.sharp@artifex.com>
513d6fd7ddfc5a59fbf8bf6ce72eda6c97fea9f8

remove a bunch of now unused variables from the earlier shading code
commit.

base/gxshade1.c


2016-11-10 14:42:49 +0000
Ken Sharp <ken.sharp@artifex.com>
8a26fa67398970f357e1292310ef20556a8e5d96

Fix 'corner' radial gradient case.

Bug #697144 " Some incorrectly rendered radial shadings"

This is to address 'radialshade4.ps, but fixed (the customer had managed
to create incorrect PostScript for this specific test, see radialshade4b.ps).

In the case where the two circles defining a radial gradient are
tangential, and the larger circle has 'extend' set to true, the extended
area should be limited to the tangent which touches the two circles, and
the smaller circle should not be filled.

Getting this corre4ct with our existing method for drawing gradients
has been difficult. It 'looks like' all gradients are defined in terms
of tensor patches, rather than having a dedicated plotter for each
gradient type.

In order to generate a proper 'truncated' annulus for this case, it is
necessary to construct a number of different 'quadrilaterals' and fit
them carefully around the larger circle. To ensure no 'cracks' appear
between the quads, we must also take care to ensure that they join at
horizontal or vertical boundaries (in user space).

There's some trigonometry involved to get this correct, and to avoid
having to check for infinity returns from tan(alpha), and generally
avoid the complex work required in the general case, we handle the
cases where the tangent point of the circles is on a horizontal or
vertical axis.

This passes cluster tests, the customer test suite, and my own hand
created PostScript files which exercise the code rather more thoroughly

No differences expected.

base/gxshade1.c


2016-11-09 22:02:47 -0800
Ray Johnston <ray.johnston@artifex.com>
d4d8b7d51f79b47d21d3c82fe652a79e1f890df5

Fix bug 697323, Segfault after pattern with transparency.

While the pdfwrite device usage may have contributed to the path being
taken, the segfault was in the GC and was due to a pattern-clist device
still existing in the allocator, but no longer referenced (at least as
seen with a debug build. The fix was to set gx_device_retain false for
the adev (pattern accum device, which may be a pattern-clist device) for
the case where the pattern uses transparency so the freeing the saved
gstate would free the pdf14 device and it would rc_decrement its target,
thus freeing the accumulator device.

base/gxpcmap.c


2016-11-07 14:03:30 +0000
Chris Liddell <chris.liddell@artifex.com>
0e2523b9dae517f91bd7da78323e5207d099a10e

Fix expat build on Windows

The new version of expat uses time/date API calls to seed a hash function. That
means we need a extra CFLAG (/DWIN32) and to drop the /Za CFLAG as we do for
LCMS2.

base/expat.mak
psi/msvc.mak


2016-09-14 10:40:36 +0100
Chris Liddell <chris.liddell@artifex.com>
c9f7be4f4de8e98df9d34ff8e4a7f781c0a33899

Bring master up to date with 9.20 release branch

Docs, dates, copyrights etc.

Copyrights, dates etc

Update News and changelog

Fix a type in the release comments

Changelog update for 9.20 RC2

Update date and product string for 9.20 release

Copyrights, dates etc

base/gscdef.c
base/version.mak
doc/API.htm
doc/C-style.htm
doc/Commprod.htm
doc/DLL.htm
doc/Deprecated.htm
doc/Details8.htm
doc/Details9.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/Helpers.htm
doc/History1.htm
doc/History2.htm
doc/History3.htm
doc/History4.htm
doc/History5.htm
doc/History6.htm
doc/History7.htm
doc/History8.htm
doc/History9.htm
doc/Install.htm
doc/Issues.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.htm
doc/Projects.htm
doc/Ps-style.htm
doc/Ps2epsi.htm
doc/Psfiles.htm
doc/Readme.htm
doc/Release.htm
doc/SavedPages.htm
doc/Source.htm
doc/Unix-lpr.htm
doc/Use.htm
doc/VectorDevices.htm
doc/WhatIsGS.htm
doc/Xfonts.htm
doc/gs-vms.hlp
doc/sample_downscale_device.htm
doc/thirdparty.htm
man/dvipdf.1
man/font2c.1
man/gs.1
man/gslp.1
man/gsnd.1
man/pdf2dsc.1
man/pdf2ps.1
man/pf2afm.1
man/pfbtopfa.1
man/printafm.1
man/ps2ascii.1
man/ps2epsi.1
man/ps2pdf.1
man/ps2pdfwr.1
man/ps2ps.1
man/wftopfa.1
psi/msvc.mak


2016-11-04 13:18:21 +0000
Chris Liddell <chris.liddell@artifex.com>
21b582ca561214aa9c5b9c8987a1c0cdce43ace6

Add expat endian settings.

And fix the logic for the LCMS2 endian setting (noticed in passing).

configure.ac


2016-11-04 12:41:02 +0000
Chris Liddell <chris.liddell@artifex.com>
c99d0ad7d5f5187e5e0279b6f9c8092798badc2f

Bug 697181: allow xps build with shared expat.

Makefile.in
configure.ac


2016-11-04 12:13:08 +0000
Chris Liddell <chris.liddell@artifex.com>
00b5d81646bb936577cbea2476e13f0a5dd4b9f1

Update to expat 2.2.0

expat/CMake.README
expat/CMakeLists.txt
expat/COPYING
expat/Changes
expat/ConfigureChecks.cmake
expat/MANIFEST
expat/Makefile.in
expat/README
expat/aclocal.m4
expat/amiga/Makefile
expat/amiga/README.txt
expat/amiga/expat_68k.c
expat/amiga/expat_68k.h
expat/amiga/expat_68k_handler_stubs.c
expat/amiga/expat_base.h
expat/amiga/expat_lib.c
expat/amiga/expat_vectors.c
expat/amiga/launch.c
expat/amiga/stdlib.c
expat/bcb5/elements.bpr
expat/bcb5/expat.bpr
expat/bcb5/expat.mak
expat/bcb5/expat_static.bpr
expat/bcb5/expat_static.mak
expat/bcb5/expatw.bpr
expat/bcb5/expatw.mak
expat/bcb5/expatw_static.bpr
expat/bcb5/expatw_static.mak
expat/bcb5/outline.bpr
expat/bcb5/xmlwf.bpr
expat/bcb5/xmlwf.mak
expat/configure
expat/configure.ac
expat/configure.in
expat/conftools/PrintPath
expat/conftools/ac_c_bigendian_cross.m4
expat/conftools/config.guess
expat/conftools/config.sub
expat/conftools/expat.m4
expat/conftools/get-version.sh
expat/conftools/install-sh
expat/conftools/libtool.m4
expat/conftools/ltmain.sh
expat/conftools/mkinstalldirs
expat/doc/expat.png
expat/doc/reference.html
expat/doc/valid-xhtml10.png
expat/doc/xmlwf.1
expat/doc/xmlwf.sgml
expat/doc/xmlwf.xml
expat/examples/elements.c
expat/examples/elements.dsp
expat/examples/outline.c
expat/examples/outline.dsp
expat/expat.dsw
expat/expat.pc.in
expat/expat_config.h.cmake
expat/expat_config.h.in
expat/lib/amigaconfig.h
expat/lib/expat.dsp
expat/lib/expat.h
expat/lib/expat_external.h
expat/lib/expat_static.dsp
expat/lib/expatw.dsp
expat/lib/expatw_static.dsp
expat/lib/internal.h
expat/lib/libexpat.def
expat/lib/libexpatw.def
expat/lib/xmlparse.c
expat/lib/xmlrole.c
expat/lib/xmltok.c
expat/lib/xmltok.h
expat/lib/xmltok_impl.c
expat/m4/libtool.m4
expat/m4/ltoptions.m4
expat/m4/ltsugar.m4
expat/m4/ltversion.m4
expat/m4/lt~obsolete.m4
expat/tests/README.txt
expat/tests/benchmark/README.txt
expat/tests/benchmark/benchmark.dsp
expat/tests/chardata.c
expat/tests/minicheck.c
expat/tests/minicheck.h
expat/tests/runtests.c
expat/tests/xmltest.sh
expat/win32/README.txt
expat/win32/expat.iss
expat/xmlwf/codepage.c
expat/xmlwf/readfilemap.c
expat/xmlwf/unixfilemap.c
expat/xmlwf/xmlfile.c
expat/xmlwf/xmlwf.c
expat/xmlwf/xmlwf.dsp


2016-11-03 13:09:27 +0000
Chris Liddell <chris.liddell@artifex.com>
a73e3cf1ca91bbdb51d5a999a491e58fb9a7ce35

Bug 697286: handle GlyphDirectory as an array

For high level devices that need to copy CIDFonts, we need to establish the
highest CID in a given CIDFont. If the font has a GlyphDirectory dictionary
the only way to do so is to iterate through the keys to find the highest.

The code handling this ignored that the GlyphDirectory could be an array,
which confused the dictionary content iterator, and caused a segfault.

In the case of an array, set the high CID to the highest index available in the
array.

psi/zfcid.c


2016-11-02 16:19:02 +0000
Robin Watts <robin.watts@artifex.com>
dc62c90930512f4b571f68c9110022b234cbd411

Bug 697186: Tweak to previous JPEG fix.

Only clamp the DC coefficient. This shouldn't make a difference
in any real world cases, but is more correct.

jpeg/jidctint.c


2016-11-01 18:40:04 +0000
Robin Watts <robin.watts@artifex.com>
8dcec8cc076a0cf8350ca7a6ec1d3136812e2a24

Bug 697186: Workaround JPEG lib bug.

Commit fix for overflow. Awaiting response from IJG.

jpeg/jidctint.c


2016-10-26 16:35:38 +0100
Robin Watts <robin.watts@artifex.com>
1eebbfa373d295bdd2bad88aaef1edc368450568

Bug 697231: Introduce caching to use of clipping paths.

When we create a clipping device from a path, we copy over the
pointers to the rectangle list, and start searching them from
the start.

This means that if we perform an operation that causes lots of
calls to something with the same clipping path (like for instance
a stroke operation with a clipping path that calls down to a fill
path with a clipping path), then we will repeatedly search from
the top of the rectangle list.

This massively slows stuff down.

This commit introduces a 'cached' entry in the clipping path
that can be updated after a clipping device has been used to show
the last place in the list that was found. Subsequent creations
start searching from this point.

This gives us the desired locality of reference, and massively
speeds up the test file.

base/gxacpath.c
base/gxclip.c
base/gxcpath.c
base/gxcpath.h
base/gxfill.c
base/gzcpath.h


2016-10-26 12:14:48 +0100
Robin Watts <robin.watts@artifex.com>
71629c04758788b238d6ff3537d9708f430a4db7

Tweak to clip device nesting.

Any call through clip_call_fill_path will be safely nested
in terms of the clippers used. Reflect this in the
initialisation of the local device. This avoids an error given
with the next commit.

base/gxclip.c


2016-10-26 17:39:29 -0200
Till Kamppeter <till.kamppeter@gmail.com>
0726780b28920045ee6f344a34bc5e8565bc4ed5

"cups" output device: When creating PWG Raster output, always output the bitmap of the full page, ignoring any unprintable margins suggested by the PPD file.

cups/gdevcups.c


2016-10-26 08:37:46 +0100
Ken Sharp <ken.sharp@artifex.com>
f0b49c3cf4e0602627c4dc5b6ff910074d298398

set GX_DOWNSCALER_PARAMS_DEFAULTS to remaining JPEG devices

Michael's fix in commit 45268652fcddf2031f5edb592bc61e53d9ac4f5b
resolves the problem for jpeg, but didn't fix the jpeggray or jpegcmyk
devices, as shown by the all devices test.

I believe copying the same fix to the other devices should resolve those
too.

No differences expected.

devices/gdevjpeg.c


2016-10-25 15:34:10 -0700
Michael Vrhel <michael.vrhel@artifex.com>
45268652fcddf2031f5edb592bc61e53d9ac4f5b

Set GX_DOWNSCALER_PARAMS_DEFAULTS in jpeg

Fix for crash caused by division by zero

devices/gdevjpeg.c


2016-10-25 18:25:36 +0100
Robin Watts <robin.watts@artifex.com>
cb8022f3e15b761adf4bbc78621cf0699f69e21c

Fix SEGV caused by previous commit.

Running:

gs --debug

would cause a SEGV in gs_finit_push_systemdict due to
i_ctx_p being NULL.

psi/imain.c


2016-10-25 11:16:13 +0100
Chris Liddell <chris.liddell@artifex.com>
2f3679b53632c5b7b9e9a416311ae82f36645fc9

Bug 697220(2): Fix returning execstackoverflow

In one case of returning execstackoverflow from the main interpreter loop,
we'd set the interpreter's private count value of objects to execute, *before*
we try to push the ref array onto the stack. As a consequence the object
count was for the new array, but the top of the exec stack was still the
previous array. This meant when we sync'ed the interpreter loop's internal
state with the state in the interpreter context, the size of the top object
on the exec stack could be wrong, causing problems in the garbager - especially
if the length was too long.

To resolve, move the exec stack bounds check before the count gets set.

psi/interp.c


2016-10-25 11:10:54 +0100
Chris Liddell <chris.liddell@artifex.com>
3f09e7022e39412af98602cdfe22adfb34a7fa63

Bug 697220(1): Push systemdict onto dict stack before we cleanup.

As part of shutting down the Postscript interpreter, we run some Postscript
from the C code. We really don't want to stumble across random redefinitions
of operators (especially if the definitions trigger errors) at this point.

So, push systemdict onto the top of the dict stack before we start our cleanup.

Do it in C, to further ensure we don't trip over redefinitions in the Postscipt
world.

This *should* resolve the segfaults, but leaves a garbage collector error

psi/imain.c


2016-10-25 11:10:07 +0100
Chris Liddell <chris.liddell@artifex.com>
5d1ae930711d492d01110ef054c0add3c7615910

Fix BOBBIN undefined warnings.

base/bobbin.h


2016-10-23 00:58:23 +0100
Robin Watts <robin.watts@artifex.com>
3216c2b692fe5a4c87936819b2fe14d0963a347a

Bug 697144: Fix fix for previous radial shading fix.

This fixes the final case in page_create_color.ps

In some cases R_tensor_annulus can be called twice; avoid
flipping function_arg_shift back and forth.

base/gxshade1.c


2016-10-22 15:47:35 +0100
Robin Watts <robin.watts@artifex.com>
5915f971fa47c8ad1561e403bc7aacd86325c428

Bug 697144: Fix radial shadings broken by previous fix.

The previous fix addressed the fact that monotonicity of a
filled quad was being tested based on splitting on u rather
than v (or vice versa). It turns out that in some
circumstances (when circles are entirely nested), we reverse
u and v, and hence need to reverse the test.

The previous fix did not allow for this.

base/gxshade1.c


2016-10-21 17:00:15 +0100
Robin Watts <robin.watts@artifex.com>
898cdaedf52a37c84923d75aa2942e48b0fec91c

Bug 697144: Fix radialshade2.ps

Many many moons ago, a fix was committed for bug 690831. The
commit message for that was lost in the great svn -> git
migration, but the bug itself makes the history clear.

Looking back at this again now, it appears that the fix was
incorrect. Ghostscript was in fact doing the right thing by
the letter of the standard, but Acrobat was applying a fudge
factor.

When filling a radial shade, the code tests to see if the
two circles are nested. If so, then when the shade is 'extended',
the entire area outside the final circle is filled. If not,
a different fill operation has to happen.

The file given in the bug has a shade where the two circles are
very close to being nested, but are not strictly so. Acrobat is
choosing to treat them as if they were.

We therefore revert the code to 'unbreak' it, and adjust the
fudge factor in our code to give the same results as Acrobat does.

This causes no changes in the cluster tests.

base/gxshade1.c


2016-01-25 10:59:23 +0000
Chris Liddell <chris.liddell@artifex.com>
c3c4bf022a631be939ebb4bf6f59e41514cb1e48

Bug 696508: improve configure cross compile support

This is a squashing of the commits on the branch:

CCAUX-configure

This allows CCAUX and related settings to be set on the configure command
line, or in the environment.

Also, using configure to guess at creating an arch.h file which gets used
rather than genarch generating one. A couple of things in that file will
not be as accurate as using genarch, but those are rare, and almost
certainly for outdated systems (such as whether floats use IEEE
representation).

Better documentation to follow, but as an example, building for Android would
work with:

./configure --host=arm-linux-gnu --build=x86_64-linux-gnu \
CC=/opt/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc \
CFLAGS="--sysroot=/home/cliddell/bin/android-ndk-r10e/platforms/android-18/arch-arm -MMD -MP -MF -fpic \
-ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp \
-mfpu=vfpv3-d16 -mthumb -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Wa,--noexecstack" LDFLAGS=" \
--sysroot=/home/cliddell/bin/android-ndk-r10e/platforms/android-18/arch-arm -MMD -MP -MF -fpic -ffunction-sections \
-funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb \
-fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Wa,--noexecstack" CCAUX=gcc CFLAGSAUX=" "

.gitignore
Makefile.in
arch/arch_autoconf.h.in
base/gsroprun.c
base/unix-aux.mak
base/unix-end.mak
configure.ac
xps/xps.mak


2016-10-20 16:45:09 +0100
Robin Watts <robin.watts@artifex.com>
0845a1c90f7a22a5b50fddbf7809d985b98290cd

Bug 697144: Fix radialshade1.ps

When filling a radial shading, we form 4 tensor patches, one for
each quadrant. The points for these are represented as poles of
the tensor patches as p->poles[v][u].

One quadrant might look like (excuse the ascii art)

J I H G p->poles[0][0] = A p->poles[3][0] = J
F p->poles[0][1] = B p->poles[2][0] = K
K ED p->poles[0][2] = C p->poles[1][0] = L
p->poles[0][3] = D
C p->poles[1][3] = E (plus 4 more points
p->poles[2][3] = F internal to the
B p->poles[3][3] = G patch, not shown
p->poles[3][2] = H here)
L A p->poles[3][1] = I

Thus 'u' controls how far along the radius of the radial shading
we are, and 'v' controls how far 'around' the shading we are.

The shading code first subdivides the patch on v (using the
split_patch routine). This gives us a succession of slices running
from the centre of the radial fill to the outside (like slices of
pizza).

It then subdivides these slices (using split_slice) to give small
quadrangles to fill.

The code then checks to see whether these quadrangles need to be
further divided by checking to see whether the color change across
such quadrangles is monotonic or not. If it is, and the quadrangles
are 'not big' (for some definition of big) then it is considered
reasonable to fill them using a linear fill.

For simple radial fills, the color changes across 'u' not 'v'.
We thefore check for the color change in the given range to see
if it is monotonic, and if it not, we divide the patch.

As part of the work for bug 689189 (see commit 36375961a02091)
Igor had identified some uses of the radial fill code where the
tensor patches are constructed such that the color varies across
'v' rather than 'u', and had therefore amended the code so allow
for this.

Unfortunately the setup for this appears to have got it wrong
for the normal radial case. Fixing that here solves the problem.

base/gxshade1.c
base/gxshade6.c


2016-10-20 11:45:54 -0700
Michael Vrhel <michael.vrhel@artifex.com>
cca05810721874cabcc377615cac050bd775ed37

Add -dNoSeparationFiles to tiffsep device

If -dNoSeparationFiles is specified when using the tiffsep
device, only the composite file will be created, no
separations are created in this case.

devices/gdevtsep.c
doc/Devices.htm


2016-10-17 16:34:14 +0100
Chris Liddell <chris.liddell@artifex.com>
6d1822faa68c17b945aea2713985b7095ca424aa

ASAN segfault: add missing pointer to pclxl_image_enum_t gc info

The pclxl_image_enum_t stores a pointer to an icclink which is allocated in gc
memory, so the garbager needs to know about that.

devices/vector/gdevpx.c


2016-10-17 15:14:54 +0100
Chris Liddell <chris.liddell@artifex.com>
e6460567fcec3b4c96dd4912e556e3b846adaef2

Refine SAFER file access permissions

SAFER (amongst other things) is to stop arbitrary file accesses on the host
system (in Postscript terms '%os%....') but it should not limit access to
other Postscript devices (most importantly '%rom%').

psi/zfile.c


2016-10-17 16:21:30 -0700
Michael Vrhel <michael.vrhel@artifex.com>
ed425fcd620837bf63a18a3ee2a2202fa91b1207

Add -sPostRenderICCProfile support to tiffsep

Customer would like to have this capability.

devices/devs.mak
devices/gdevtsep.c


2016-10-17 20:10:46 +0100
Robin Watts <robin.watts@artifex.com>
937efa62c23c2c79c7487895421041896e8c14b7

Fix previous JPEG commit.

The previous commit did not even compile. I have no idea how
I managed to get that to pass the tests I ran!

Apologies.

devices/gdevjpeg.c


2016-10-17 18:11:08 +0100
Robin Watts <robin.watts@artifex.com>
6f14fb471faedbe9657d32743dba609ddd3a0465

Add Downscaler functionality to jpeg devices.

devices/gdevjpeg.c
doc/Devices.htm


2016-10-12 14:15:50 +0100
Robin Watts <robin.watts@artifex.com>
910f459d535cec757b8e5f541dd39be6fa2fb0c9

Bug 697012: Fix buffer overflow in gxps.

Port back same fix already applied to muxps.

xps/xpsglyphs.c


2016-10-17 10:03:53 +0100
Robin Watts <robin.watts@artifex.com>
9388ecefe9d8659d8434aa78d07a1fa247c8ea4e

Rework openjpeg subsampled decode.

The current code performs the yuv -> rgb step on the data
within openjpegs buffers. Unfortunately, this means that
subsampled data is "expanded" into rgb, converted, and then
redecimated. The R plane stays intact, and the G and the B
are degraded. The code is then desubsampled again when copying
out into the stream, but the damage has been done.

This gives awful results.

Instead here, we simplify the code to decode a row at a time
into a row buffer. We then convert that row buffer to rgb, and
copy that out. We never redecimate the output.

This looks much better.

base/sjpx_openjpeg.c
base/sjpx_openjpeg.h


2016-10-16 11:36:34 +0100
Chris Liddell <chris.liddell@artifex.com>
08b3f4a91fc65f36da13dfb02a1273c70638c6af

Bug 697217(4): deal with negative index in context ops

In this case the join operator was being passed a negative index.

psi/zcontext.c


2016-10-16 11:30:36 +0100
Chris Liddell <chris.liddell@artifex.com>
a7a8b148c368d313f913c23a754e14394d6fb5a1

Bug 697217(3): guard against stack underflow in debug info dump

In the event of an error exit, we dump out the contents of the stacks.

*But* in the event of an error, we can already be into the "guard" entries
below the bottom of the normal operand stack - so protect against that
when dumping out the stack.

psi/idebug.c


2016-10-16 13:11:46 +0100
Chris Liddell <chris.liddell@artifex.com>
86ea41068f8ee8930aa169ad3a106db4f7d6c7db

Bug 697217(2): cleanup exec stack on currentcolor* error

If an error occurs when retrieving currentcolor values, we have to clean up
the exec stack before returning the error.

psi/zcolor.c


2016-10-16 11:18:43 +0100
Chris Liddell <chris.liddell@artifex.com>
060cfdc002d29158d9d7f6c5fb15f187c165d408

Bug 697217(1): Match signs when checking lengths in binary sequences

psi/iscanbin.c


2016-10-14 15:50:30 +0100
Chris Liddell <chris.liddell@artifex.com>
1f6581f9b77868b56a2f6269f3d1440c9eaad8b0

Bug 692721: remove SMask specific stuff from form dict

When we get an SMask group, we have to store the graphics state and the contents
of the ExtGState, and reset all that before we execute the content stream
for the group XObject. So it all gets setup in the correct place, that
information needs to be added to the group's form dictionary.

It turns out we also need to *remove* these entries from the group's form
dictionary, in case it gets reused as a normal for XObject.

The gstate and extended gstate values remain in the SMask parameter dictionary,
so any reuse of the SMask will still work correctly.

Resource/Init/pdf_draw.ps


2016-10-14 08:38:29 +0100
Ken Sharp <ken.sharp@artifex.com>
3bf51ac09d8759761057bbf1817434415616258e

pdfwrite - fix SMask handling, when painting with a Pattern

Bug #697212 "Error in SMask during ExtGState"

The title is misleading, the error occurs with a Pattern, but there must
be an SMask preceding it. This appears to have been a very long-standing
problem in the code, but it was hidden by ignoring an error return code.
Fixing Coverity reports meant that the return code was actioned, and that
is what revealed the problem.

When we start a new substream to capture a Pattern PaintProc we need to
reset the 'soft_mask_id' (the ID assigned to the SMask pdfwrite has
created) in the graphics state. If we don't do that then the code (in
effect) tries to handle the SMask twice, once for the correct stream
and once for the pattern PaintProc stream, and this results in the
stack of pdfwrite internal gstate copies becoming unsynchronised, as well
as creating a PDF file with unbalanced q/Q operators.

Ignoring the return code had masked this problem.

No differences expected.

devices/vector/gdevpdfi.c


2016-10-13 16:47:47 -0700
Michael Vrhel <michael.vrhel@artifex.com>
84fec37351ebd502c70ac16347fae4b1b5f5cbe6

Fix for Bug 695154

The pngalpha device should really have its separable_and_linear setting
set to GX_CINFO_UNKNOWN_SEP_LIN. In this case, the device will get its shifting
and mask color info settings set up and in this case the gradient
code will actually work in the manner to which it is designed.

devices/gdevpng.c


2016-10-12 11:02:09 -0700
Michael Vrhel <michael.vrhel@artifex.com>
06add83a38437ccd2e7f0f1deb5e2d7bc7a8546d

Bug 695340. Avoid NULL dereferences

base/gsptype1.c


2016-10-09 08:22:03 -0700
Michael Vrhel <michael.vrhel@artifex.com>
6d5b4ffeb00f50faf45b72191d38dea422f28405

Bug 694189 catch NULL of pinst

If an error occurs and we dig through the saved
gstates to find the pattern but come up empty
then return an error

psi/zpcolor.c


2016-10-11 11:16:59 -0700
Ray Johnston <ray.johnston@artifex.com>
62e787ce74c5c22aaba9377a709bc06217bd46f8

Fix Bug 696866: patterns need to set color_usage.or over the entire area

Thanks to Michael Vrhel for the simplified file and suggesting the cause of
the problem.

base/gxclpath.c


2016-10-11 16:07:40 +0100
Chris Liddell <chris.liddell@artifex.com>
a48d5240229d2a5cf9413ff2a425c40e2db03b8e

xpswrite: Add color space to enumerated pointers

In the xps_image_enum_s the pointer to the color space (pcs) was not
declared to the garbage collector, so could end up moving with the
object being updated.

Caused a segfault spotted in the weekly regression test (for EPSCrop, but
that's not relevant)

devices/vector/gdevxps.c


2016-10-10 14:03:51 -0700
Ray Johnston <ray.johnston@artifex.com>
a34f71c530409a559c4cb35cb1a23296541d53c3

Fix Bug 696864: Use Default colorspaces when processing SMask

This is done by saving the OverrideICC user parameter before setting the
colorspace, etc. so as to ignore the ICC profile, which may have a gamma
that we don't expect, and restore it after the SMask has been rendered.
Note this file rendered correctly with -dOverrideICC on the command line,
but this patch automatically applies that during execmaskgroup.

Thanks to Michael Vrhel for identifying the problem and coming up with a
simplified test case.

Resource/Init/pdf_draw.ps


2016-10-08 17:27:34 +0100
Chris Liddell <chris.liddell@artifex.com>
a87e380acd5e326f7d4e4380348bac393fac3058

Remove the appledmp, iwlo, iwhi, iwlq devices

base/unix-gcc.mak
configure.ac
devices/contrib.mak
devices/gdevadmp.c
doc/Develop.htm
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2016-10-07 15:52:42 +0100
Chris Liddell <chris.liddell@artifex.com>
ad13de0b7a11675f34a29a03d1597a780da54851

Update docs to reflect removal mswindll device

doc/DLL.htm


2016-10-07 15:38:14 +0100
Chris Liddell <chris.liddell@artifex.com>
e0f5118c432d4f17d8038871691517d84ce01918

Remove the os2prn device

base/pcwin.mak
devices/devs.mak
devices/gdevos2p.c
doc/Develop.htm
psi/os2.mak
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2016-10-07 15:31:06 +0100
Chris Liddell <chris.liddell@artifex.com>
5be37082980552a9d8a21b70a7ee93fbf4320e8f

Remove the mswindll and mswin devices

As well as the (long non-functional/non-useful) Windows "xfont" code.

base/pcwin.mak
devices/devs.mak
devices/gdevmswn.c
devices/gdevmswn.h
devices/gdevmsxf.c
devices/gdevwddb.c
devices/gdevwdib.c
devices/gdevwprn.c
doc/DLL.htm
doc/Develop.htm
psi/gsdll32.def
psi/gsdll32metro.def
psi/gsdll32w.lnk
psi/gsdll64.def
psi/gsdll64metro.def
psi/gsdllARM32metro.def
psi/msvc.mak
toolbin/pre.chk
toolbin/tests/check_comments.py
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2016-10-07 15:07:17 +0100
Chris Liddell <chris.liddell@artifex.com>
ff59e2a9f86a4476aa67b5e768811fe43b0b4f0c

Remove the macos device

devices/gdevmac.c
devices/gdevmac.h
devices/gdevmacpictop.h
devices/gdevmacttf.h
doc/Develop.htm
toolbin/tests/check_comments.py
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2016-10-07 15:01:26 +0100
Chris Liddell <chris.liddell@artifex.com>
6c0d6e66d219006acfa3201963a0a7123dce3cc9

Remove sgirgb device

base/unix-gcc.mak
configure.ac
devices/contrib.mak
devices/gdevsgi.c
devices/gdevsgi.h
doc/Develop.htm
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2016-10-06 15:05:23 +0100
Chris Liddell <chris.liddell@artifex.com>
fa981020ef9f96cb2d4d92bd48da81b025bc267a

Remove the various "vga" devices

devices/devs.mak
devices/gdevevga.c
devices/gdevpcfb.c
devices/gdevpcfb.h
devices/gdevs3ga.c
devices/gdevsco.c
devices/gdevsvga.h
doc/Develop.htm
toolbin/pre.chk
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2016-10-06 14:52:09 +0100
Chris Liddell <chris.liddell@artifex.com>
3488db574bf6d7291f51180395da9aa7fd6816cc

Remove svga device(s)

devices/devs.mak
devices/gdevsvga.c
doc/Develop.htm
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2016-10-06 14:40:14 +0100
Chris Liddell <chris.liddell@artifex.com>
323a1cb0e1fbd96bed87f818874f51543b286949

Remove the sunview device

devices/contrib.mak
devices/gdevsun.c
doc/Develop.htm
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2016-10-06 14:37:29 +0100
Chris Liddell <chris.liddell@artifex.com>
74aa1c0b1f71f59f866c800bd698712cdb5c9405

Remove the sunhmono device

base/unix-gcc.mak
configure.ac
devices/contrib.mak
devices/gdevsunr.c
doc/Develop.htm
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2016-10-06 14:32:43 +0100
Chris Liddell <chris.liddell@artifex.com>
4010f1e52592197537e1af639fe3228b8b5fc727

Remove sparc (printer) device

devices/contrib.mak
doc/Develop.htm
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2016-10-06 14:28:52 +0100
Chris Liddell <chris.liddell@artifex.com>
5c6b4d035b6c8c3466e77bc4a581732659d3687e

Remove the att3b1 device

configure.ac
devices/contrib.mak
devices/gdev3b1.c
doc/Develop.htm
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2016-10-06 14:25:38 +0100
Chris Liddell <chris.liddell@artifex.com>
6e98f2159d615b4bedd6e5d83c95a511d4f9ea6f

Remove the herc device

devices/contrib.mak
devices/gdevherc.c
doc/Develop.htm
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2016-10-06 14:16:48 +0100
Chris Liddell <chris.liddell@artifex.com>
8901d9044df836f9ee8988f1ce9f6bbebbc6c314

Remove lvga256 device

devices/devs.mak
devices/gdevl256.c
doc/Develop.htm
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2016-10-06 14:09:30 +0100
Chris Liddell <chris.liddell@artifex.com>
a6b63be35e0278b4018863cf9b197e90686cc374

Remove the s3ga device

devices/devs.mak
doc/Develop.htm
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2016-10-06 14:04:23 +0100
Chris Liddell <chris.liddell@artifex.com>
461b6c19ab09b19ac436b6ccba234f36ad70c197

Remove vgalib device

devices/devs.mak
devices/gdevvglb.c
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2016-10-06 13:47:19 +0100
Chris Liddell <chris.liddell@artifex.com>
f659ff57a2e3fa011255569dcdf54cc825aaa9af

Remove omni device

Makefile.in
configure.ac
contrib/contrib.mak
contrib/defs.h
contrib/gomni.c
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2016-10-06 13:43:59 +0100
Chris Liddell <chris.liddell@artifex.com>
ec346cc09daada7c16e7213be154e86f644c6d04

Remove mag16 and mag256 devices

configure.ac
contrib/contrib.mak
contrib/japanese/gdevmag.c
psi/msvc.mak


2016-10-06 13:05:56 +0100
Chris Liddell <chris.liddell@artifex.com>
c0448269dd1928b2aff0307ed1206118f329af14

Remove the moribund Mac Classic specific files.

base/gp_mac.c
base/gp_mac.h
base/gp_macio.c
base/gp_macpoll.c
base/macos-mcp.mak


2016-10-10 09:45:44 +0100
Chris Liddell <chris.liddell@artifex.com>
ed539f1b8d29b2f03cd22ac2d54ee9036000d565

Remove doc sections about making SAFER the default

man/gs.1


2016-10-10 09:40:31 +0100
Ken Sharp <ken.sharp@artifex.com>
7119a01ae110a4c81b002f86464e684259626b30

Remove from the documentation the stated intention to make -dSAFER the
default.

doc/Use.htm


2016-10-10 08:45:46 +0100
Ken Sharp <ken.sharp@artifex.com>
9572484beac8fda920cbca3f6c6d09a5dc424825

Fix pdfmark argument validation

This doesn't fit neatly into any category, its a PostScript 'operator'
but it is only implemented for the pdfwrite device...

The pdfmark operator takes a mark, a series of arguments and a name
object. Zero argument sis valid, but the absence of a name object is
not. We weren't checking for the absence of a name object, or
validating its type.

No differences expected.

Resource/Init/gs_pdfwr.ps


2016-10-10 08:09:15 +0100
Ken Sharp <ken.sharp@artifex.com>
ec6ba697311d2424189583f8fc26d373a584a4ce

Coverity ID 137703 - remove some dead code

devices/vector/gdevpdfe.c


2016-10-08 16:35:39 +0100
Chris Liddell <chris.liddell@artifex.com>
b60d50b7567369ad856cebe1efb6cd7dd2284219

Bug 697193: status operator honour SAFER option

psi/zfile.c


2016-10-08 16:18:25 +0100
Chris Liddell <chris.liddell@artifex.com>
4ea759bbd40746410fb2beb82e3ba9ebb6788107

Bug 697204: fully init lock object

The scheduler field (which is relocatable) was not being initialisedm causing a
segfault in teh garbage collector

psi/zcontext.c


2016-10-08 16:10:27 +0100
Chris Liddell <chris.liddell@artifex.com>
f5c7555c30393e64ec1f5ab0dfae5b55b3b3fc78

Bug 697203: check for sufficient params in .sethalftone5

and param types

psi/zht2.c


2016-10-08 16:01:12 +0100
Chris Liddell <chris.liddell@artifex.com>
a5360401495654e89301b2516703c1d2877fc5ba

Check for NULL return from memory allocation

base/gxipixel.c


2016-10-05 09:36:33 -0700
Michael Vrhel <michael.vrhel@artifex.com>
f3de2191afc0d8fcf0285736d2d25fa6071a7981

Bug 696860 remove memcmp of structs in gscrdp.c

base/gscie.c
base/gscie.h
base/gscrdp.c


2016-10-05 09:59:25 +0100
Chris Liddell <chris.liddell@artifex.com>
6f749c0c44e7b9e09737b9f29edf29925a34f0cf

Bug 697179: Reference count device icc profile

when copying a device

base/gsdevice.c


2016-10-05 09:55:55 +0100
Chris Liddell <chris.liddell@artifex.com>
6d444c273da5499a4cd72f21cb6d4c9a5256807d

Bug 697178: Add a file permissions callback

For the rare occasions when the graphics library directly opens a file
(currently for reading), this allows us to apply any restrictions on
file access normally applied in the interpteter.

base/gsicc_manage.c
base/gslibctx.c
base/gslibctx.h
psi/imain.c
psi/int.mak
psi/zfile.c
psi/zfile.h


2016-10-03 01:46:28 +0100
Chris Liddell <chris.liddell@artifex.com>
8abd22010eb4db0fb1b10e430d5f5d83e015ef70

Bug 697169: Be rigorous with SAFER permissions

Once we've opened our input file from the command line, enforce the SAFER
rules.

psi/zfile.c


2016-07-19 08:43:35 +0100
Chris Liddell <chris.liddell@artifex.com>
d609a3d4c1b8583d1c22db6b4d3bce4b239cf88c

Use ToUnicode for substituted CIDFonts

When we substitute a CIDFont in a PDF file with a TTF from disk, use the
ToUnicode CMap (if available) to extract Unicode values. In a lot of case, this
gets a more accurate character code to glyph mapping than the previous reliance
on the low level glyph ordering from the TTF.

This also meant being more robust for broken ToUnicode CMap. Also, an additional
option (-dIgnoreToUnicode) to skip parsing of the ToUnicode CMap - for cases
where a correctly formed ToUnicode is semantically wrong.

Resource/Init/pdf_font.ps
base/gstext.c
base/gxfapi.c
base/gxfapi.h
pcl/pl/plfapi.c
psi/zfapi.c


2016-10-05 08:32:39 -0700
Michael Vrhel <michael.vrhel@artifex.com>
3089131dc90ec008ff540d41df0f1a9fbc2dd47b

Bug 696859 memcmp of struct removal in gscrd.c

base/gscrd.c


2016-10-05 13:15:23 +0100
Ken Sharp <ken.sharp@artifex.com>
799531ffc1240933786cd2121add9d7e3cba778e

Coverity ID 137283 - pdfwrite - remove some redundant code

I had left some code that catered for a UTF16 surrogate pair promoted to
UTF32, converting the result to UTF8. But I didn't implement the UTF32
promotion, leaving it as a potential future enhancement.

However, Coverity whinges about the test always being true, so here
just remove the code. Its trivial enough to add in if we ever need it.

devices/vector/gdevpdfe.c


2016-10-05 10:10:58 +0100
Ken Sharp <ken.sharp@artifex.com>
875a0095f37626a721c7ff57d606a0f95af03913

DSC parser - validate parameters

Bug #697190 ".initialize_dsc_parser doesn't validate the parameter is a dict type before using it."

Regardless of any security implications, its simply wrong for a PostScript
operator not to validate its parameter(s).

No differences expected.

psi/zdscpars.c


2016-10-05 09:41:18 +0100
Ken Sharp <ken.sharp@artifex.com>
aef8f6cfbff9080e4b9c54053bc909875c09a2be

Prevent dereference of NULL device method

Bug #697189 ".gethardwareparams crashes with any special device"

Another NULL device method problem. As noted previously, the original
design intended that device methods should never be NULL, but this
has been ignored over the years leading to the current mess of some
methods being NULL accidentally, some being NULL deliberately and
having different effects when NULL, and some methods never being NULL.

While I do still intend to try and rectify this one day, in the meantime
add a check to make sure the method is not NULL before trying to
execute it in this case.

No differences expected

base/gsdparam.c


2016-10-04 16:24:13 -0700
Michael Vrhel <michael.vrhel@artifex.com>
36a2c94c4ebea8aa1c9cb2ca98e124a5b363000e

Fix misplace parenthesis and missing const

base/gdevdevn.c
base/gscie.c


2016-10-04 15:54:56 -0700
Michael Vrhel <michael.vrhel@artifex.com>
e4ab4499f9f33c51cdb95020c99cf0f4f1e6ee77

Bug 696858 remove memcmp struct in gscie.c

base/gscie.c


2016-10-04 14:39:54 -0700
Michael Vrhel <michael.vrhel@artifex.com>
2e9a339b766fb7a4d791c5ba1d85bdd24e6dbbaa

Bug 696854 remove memcmp of structs in gdevdevn.c

base/gdevdevn.c


2016-10-04 12:04:03 -0700
Michael Vrhel <michael.vrhel@artifex.com>
4fd414107c5b36419896a9c46956cb254adf201f

Bug 696862 remove memcmp() color info structure

base/gsdevice.c
base/gxclpage.c
base/gxdevcli.h
base/gximage2.c


2016-10-03 16:21:49 +0100
Ken Sharp <ken.sharp@artifex.com>
a8642064fe21752b00e28d05483baca029fe0891

pdfwrite - fix ToUnicode CMap sequence consolidation

Bug #697176 "ToUnicode CMap generation broken in 9.20"

The reworking to handle the current version of ToUnicode CMap missed
a case where the size of a code pair had changed. This led to a loop
comparing incorrect values, instead of comparing two consecutive
values, it compared a value with one much earlier.

In general this led to a loss of efficient, causing us to emit two or
more entries when it was possible to emit a single range. However in the
rare case when the comparison happened to compare two values that were
consecutive, but shouldn't have been, this led to us writing an incorrect
ToUnicode CMap.

No differences expected.

base/gsfcmap.c


2016-09-29 21:57:20 +0100
Ken Sharp <ken.sharp@artifex.com>
309edf631cf1160087ede69384f502aa1d64006c

pdfwrite - Fix handling of Separation /All alternate space conversion

Bug #697118 "Separation colorspace is not converted correctly by pdfwrite"

The /All Separation space wasn't getting the components of the tint
transform colour space correctly set. For rendering we never need to
do that, and simply set the relevant component of the Separation
(or DeviceN) space to be the tint value.

This commit forces the CMS to run the tint transform when we need to
create a new, different, alternate for the Separation space.

No differences expected.

devices/vector/gdevpdfg.c


2016-09-29 19:22:10 +0100
Ken Sharp <ken.sharp@artifex.com>
727aeab76c39026722e3e492a30ae2f7c218c1ec

Fix UTF16 surrogate pair detection

Flagged by clang, the use of a short would fail to detect surrogate
pairs, this shuold be an unsigned short.

Bizarrely this worked as expected on Windows, I have no idea how.

devices/vector/gdevpdfe.c


2016-09-29 17:35:05 +0100
Ken Sharp <ken.sharp@artifex.com>
273a133110838ee5702e7eb6409a853c598211b2

Remove (and re-implement) ConvertUTF.c

Bug #697122 " embedded ConvertUTF.c is buggy and licensed incompatibly with GPL/APGL"

Its not clear that this code is incompatible with GPL, nor do we think
any 'bugginess' in the code affects us, since we are using a comparatively
small part of the included code.

Nevertheless its possible to remove the code, and re-implement the small
part we actually need, and that is done here.

Also removed the DSCEncodingToUnicode option which was insanely difficult
to use, and incorrectly documented.

Yhis shows one difference, 692486_-_heap_overflow_in_pdf_to_ucs2.pdf
now correctly throws an error, because the PDF file contains document
information (Application) which has an invalid UTF16-BE sequence.

base/ConvertUTF.c
base/ConvertUTF.h
base/lib.mak
devices/devs.mak
devices/vector/gdevpdf.c
devices/vector/gdevpdfb.h
devices/vector/gdevpdfe.c
devices/vector/gdevpdfp.c
devices/vector/gdevpdfx.h
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2016-09-27 17:07:02 +0100
Robin Watts <robin.watts@artifex.com>
27e01aa77d0cf1668f60d87cf7417c90bf309d1b

Squash 2 warnings in the openjpeg code.

openjpeg/src/lib/openjp2/j2k.c
openjpeg/src/lib/openjp2/thread.c


2016-09-27 16:08:57 +0100
Robin Watts <robin.watts@artifex.com>
9a78bfb8698061e22e3d460b8c15825992e44def

Import new OpenJPEG version.

Squashed version of openjpeg-update-20160927

This squashes the following commits:

* Import new OpenJPEG version.

From https://github.com/uclouvain/openjpeg

Final commit is:

commit 34dae137a9a8c04feaa9763ae7e09a86ecb10400
Author: Mathieu Malaterre <mathieu.malaterre@gmail.com>
Date: Mon Sep 26 12:01:31 2016 +0200

OPENJPEG_NAMESPACE is configurable by user

* Zap the OpenJPEG stuff we don't need

* Add predefined openjpeg headers.

* Import patches from Sumatra's tree.

* Update Makefiles for new openjpeg

* Update MSVC for new files

* OpenJPEG allocation fixes.

The old version of openjpeg allocates using malloc/free.

The new version of openjpeg allocates via opj_malloc (and co).

We can capture these and pass them down to our own allocators,
but we cannot get openjpeg to pass us a gs_memory_t * to use.

We therefore resort to using a static to hold 'the current
gs_memory_t *' before we call openjpeg. To keep this threadsafe
we add some private data to the gslibctx, which the openjpeg
implementation can use to hold a lock.

We add calls to both jpx decode implementations to init this
private data (where the luratech implementation is null).

base/gslibctx.c
base/gslibctx.h
base/openjpeg.mak
base/sjpx_luratech.c
base/sjpx_openjpeg.c
openjpeg/AUTHORS
openjpeg/AUTHORS.md
openjpeg/CHANGELOG.md
openjpeg/CHANGES
openjpeg/NEWS
openjpeg/NEWS.md
openjpeg/THANKS
openjpeg/THANKS.md
openjpeg/src/lib/openjp2/CMakeLists.txt
openjpeg/src/lib/openjp2/bio.c
openjpeg/src/lib/openjp2/cidx_manager.c
openjpeg/src/lib/openjp2/cio.c
openjpeg/src/lib/openjp2/cio.h
openjpeg/src/lib/openjp2/dwt.c
openjpeg/src/lib/openjp2/dwt.h
openjpeg/src/lib/openjp2/event.h
openjpeg/src/lib/openjp2/function_list.c
openjpeg/src/lib/openjp2/function_list.h
openjpeg/src/lib/openjp2/image.c
openjpeg/src/lib/openjp2/indexbox_manager.h
openjpeg/src/lib/openjp2/invert.c
openjpeg/src/lib/openjp2/j2k.c
openjpeg/src/lib/openjp2/j2k.h
openjpeg/src/lib/openjp2/jp2.c
openjpeg/src/lib/openjp2/jp2.h
openjpeg/src/lib/openjp2/libopenjp2.pc.cmake.in
openjpeg/src/lib/openjp2/mct.c
openjpeg/src/lib/openjp2/mct.h
openjpeg/src/lib/openjp2/mqc.c
openjpeg/src/lib/openjp2/mqc.h
openjpeg/src/lib/openjp2/mqc_inl.h
openjpeg/src/lib/openjp2/openjpeg.c
openjpeg/src/lib/openjp2/openjpeg.h
openjpeg/src/lib/openjp2/opj_clock.c
openjpeg/src/lib/openjp2/opj_codec.h
openjpeg/src/lib/openjp2/opj_config.h.cmake.in
openjpeg/src/lib/openjp2/opj_config_private.h.cmake.in
openjpeg/src/lib/openjp2/opj_includes.h
openjpeg/src/lib/openjp2/opj_intmath.h
openjpeg/src/lib/openjp2/opj_malloc.c
openjpeg/src/lib/openjp2/opj_malloc.h
openjpeg/src/lib/openjp2/phix_manager.c
openjpeg/src/lib/openjp2/pi.c
openjpeg/src/lib/openjp2/pi.h
openjpeg/src/lib/openjp2/ppix_manager.c
openjpeg/src/lib/openjp2/raw.c
openjpeg/src/lib/openjp2/t1.c
openjpeg/src/lib/openjp2/t1.h
openjpeg/src/lib/openjp2/t1_generate_luts.c
openjpeg/src/lib/openjp2/t1_luts.h
openjpeg/src/lib/openjp2/t2.c
openjpeg/src/lib/openjp2/t2.h
openjpeg/src/lib/openjp2/tcd.c
openjpeg/src/lib/openjp2/tcd.h
openjpeg/src/lib/openjp2/tgt.c
openjpeg/src/lib/openjp2/tgt.h
openjpeg/src/lib/openjp2/thix_manager.c
openjpeg/src/lib/openjp2/thread.c
openjpeg/src/lib/openjp2/thread.h
openjpeg/src/lib/openjp2/tls_keys.h
windows/ghostscript.vcproj


2016-09-27 11:22:18 +0100
Chris Liddell <chris.liddell@artifex.com>
b4cc6d28e9a456a34a7348d98ff78ada9da727bb

Add pre-processor define for shared OpenJPEG

Makefile.in


2016-09-23 17:17:19 -0300
Till Kamppeter <till.kamppeter@gmail.com>
9e00367c3f598dc5e7b80d492e2b2d7321015fb3

pxlcolor/pxlmono output devices: Make MediaPosition, ManualFeed, and MediaType work

In the pxlcolor and pxlmono output devices (for PCL-XL printers) the
support for the attributes MediaPosition, ManualFeed, and MediaType
got broken when ESP Ghostscript got merged into GPL Ghostscript (Bug

devices/vector/gdevpx.c


2016-09-22 09:21:18 +0100
Chris Liddell <chris.liddell@artifex.com>
c1a79c6ab5ffadde8e296cd3e0b9e52a87c4ef66

Bug 697087: Apply PDF TTF rules when loading from disk

When we substitute a TTF from disk for a (non-embedded) TTF in a PDF, apply the
same rules (if possible) as when reading a TTF embedded in a PDF. So, selection
of cmap table, font encoding, whether or not to draw the notdef etc.

This applies *only* to fonts, *not* to CIDFonts.

Resource/Init/gs_ttf.ps
Resource/Init/pdf_font.ps


2016-09-22 15:24:45 +0100
Robin Watts <robin.watts@artifex.com>
abffa3e76c3e33b683333be329b39efaf762eca7

Remove Android logging code.

Bow to protestations from my colleagues and move code into
the caller. Probably nicer. If anyone ever needs the code they
can grab it from git.

Revert "Tweak android logging code logic."
This reverts commit 4d08bfd98b5fcd7cd4c2bd5faf72ac9615354ee3.

Revert "Add android logging code."
This reverts commit 2c52876b77d348866941fb85f6d0349a51df0455.

psi/iapi.c


2016-09-21 16:22:48 +0100
Robin Watts <Robin.Watts@artifex.com>
4d08bfd98b5fcd7cd4c2bd5faf72ac9615354ee3

Tweak android logging code logic.

It seems we don't set NDEBUG in release builds for android.
Revert to #ifdef DEBUG rather than #ifndef NDEBUG as a guard.

psi/iapi.c


2016-09-21 12:01:47 +0100
Robin Watts <robin.watts@artifex.com>
2c52876b77d348866941fb85f6d0349a51df0455

Add android logging code.

Update stdio redirection so that stdout and stderr go to
Android.log in DEBUG builds.

psi/iapi.c


2016-09-20 18:07:51 +0100
Chris Liddell <chris.liddell@artifex.com>
1bd7f32d70549971b4a384c5865e1fd030f49f20

Bug 697138: Fix --disable-sse2 to work with openjpeg

OpenJPEG enables it's SSE code based on the compiler defining __SSE__ so we
want to undefine that if we're not using SSE operations.

Makefile.in
configure.ac


2016-09-20 19:57:14 +0100
Robin Watts <robin.watts@artifex.com>
20b0255206254ebcce1cde0a4a63d74b0aedcecf

Fix splay tree traversal (again)

When setting up a traversal from a midpoint of the tree, we'd
immediately trip into the "has hit the endpoint" code.

Fix that.

base/gsalloc.c


2016-09-20 09:03:31 -0700
Ray Johnston <ray.johnston@artifex.com>
0e1153bf2d344044cd9fdfb7706f829b63348118

FitPage should not add in rotation if destination page is square.

If the PageSize was square, it would be treated as "not landscape",
but landscape pages in would be arbitrarily rotated.

Note this does not change the bahavior of PS or EPS page fitting.
TBD: Add an option to fit to a page and never rotate (FitPageNR)

Resource/Init/pdf_main.ps


2016-09-20 16:48:45 +0100
Robin Watts <robin.watts@artifex.com>
570041cc341557da8521fdace380f837cc572a69

Fix Memento crash

When reallocing set the rawsize before attempting to write
the post guard block.

base/memento.c


2016-09-20 13:41:31 +0100
Robin Watts <robin.watts@artifex.com>
3dd5f4c6b02179422bd8686fceed1f4955221d90

Sync Memento with MuPDF.

base/memento.c
base/memento.h


2016-09-20 13:04:51 +0100
Robin Watts <robin.watts@artifex.com>
4e01c57e0f0773e29bc6f921cfc677576e72739d

Bug 697134: Tweak MEMENTO_GS_HACKS inclusion.

Rather than rolling our own memset prototype in this case, use
the one that gs provides.

base/memento.c


2016-09-16 15:23:32 +0100
Chris Liddell <chris.liddell@artifex.com>
1a0104084a4dfdff77165d931bdc87849c8ad824

Clump has_refs - follow up to commit 63f74ce6

The function save_set_new() (where the original fix for 'has_refs' is located)
is called in two circumstances: when creating a save level, and when destroying
a save level.

We have to retain the 'has_refs' value for the latter case for the garbager to
function correctly, but doing so in the former results in the garbager
sometimes scanning more memory than is really necessary (it can end up scanning
ref memory from the previous save state, which is pointless since that cannot
change).

This change means that 'has_refs == true' will only be retained in the
'destroying a save level' case (which works correctly because, by the time the
function is called, we've already returned the relevant allocated to its
previous state).

psi/isave.c


2016-09-15 14:14:35 -0700
Ray Johnston <ray.johnston@artifex.com>
bfffe2011e1c8ffe53a432424b049f3989d6174a

Fix bug 697097. SMask subpixel offset must match image offset.

The dda used to select the source pixel for mapping into the image
must use the same stepping for gray (monochrome) and color images
since an SMask is monochrome and the image may be in color. This is
primarily evident with the bug file since Matte is used to indicate
that the source data is premuliplied. Colors can shift a LOT since
the removal of the premultiplication can expand mistaked.

base/gxicolor.c


2016-09-14 16:31:56 +0100
Ken Sharp <ken.sharp@artifex.com>
5521e702af192e06f186d0d741f24097eb5b8e26

PDF interpreter - fix for GSView 5

Commit 093bd18bd923644fcd25c507088c0ebc63b4c320 included an
'optimisation' to prevent rescanning for transparency if we had already
scanned. However, this assumed that the function pdfshowpage_setup
had already been executed in order to set a variable.

This is always true when running files via Ghostscript, but any
application (such as GSView 5) which executes the PDF operations
individually need not execute this function. If the function was not
executed then an error occurred. From other comments in pdf_main.ps
its possible that customers may be using these functions as well (see
the comments above the definition of /pdfshowpage)

This commit checks to see if the variable has been set, if it has then
it is used, otherwise we rescan for transparency. This prevents the
error, but uses the optimisation if its possible to do so.

No differences expected

Resource/Init/pdf_main.ps


2016-09-14 10:28:43 +0100
Chris Liddell <chris.liddell@artifex.com>
04117ec705cfc89ce4bb4b451ba95af61b937fe0

Bump version number to 9.21

Resource/Init/gs_init.ps
base/version.mak


2016-09-26 11:36:27 +0100
Chris Liddell <chris.liddell@artifex.com>
5deee306126e09f95e40e69fe04a7d26c842fb56

Update date and product string for 9.20 release

base/gscdef.c
base/version.mak
doc/API.htm
doc/C-style.htm
doc/Commprod.htm
doc/DLL.htm
doc/Deprecated.htm
doc/Details8.htm
doc/Details9.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/Helpers.htm
doc/History1.htm
doc/History2.htm
doc/History3.htm
doc/History4.htm
doc/History5.htm
doc/History6.htm
doc/History7.htm
doc/History8.htm
doc/History9.htm
doc/Install.htm
doc/Issues.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.htm
doc/Projects.htm
doc/Ps-style.htm
doc/Ps2epsi.htm
doc/Psfiles.htm
doc/Readme.htm
doc/Release.htm
doc/SavedPages.htm
doc/Source.htm
doc/Unix-lpr.htm
doc/Use.htm
doc/VectorDevices.htm
doc/WhatIsGS.htm
doc/Xfonts.htm
doc/gs-vms.hlp
doc/sample_downscale_device.htm
doc/thirdparty.htm
man/dvipdf.1
man/font2c.1
man/gs.1
man/gslp.1
man/gsnd.1
man/pdf2dsc.1
man/pdf2ps.1
man/pf2afm.1
man/pfbtopfa.1
man/printafm.1
man/ps2ascii.1
man/ps2epsi.1
man/ps2pdf.1
man/ps2pdfwr.1
man/ps2ps.1
man/wftopfa.1


2016-09-20 20:33:21 +0100
Chris Liddell <chris.liddell@artifex.com>
3263f33ba60aafe7b671d2c9b7a3b25fb39a7bee

Changelog update for 9.20 RC2

doc/History9.htm


2016-09-14 17:35:30 +0100
Chris Liddell <chris.liddell@artifex.com>
457cc95668fbf26cf9cf5e4ee10709ad8c8e2c58

Fix a type in the release comments

doc/History9.htm
doc/News.htm


2016-09-14 12:14:11 +0100
Chris Liddell <chris.liddell@artifex.com>
eedf4c16032d2a8ec356705f28cee3fdbec248d2

Update News and changelog

doc/History9.htm
doc/News.htm


2016-09-14 10:40:36 +0100
Chris Liddell <chris.liddell@artifex.com>
7658715de338f9cd3a62d44f7c503f81d03a3fae

Copyrights, dates etc

doc/API.htm
doc/C-style.htm
doc/Commprod.htm
doc/DLL.htm
doc/Deprecated.htm
doc/Details8.htm
doc/Details9.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/Helpers.htm
doc/History1.htm
doc/History2.htm
doc/History3.htm
doc/History4.htm
doc/History5.htm
doc/History6.htm
doc/History7.htm
doc/History8.htm
doc/History9.htm
doc/Install.htm
doc/Issues.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.htm
doc/Projects.htm
doc/Ps-style.htm
doc/Ps2epsi.htm
doc/Psfiles.htm
doc/Readme.htm
doc/Release.htm
doc/SavedPages.htm
doc/Source.htm
doc/Unix-lpr.htm
doc/Use.htm
doc/VectorDevices.htm
doc/WhatIsGS.htm
doc/Xfonts.htm
doc/gs-vms.hlp
doc/sample_downscale_device.htm
doc/thirdparty.htm
man/dvipdf.1
man/font2c.1
man/gs.1
man/gslp.1
man/gsnd.1
man/pdf2dsc.1
man/pdf2ps.1
man/pf2afm.1
man/pfbtopfa.1
man/printafm.1
man/ps2ascii.1
man/ps2epsi.1
man/ps2pdf.1
man/ps2pdfwr.1
man/ps2ps.1
man/wftopfa.1
psi/msvc.mak


2016-09-14 10:34:52 +0100
Chris Liddell <chris.liddell@artifex.com>
8749511b204f255740a1555520a9b1d7adcceacf

Change product family for RC

Plus dates

base/gscdef.c


2016-09-20 18:07:51 +0100
Chris Liddell <chris.liddell@artifex.com>
65898de27797a835d2029676d4380b3c7806dc9e

Bug 697138: Fix --disable-sse2 to work with openjpeg

OpenJPEG enables it's SSE code based on the compiler defining __SSE__ so we
want to undefine that if we're not using SSE operations.

Makefile.in
configure.ac


2016-09-20 19:57:14 +0100
Robin Watts <robin.watts@artifex.com>
ed866d7ab135edebd9c53f52026426d403f53a49

Fix splay tree traversal (again)

When setting up a traversal from a midpoint of the tree, we'd
immediately trip into the "has hit the endpoint" code.

Fix that.

base/gsalloc.c


2016-09-20 09:03:31 -0700
Ray Johnston <ray.johnston@artifex.com>
ba8a97dc6f67e044d567e38c68cfd5b785835615

FitPage should not add in rotation if destination page is square.

If the PageSize was square, it would be treated as "not landscape",
but landscape pages in would be arbitrarily rotated.

Note this does not change the bahavior of PS or EPS page fitting.
TBD: Add an option to fit to a page and never rotate (FitPageNR)

Resource/Init/pdf_main.ps


2016-09-20 16:48:45 +0100
Robin Watts <robin.watts@artifex.com>
029f4ec2d6b8165b0cfff02173cde68edaebc108

Fix Memento crash

When reallocing set the rawsize before attempting to write
the post guard block.

base/memento.c


2016-09-20 13:41:31 +0100
Robin Watts <robin.watts@artifex.com>
5547040a0de52d588401ea9f1dfd20bc8168f455

Sync Memento with MuPDF.

base/memento.c
base/memento.h


2016-09-20 13:04:51 +0100
Robin Watts <robin.watts@artifex.com>
f763382b616c35e9a021bde4e5347c1d67df5a0a

Bug 697134: Tweak MEMENTO_GS_HACKS inclusion.

Rather than rolling our own memset prototype in this case, use
the one that gs provides.

base/memento.c


2016-09-16 15:23:32 +0100
Chris Liddell <chris.liddell@artifex.com>
c3c48bbdda6915abfe39b4a0de9978555fc071ba

Clump has_refs - follow up to commit 63f74ce6

The function save_set_new() (where the original fix for 'has_refs' is located)
is called in two circumstances: when creating a save level, and when destroying
a save level.

We have to retain the 'has_refs' value for the latter case for the garbager to
function correctly, but doing so in the former results in the garbager
sometimes scanning more memory than is really necessary (it can end up scanning
ref memory from the previous save state, which is pointless since that cannot
change).

This change means that 'has_refs == true' will only be retained in the
'destroying a save level' case (which works correctly because, by the time the
function is called, we've already returned the relevant allocated to its
previous state).

psi/isave.c


2016-09-15 14:14:35 -0700
Ray Johnston <ray.johnston@artifex.com>
974843fc7c06bc7354bd5f74f87a22014b0a1e16

Fix bug 697097. SMask subpixel offset must match image offset.

The dda used to select the source pixel for mapping into the image
must use the same stepping for gray (monochrome) and color images
since an SMask is monochrome and the image may be in color. This is
primarily evident with the bug file since Matte is used to indicate
that the source data is premuliplied. Colors can shift a LOT since
the removal of the premultiplication can expand mistaked.

base/gxicolor.c


2016-09-14 16:31:56 +0100
Ken Sharp <ken.sharp@artifex.com>
8079f5a688d54ba7ab5358d59a7773caa2176d23

PDF interpreter - fix for GSView 5

Commit 093bd18bd923644fcd25c507088c0ebc63b4c320 included an
'optimisation' to prevent rescanning for transparency if we had already
scanned. However, this assumed that the function pdfshowpage_setup
had already been executed in order to set a variable.

This is always true when running files via Ghostscript, but any
application (such as GSView 5) which executes the PDF operations
individually need not execute this function. If the function was not
executed then an error occurred. From other comments in pdf_main.ps
its possible that customers may be using these functions as well (see
the comments above the definition of /pdfshowpage)

This commit checks to see if the variable has been set, if it has then
it is used, otherwise we rescan for transparency. This prevents the
error, but uses the optimisation if its possible to do so.

No differences expected

Resource/Init/pdf_main.ps



Version 9.20 (2016-09-26)

This is the fourteenth full release in the stable 9.x series, and is purely a maintenance release.

Highlights in this release include:

For a list of open issues, or to report problems, please visit bugs.ghostscript.com.

Incompatible changes

Changelog

2016-09-20 18:07:51 +0100
Chris Liddell <chris.liddell@artifex.com>
1bd7f32d70549971b4a384c5865e1fd030f49f20

Bug 697138: Fix --disable-sse2 to work with openjpeg

OpenJPEG enables it's SSE code based on the compiler defining __SSE__ so we
want to undefine that if we're not using SSE operations.

Makefile.in
configure.ac


2016-09-20 19:57:14 +0100
Robin Watts <robin.watts@artifex.com>
20b0255206254ebcce1cde0a4a63d74b0aedcecf

Fix splay tree traversal (again)

When setting up a traversal from a midpoint of the tree, we'd
immediately trip into the "has hit the endpoint" code.

Fix that.

base/gsalloc.c


2016-09-20 09:03:31 -0700
Ray Johnston <ray.johnston@artifex.com>
0e1153bf2d344044cd9fdfb7706f829b63348118

FitPage should not add in rotation if destination page is square.

If the PageSize was square, it would be treated as "not landscape",
but landscape pages in would be arbitrarily rotated.

Note this does not change the bahavior of PS or EPS page fitting.
TBD: Add an option to fit to a page and never rotate (FitPageNR)

Resource/Init/pdf_main.ps


2016-09-20 16:48:45 +0100
Robin Watts <robin.watts@artifex.com>
570041cc341557da8521fdace380f837cc572a69

Fix Memento crash

When reallocing set the rawsize before attempting to write
the post guard block.

base/memento.c


2016-09-20 13:41:31 +0100
Robin Watts <robin.watts@artifex.com>
3dd5f4c6b02179422bd8686fceed1f4955221d90

Sync Memento with MuPDF.

base/memento.c
base/memento.h


2016-09-20 13:04:51 +0100
Robin Watts <robin.watts@artifex.com>
4e01c57e0f0773e29bc6f921cfc677576e72739d

Bug 697134: Tweak MEMENTO_GS_HACKS inclusion.

Rather than rolling our own memset prototype in this case, use
the one that gs provides.

base/memento.c


2016-09-16 15:23:32 +0100
Chris Liddell <chris.liddell@artifex.com>
1a0104084a4dfdff77165d931bdc87849c8ad824

Clump has_refs - follow up to commit 63f74ce6

The function save_set_new() (where the original fix for 'has_refs' is located)
is called in two circumstances: when creating a save level, and when destroying
a save level.

We have to retain the 'has_refs' value for the latter case for the garbager to
function correctly, but doing so in the former results in the garbager
sometimes scanning more memory than is really necessary (it can end up scanning
ref memory from the previous save state, which is pointless since that cannot
change).

This change means that 'has_refs == true' will only be retained in the
'destroying a save level' case (which works correctly because, by the time the
function is called, we've already returned the relevant allocated to its
previous state).

psi/isave.c


2016-09-15 14:14:35 -0700
Ray Johnston <ray.johnston@artifex.com>
bfffe2011e1c8ffe53a432424b049f3989d6174a

Fix bug 697097. SMask subpixel offset must match image offset.

The dda used to select the source pixel for mapping into the image
must use the same stepping for gray (monochrome) and color images
since an SMask is monochrome and the image may be in color. This is
primarily evident with the bug file since Matte is used to indicate
that the source data is premuliplied. Colors can shift a LOT since
the removal of the premultiplication can expand mistaked.

base/gxicolor.c


2016-09-14 16:31:56 +0100
Ken Sharp <ken.sharp@artifex.com>
5521e702af192e06f186d0d741f24097eb5b8e26

PDF interpreter - fix for GSView 5

Commit 093bd18bd923644fcd25c507088c0ebc63b4c320 included an
'optimisation' to prevent rescanning for transparency if we had already
scanned. However, this assumed that the function pdfshowpage_setup
had already been executed in order to set a variable.

This is always true when running files via Ghostscript, but any
application (such as GSView 5) which executes the PDF operations
individually need not execute this function. If the function was not
executed then an error occurred. From other comments in pdf_main.ps
its possible that customers may be using these functions as well (see
the comments above the definition of /pdfshowpage)

This commit checks to see if the variable has been set, if it has then
it is used, otherwise we rescan for transparency. This prevents the
error, but uses the optimisation if its possible to do so.

No differences expected

Resource/Init/pdf_main.ps


2016-09-14 10:40:36 +0100
Chris Liddell <chris.liddell@artifex.com>
79c79254908fe69462407c60966dd10521b4a9ac

Copyrights, dates etc

doc/API.htm
doc/C-style.htm
doc/Commprod.htm
doc/DLL.htm
doc/Deprecated.htm
doc/Details8.htm
doc/Details9.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/Helpers.htm
doc/History1.htm
doc/History2.htm
doc/History3.htm
doc/History4.htm
doc/History5.htm
doc/History6.htm
doc/History7.htm
doc/History8.htm
doc/History9.htm
doc/Install.htm
doc/Issues.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.htm
doc/Projects.htm
doc/Ps-style.htm
doc/Ps2epsi.htm
doc/Psfiles.htm
doc/Readme.htm
doc/Release.htm
doc/SavedPages.htm
doc/Source.htm
doc/Unix-lpr.htm
doc/Use.htm
doc/VectorDevices.htm
doc/WhatIsGS.htm
doc/Xfonts.htm
doc/gs-vms.hlp
doc/sample_downscale_device.htm
doc/thirdparty.htm
man/dvipdf.1
man/font2c.1
man/gs.1
man/gslp.1
man/gsnd.1
man/pdf2dsc.1
man/pdf2ps.1
man/pf2afm.1
man/pfbtopfa.1
man/printafm.1
man/ps2ascii.1
man/ps2epsi.1
man/ps2pdf.1
man/ps2pdfwr.1
man/ps2ps.1
man/wftopfa.1
psi/msvc.mak


2016-09-14 10:34:52 +0100
Chris Liddell <chris.liddell@artifex.com>
703223237fe84cff31628e78a511cf60ef632969

Change product family for RC

Plus dates

base/gscdef.c
base/version.mak


2016-09-07 11:05:08 +0100
Chris Liddell <chris.liddell@artifex.com>
cd181f9d5cb9b2cd589cb43b0d06b1e6ebc579b4

Bug 697102 - AddressSanitizer: buffer overflow solid_pattern_data

Although (likely) benign, solving this is trivial: give the rendering code
a ushort rather than a single byte.

pcl/pcl/pcbiptrn.c


2016-09-07 11:33:28 +0100
Chris Liddell <chris.liddell@artifex.com>
cd95789bc8eaf0e86f902c8ba3f796340ffdad25

Ensure PCL/XPS free all their memory.

Noticed in passing (thrown up by ASAN): the plmain code was not fully shutting
down the memory manager when using the chunk allocator.

This commit adds a convenient function (gs_memory_chunk_wrap) and a
pl_alloc_finit() function to ensure that all happens.

base/gsmalloc.c
base/gsmchunk.c
base/gsmchunk.h
pcl/pl/plalloc.c
pcl/pl/plalloc.h
pcl/pl/plmain.c


2016-09-07 09:58:50 +0100
Chris Liddell <chris.liddell@artifex.com>
dbfde5f3400e97b6d9b71a6549ff419dcefc9a95

Bug 696599: cast disguised wrong type dereference.

The code was casting to a gx_device_printer to get to the BLS_force_memory
value, but since the target device for a clist device is no longer
necessarily a printer device, it wasn't guaranteed that the struct contained
that entry.

So move BLS_force_memory to the base device type (gx_device), so it's always
available.

base/gdevprn.h
base/gxclbits.c
base/gxdevcli.h
base/gxdevice.h
devices/gdevbit.c


2016-09-12 19:31:49 +0100
Ken Sharp <ken.sharp@artifex.com>
8e541e3e356624506720fddd26441a2c43d82024

pdfwrite - don't reset the graphics state object for new XObject streams

Bug #697109 "Inkscape graphics in Latex PDF distorted on compression"

When starting a new substream the pdfwrite code always resets the current
graphics state to the 'initial' state. This seem, to me, utterly wrong,
if we have changed the graphics state, then it persists into any
'substreams'.

Indeed, in this case we set the dash array, then the fact that we have
transparency causes us to push a new group, this starts a new substream,
we reset the graphics parameters (including the dash). Then we set the
dash pattern to the default and stroke a path. If we didn't start a
group we would notice the dash had changed and emit the change. However
because the group causes a reset, we see the dash change to the same as
it currently is, so we don't emit it.

I'm not totally happy with this change, there are a *lot* of subtleties
in the code, not least the (bonkers) fact that starting a group *does*
reset 3 extended graphics state parameters (SMask and constant alpha).
It looks like we have some assumptions built in elsewhere as well. If
I don't reset all the parameters then some other files start to fail.

This fix doesn't reset the graphics state for XObjects, but does for
everything else. For XObjects it only resets the 3 group parameters.

I'd spend more time on this but I want to get some sort of fix into the
9.20 release. This definitely needs more investigation.

There are a number of diffs, most are definite progressions, a few that
I can't be sure of but they don't seem any worse (and in some cases the
original file is technically broken anyway). Oddly there are more
progressions when rendering to halftoned devices, I can only assume
that we were previously emitting a broken halftone.

devices/vector/gdevpdti.c


2016-09-12 17:50:45 +0100
Chris Liddell <chris.liddell@artifex.com>
d1ef839f4c41645cdba9524d0062c5aa2c533818

Bug 697110: Ensure stream 'file_limit' is correct

Follow-on from commit 4b101952d81a5899972f81f7b18ef3becd5bd45e

There are several places that set, and check the value of file_limit for
streams. Ensure they all use the requisite value whether the gs_offset_t is
64 bit (normal) or 32 bit (abnormal).

To make it easier, and more consistent, pull the logic out into a macro.

base/gsioram.c
base/gsiorom.c
base/sfxfd.c
base/sfxstdio.c
base/stream.h
psi/zfrsd.c
psi/ziodevsc.c


2016-09-09 07:54:26 +0200
Janssen <njj@ocevenlo.oce.net>
efdd255f800b4f1bc22e81d686691aa1b48f785f

Bug 697088, HPGL not printing PCL downloaded font.

The hpgl_map_symbol() function is modified to handle downloaded
(bound) pcl fonts correctly. HPGL and PCL now use the same
char_is_printable() function to detect printable characters.

modified: pcl/pcl/pcstate.h
modified: pcl/pcl/pctext.c
modified: pcl/pcl/pglabel.c

pcl/pcl/pcstate.h
pcl/pcl/pctext.c
pcl/pcl/pglabel.c


2016-09-11 10:52:58 +0100
Ken Sharp <ken.sharp@artifex.com>
e25d823decd905a4917d26fe3d08a15af12eb1a6

pdfwrite - another guard against a NULL clip path

commit ab3a1249ce28e3cac629ce1466d17e635ff50fab introduced a check
to ensure a clip path wasn't null before using it. This caused Coverity
to then check the use of that clip path throughout the function, and
identify another area needing a check.

devices/vector/gdevpdte.c


2016-09-10 11:52:38 -0700
Ray Johnston <ray.johnston@artifex.com>
aa23930545649007079b17057083c1725427c558

Apply fix suggested in Bug 697108 to prevent infinite loop

Hopefully the last missed increment of a loop variable in the image
interpolation code.

Thanks to Jonathan Dagresta for the patch.

base/gxiscale.c


2016-09-09 12:15:44 +0100
Chris Liddell <chris.liddell@artifex.com>
cca3ba8087dbec47a6e7a8e5368da9e28fb81663

Add building a 'stripped' shared lib.

configure.ac now finds the 'strip' exe.

There's a new target 'so-only-stripped' which builds the .so libs and then
strips them using the supplied strip exe

Makefile.in
base/unix-dll.mak
configure.ac


2016-09-09 09:05:31 +0100
Chris Liddell <chris.liddell@artifex.com>
0783d723673f60099d6cdaa47431d6fd2bfad68b

Tweak .so target to not have a "main" function.

base/unix-dll.mak
base/unixlink.mak


2016-09-08 15:10:47 -0600
Henry Stiles <henry.stiles@artifex.com>
e088b1dfdaab9dc66b96b2f2d022384f6258a822

Bug #696658 - 2 ligatures had incorrect mappings.

The unicode values were wrong for ff and fi. With this fix and the
new URW fonts the problem reported is fixed.

pcl/pl/plsymbol.c


2016-09-08 09:12:52 +0100
Ken Sharp <ken.sharp@artifex.com>
e221dcd1b756f2a6e04531876e43b587fa8577b1

pdfwrite - don't attempt to keep co-ordinates <32K when creating PDF 1.5+

Bug #697098 "pdfwrite charpath conversion problem"

When the PDFCompatibilityLevel is 1.5 or above we can use reals with
sensible ranges, instead of the +/- 32767 that old versions of the
specification limited us to.

This results in a large number of small differences, some minor progressions

devices/vector/gdevpdfd.c


2016-09-07 16:11:58 +0100
Ken Sharp <ken.sharp@artifex.com>
e644fc3454bf84555b2d8369138d2f25bfbf6133

pdfwrite - Don't limit the resolution when Compatibility > 1.4

Bug #697098 "pdfwrite charpath conversion problem"

This is not a fix, but a work-around, especially for future files.

We currently limit the resolution by checking the media size to see if
it lies in the range +/- 16,000. This is because The PDF Reference states
that co-ordinates are real numbers, and versions of the spec prior to
1.5 have a limit of +/- 32,767 for real numbers. In practice it was
noted that Acrobat Reader couldn't even cope with numbers that large so
we arbitrarily settled on 16,384 and then allowed a bit of slop.

With the PDF 1.5 specification (now 13 years old) this limit was raised
to +/- 3.403x10^38

In the interim we have also raised our default PDF creation to 1.5 and
we have adopted other means (altering the CTM) to keep co-ordinates
in the 32,767 range. So there is really no reason to maintain this old
hack.

devices/vector/gdevpdfp.c


2016-09-07 16:03:02 +0100
Ken Sharp <ken.sharp@artifex.com>
ab3a1249ce28e3cac629ce1466d17e635ff50fab

pdfwrite - guard against an empty clip path

Noticed while doing other work, if we don't have a clip path, we must
not attempt to use it to clip text.....

No differences expected

devices/vector/gdevpdte.c


2016-09-07 10:37:27 -0700
Ray Johnston <ray.johnston@artifex.com>
c835d00d51a70d410e0092f9442d30bcf38e95f1

Soft Mask Matte Entry Bug 697097

Included getting the Matte color entries to the
transparency compositor action (Thanks to Ray)
and undoing the preblend with the Matte bias.

Resource/Init/pdf_draw.ps
base/gdevp14.c
base/gdevp14.h
base/gstparam.h
base/gstrans.c
base/gstrans.h
base/gxblend1.c
psi/ztrans.c


2016-09-07 07:17:26 -0700
Ray Johnston <ray.johnston@artifex.com>
4b101952d81a5899972f81f7b18ef3becd5bd45e

Fix sread_subfile check for file_limit when gs_offset_t is bigger than long.

The file_limit was initialized in sread_file and swrite_file to the largest
gs_offset_t value, but the check only compared to max_long.

base/sfxstdio.c


2016-09-04 10:51:06 -0700
Ray Johnston <ray.johnston@artifex.com>
527450e2ef1eca2ad26cdfba3a4f667e90bfd992

Fix typo introduced in commit c9f24068

Resource/Init/pdf_main.ps


2016-09-02 10:37:59 -0700
Ray Johnston <ray.johnston@artifex.com>
57387434f2bfefea94445b095465dfb621855ba1

Fix is_big_mask calculation to be sqrt(a*a + b*b)

Resource/Init/pdf_draw.ps


2016-09-01 07:44:23 -0700
Ray Johnston <ray.johnston@artifex.com>
a127d73fc54024ad7aa6a73703c642527137d4ac

Add findrgbcustomcolor as requested by customer 400.

This appears to be used in the AI5 ProcSet of Adobe Illustrator (R)
Version 7.0 Full Prolog and allows us to construct a Separation
space that has a DeviceRGB alternate colorspace and tint transform.
There is no Adobe documentation that mentions this, but I found one
other implementation that had this procedure defined.

Also fix missing pop when setcustomcolor is invoked with tint == null

Resource/Init/gs_lev2.ps


2016-08-30 12:59:37 -0600
Henry Stiles <henry.stiles@artifex.com>
776b12c8b6051cad5c6e1839a00f20221b33731d

Bug 697032 - remove files with unsuitable licenses

contrib/japanese/doc/djgpp.txt
contrib/japanese/doc/gdevmag.txt
contrib/japanese/doc/gs261j.euc
contrib/japanese/doc/gs261j.txt


2016-08-30 12:43:58 -0600
Henry Stiles <henry.stiles@artifex.com>
605f61b950d79204762198e67c9700b9410b465e

Bug 697032, remove chess.ps

examples/chess.ps


2016-08-30 08:33:32 -0700
Ray Johnston <ray.johnston@artifex.com>
dd8d83665f5e32ce7057e3ca2e8662eabb195c2a

Add mention of PostRenderProfile option in documentation.

doc/Devices.htm
doc/sample_downscale_device.htm


2016-08-30 16:03:00 +0100
Chris Liddell <chris.liddell@artifex.com>
d26a2bb28aeeb5e94c501ff085bb52f72151f65b

Bug 696867: strip trailing whitespace from configure.ac

configure.ac


2016-08-26 15:44:24 +0100
Chris Liddell <chris.liddell@artifex.com>
66d905ba077ec5025299a7cd2074e66fac2e09d2

Reinstate pointer alignment special case for sparc and hpux

The configure check for required pointer alignment works on Linux/SPARC, but
not on Solaris/SPARC - so reinstate the special case code in genarch.c

I'm including the HP/UX case as well since it's safer, and does not add
to the complexity of code.

base/genarch.c


2016-08-26 15:12:19 +0100
Chris Liddell <chris.liddell@artifex.com>
c6290b83763b6a7022112886517d23ce3d2140ca

Bug 697064: FAPI: work around compiler bug

The Sun cc compiler optimizer has bug that *seems* to result in the order
addition operations being changed (which isn't legal). In this case, we're
unpacking bytes from a stream, and reordering the operations means the
bytes come out of the stream in the wrong order.

psi/zfapi.c


2016-08-26 13:44:49 -0700
Ray Johnston <ray.johnston@artifex.com>
b830052545cbcd5f31fc90edc8ddedf54eb9eded

Fix a couple of minor typos in the Trap param section.

doc/Devices.htm


2016-08-26 13:37:47 -0700
Ray Johnston <ray.johnston@artifex.com>
7bb57f5d37e246ceb551ed5821873239ab26034e

Add documentaion and sample code for a CMYK 32-bit downscaling device

doc/gdevds32.c
doc/sample_downscale_device.htm


2016-08-29 13:46:13 -0600
Henry Stiles <henry.stiles@artifex.com>
a76c1e1c6bce85d01682e8e595b50ddabed5be3d

Bug #696856 - fix memcmp being used on a structure.

The bad memcmp was part of an obsolete implementation to include icc
profiles in the photoshop device which is removed with this change.

devices/gdevpsd.c


2016-08-29 12:46:47 -0600
Henry Stiles <henry.stiles@artifex.com>
6892b89fab66086346d754714806ce0870407970

Fix 696929 - SetLineDash error.

Many HP printer and our PXL interpreter limit the dash element array
size to 20 so we shouldn't produce PCLXL that exceeds that limit.

devices/vector/gdevpx.c


2016-08-26 12:12:37 -0600
Henry Stiles <henry.stiles@artifex.com>
2f18c60fd2aa43f59fbf197463aca30ea3a0bc2d

Fix 697030 - Interpreter exit.

If the vector device's begin image procedure fails fallback to using
the default image code instead of producing an error.

devices/vector/gdevpx.c


2016-08-25 13:26:13 -0700
Ray Johnston <ray.johnston@artifex.com>
124e9f44c03cc0d3773d18708ee285b75cb12c04

Fix minor typo in devs.mak for the tiffscaled8 devcice

devices/devs.mak


2016-08-25 08:56:58 +0100
Chris Liddell <chris.liddell@artifex.com>
af8dfa700dca2671ea9d81e01adb2db219c0bb2f

Tweak the .a target

Add an explicit "gslib" target, and have the .a end up in the "bin" direstory
rather than the root of the tree.

So, to build the .a now, you'd do "make gslib"

base/unixlink.mak


2016-08-25 08:55:47 +0100
Chris Liddell <chris.liddell@artifex.com>
94913c07fe8c4863d925cf117664a07262c6fc9d

Add a couple of headers for function prototypes

abs() and memset() prototypes.

Also, dependencies as required

base/gp_psync.c
base/gxht_thresh.c
base/lib.mak


2016-08-24 10:12:59 -0700
Michael Vrhel <michael.vrhel@artifex.com>
7f08915e1b84fc15759ab8a3aacab47196bbaf32

Bug 697060. -dUsePDFX3Profile and -dNumRenderingThreads

When the output intent profile is used it was cloned from
the target device, but it was not getting its initial settings
in place. The threads do not need the post render profile nor
the output intent profile (it is the device profile in this case)

This was tested on -dUsePDFX3Profile, -dNumRenderingThreads=4
-sPostRenderProfile="myprinter.icc" with the file Altona_Technical_v20_x4.pdf

base/gsicc_manage.c
base/gxclthrd.c


2016-08-24 07:49:53 -0700
Michael Vrhel <michael.vrhel@artifex.com>
8a8eefe5dcb1509aa5ebd7517438c755045bb139

Bug 697059 Pattern and Spot Color

If the only occurrence of a spot color was in a pattern,
the equivalent CMYK values were not getting set for use
by a separation device during the installation of the
separation color space. This was due to the fact that
the pattern accumulator bits device (whose target is the
real device) has its update_spot_equivalent_color proc set
to default which ends up doing nothing. Instead we now
set the bits device proc to forward to the real target
device.

base/gxpcmap.c


2016-08-23 08:09:09 -0700
Ray Johnston <ray.johnston@artifex.com>
cc3192c4fddaccfe4d3199e944ae9a7b8edb5682

Improve bug 696985. Performance issue (and large memory usage).

The GC would run due to the 'system' VM which never had it's limit set (default
600,000), but after the GC ran the limits for all of the VM's were reset to
the current allocated plus the limit, so the local VM and global VM were not
in a state to be collected (pages ran in a save ... restore).

Setting the system VM limit to the same value allows the file to complete
in 84 seconds and only uses 74Mb (a cut down file that was 5k pages took 170
seconds and used 634Mb before the change). The entire large file only needed
725 GC's to complete and most were for the local VM (space==12), rather than
for the system VM (space==4).

Also change the formatting of one of the gs_debug['0'] messages to keep all
the relevant values on one line which makes searching/grepping easier.

base/gsalloc.c
psi/zvmem2.c


2016-08-22 15:10:17 -0700
Michael Vrhel <michael.vrhel@artifex.com>
e20ae050feea47ded0d96c49627ed5c7b3502db6

Set default rendering condition to unspecified

Also fix up a few memory issues with respect to the post render
ICC profile.

base/gsdevice.c
base/gsicc_manage.c
base/gxclthrd.c


2016-08-23 16:41:16 +0100
Chris Liddell <chris.liddell@artifex.com>
755eddab9cb238324dc84ac1fd5c9736314d8a48

Partially revert "Change "GPL Ghostscript" to "Ghostscript""

Change references from GPL to AGPL, but leave the product/project name
as "GPL Ghostscript".

base/gp_wgetv.c
base/gscdef.c
doc/Commprod.htm
doc/Install.htm
doc/Language.htm
doc/Readme.htm
doc/Release.htm
psi/dwreg.c
psi/mkfilelt.cpp
psi/nsisinst.nsi


2016-08-22 08:52:26 +0100
Ken Sharp <ken.sharp@artifex.com>
5cbf2d0185ce6b268abffc275d72ffd1a6b5b18b

PDF interpreter - honour /Intent for images

Bug #697055 " Intent entry in Image Dictionary not honored"

This causes a number of differences, most are not discernible, (careful
scrutiny shows slightly brighter colour in a few of these) however
icc_v4_profile.pdf shows a marked progression in one image
(V4 CMYK profile).

Resource/Init/pdf_draw.ps


2016-08-21 16:58:29 -0700
Marcos H. Woehrmann <marcos.woehrmann@artifex.com>
923d7bd2715f24a41a79894086b8106885a71ccd

Dependency fix for gxscanc.c.

The dependency gx.h was missing from the dependency list; this caused
parallel builds to fail.

base/lib.mak


2016-08-21 22:44:34 +0000
Hin-Tak Leung <hintak@ghostscript.com>
c9af5e8a5578b01714ddca0afa13b5707e3a14a9

Revert a few line-breaks from the recent auto-indentation

This is a cosmetic change - no modification to code logic.

No cluster differences

devices/vector/gdevpx.c


2016-08-20 20:38:16 +0000
Hin-Tak Leung <hintak@ghostscript.com>
1142ba29b19a819aba4cb89f029a6d15330ea11a

Factoring out a long common expression, for readability.

This is a cosmetic change, and does not affect the code logic.
This part of the code had grown steadily in the past from
stuff_1
to
(flipped ? stuff_2 : stuff_1)
to
if (!icc)
(flipped ? stuff_2 : stuff_1)
else
(flipped ? stuff_2a : stuff_1a)

No cluster differences

devices/vector/gdevpx.c


2016-08-19 00:40:16 +0100
Hin-Tak Leung <hintak@ghostscript.com>
ada0c784640fcd355a0d6a1b2132dafad14f21bc

Auto-indent according to doc/C-style.htm

Running
indent -bad -nbap -nsob -br -ce -cli4 -npcs -ncs -i4 -di0 -psl -lp -lps -nut
, according to doc/C-style.htm

This fixes some inconsistent tabs and indentations accumulated over the years.

No cluster differences

devices/vector/gdevpx.c


2016-08-19 00:56:29 +0000
Hin-Tak Leung <hintak@ghostscript.com>
764812e438e1a94afa09a8b46fa017d8cb287fac

Add a few semi-colons and manually breaking a few lines

This is a non-code-logic change to assist the next step, auto-indentation.

No cluster differences

devices/vector/gdevpx.c


2016-08-19 00:00:13 +0100
Hin-Tak Leung <hintak@ghostscript.com>
62898632f38230fc778f929ab4ea4469b36ac3b4

Use default unoptimized code path for non-CMYK and inverted images.

5 of the test files have 32-bit images which the new CMYK code does
not process correctly. So we revert back to the unoptimized code
path for them.

1 with 32-bit DeviceN:

tests_private/comparefiles/Bug692494.pdf

4 have inverted Decode arrays ([1 0 1 0 1 0 1 0]) - i.e. they
are RGBW rather than CMYK. It is probably not hard to cope with them
also, but push them back onto the unoptimized code path for now:

tests_private/comparefiles/Bug696487.pdf
tests_private/comparefiles/z400454b01d4-1.pdf
tests_private/pdf/PDFIA1.7_SUBSET/CATX6554.pdf
tests_private/pdf/sumatra/1610_-_Decode_ignored_for_JPX_images_regression_from_r2055_.pdf

No cluster differences

devices/vector/gdevpx.c


2016-08-18 23:16:16 +0100
Hin-Tak Leung <hintak@ghostscript.com>
cf72ede2c68e1f76530b1da86dfda70e8ee5295c

Calculate correctly the offset for the last (incomplete) strip of a flipped image for icc

The ICC-transform code path was never thoroughly tested. PXL can do rotated
but not reflected images; we worked around this limitation by processing the
scanlines from the end of the buffer backward. For an incomplete strip, we
therefore need to offset into the final buffer. The offset is different for
pre-icc code path vs icc-transformed code path.

Affected files:
tests_private/comparefiles/besttest.pdf
tests_private/pdf/PDFIA1.7_SUBSET/CATX4547.pdf
tests_private/pdf/sumatra/x_-_text_clipped_away_above_141_pc.pdf

No cluster differences

devices/vector/gdevpx.c


2016-08-17 03:17:41 +0000
Hin-Tak Leung <hintak@ghostscript.com>
50aa6f1bcb7035c3eb7f6e0d3e502ae021ba681e

Allow 32-bit CMYK image (converted to 24-bit RGB) to be jpeg compressed.

Previously, anything except 24-bit RGB is forbidden from going through
jpeg compression, because anything other than image does not make sense.
RLE and DeltaRow can apply to general byte-stream data, not jpeg.

This is another part of the enhancement for bug 696905, and depends
on the previous two of this group. The previous two changes convert
32-bit CMYK data to 24-bit RGB internally, either through
DeviceCMYK->RGB or icc. So this change is just a one-liner.

No cluster differences

devices/vector/gdevpx.c


2016-08-13 21:36:54 +0000
Hin-Tak Leung <hintak@ghostscript.com>
cea5c6072c1e224fea7c0a7334d943cc1250ad5b

Make 32-bit CMYK image icc-proccessed, unless UseFastColor is specified.

This is a further part of the enhancement for bug 696905.

There is a big block of comments about a previous change of
pclxl_can_handle_color_space() (introduced in bug 692329)
being wrong and causes slightly wrong colors. That needs to be
looked at eventually, and this change updated.

No cluster differences

devices/vector/gdevpx.c


2016-08-10 14:31:47 +0000
Hin-Tak Leung <hintak@ghostscript.com>
967460041394c2ece02aedf9dba59ef4a3137f28

Optimize for CMYK image inputs in pxlcolor/pxlmono

This is part of the enhancement for bug 696905.

pxlcolor/pxlmono is not supposed to be colour-accurate. This change must be
used together with -dUseFastColor=true, or there will be unsighty colour
tiling between image portions under different colour management, or lack of.

No cluster differences

devices/vector/gdevpx.c


2016-08-16 16:24:06 -0700
Ray Johnston <ray.johnston@artifex.com>
0a5e560e38f47b19257debff272adbe3acacbfab

Fix -dDisplayFormat=16#20808 that caused 50% Cyan background with transparency.

This was broken in commit 4e44c99 that added a clist device when transparency
caused MaxBitmap to be exceeded. The values for max_gray and dither_grays in
the color_info for the pdf14_accum_CMYK were incorrectly initialized confusing
the gx_default_encode_color and COLROUND macros.

base/gdevp14.c


2012-04-23 18:14:29 +0100
Robin Watts <robin.watts@artifex.com>
18ef67078eb63103ed5e0de627296cb86f493d42

Bug 696636: New scan converter.

This commit adds a new scan converter implementation designed
to address some of the problems seen with 'busy' paths in the
current implementation.

No 'active line list' is kept, instead we run through the path
generating a buffer of scanline edge intersections. This trades
repeated sorting of the active list against potentially higher
memory usage.

This code has 2 pairs of different variants. Each pair copes
with 'centre of pixel' and 'any part of a pixel' rendering
modes. One pair scan converts to rectangles, another pair to
trapezoids.

These routine does not give identical results to the old code,
partly due to (minimal) rounding issues, but more due to the
fact that the new code is only equivalent to adjust values of
0 or 0.5.

GS uses intermediate adjust values by default (such as 0.3)
when rasterising at low resolution (< 150dpi). In such cases
this new code will cover more than the old code did. It is
hoped that the impact of this is reduced due to the fact we
use freetype for character rendering now.

This new scan converter is disabled by default. To enable it,
set the scanconverter value to be non-zero. This is most easily
achieved by using -dSCANCONVERTERTYPE=1 on the command line.

Runs vastly faster on the cases highlighted in bugs 692351
and 691984.

base/gslibctx.h
base/gspaint.c
base/gxfill.c
base/gxscanc.c
base/gxscanc.h
base/lib.mak
windows/ghostscript.vcproj


2016-08-11 14:12:52 +0100
Robin Watts <robin.watts@artifex.com>
bb689d1d01b339088d89b98b5eabef0c195cfdc4

Scan converter configuration code.

Here, we introduce the notion of "which scan converter are
we using" to the core library. This is an integer value
in gs_lib_ctx_t which (currently) defaults to 1.

We add graphics library calls to get/set this value, and
new operators reflecting these into postscript.

In addition, we update both the PCL frontend and the PS init
code so that -dSCANCONVERTERTYPE can be used on the command
line to set the desired scan converter value.

-dSCANCONVERTERTYPE or -dSCANCONVERTERTYPE=1 will set it to
1. -dSCANCONVERTERTYPE=false or -dSCANCONVERTERTYPE=0 will
set it to 0. Otherwise -dSCANCONVERTERTYPE=<int> will set
it to the required value.

Currently we only have the one scan converter in gs, hence
setting this value makes no difference. A subsequent commit
(probably the very next one) will introduce an alternative
scan converter that will be disabled by default, but can be
enabled by setting this value. This commit merely prepares
the framework for that to fit into.

The intent is that:

0 (or lower) will mean "The old scan converter"
1 will mean "The default scan converter"
2 (or higher) will mean new scan converters yet to be defined.

Thanks to Ken for the postscript code.

Resource/Init/gs_init.ps
base/gslibctx.c
base/gslibctx.h
base/gsstate.c
base/gsstate.h
pcl/pcl/pcstate.h
pcl/pcl/pctop.c
pcl/pl/plmain.c
pcl/pl/plmain.h
pcl/pl/pltop.h
pcl/pxl/pxpthr.c
psi/int.mak
psi/zmisc.c


2016-08-19 16:17:39 +0100
Robin Watts <robin.watts@artifex.com>
1fbbfeb5dc9d1a12c8ed2e4640e59c416450e478

Bug 697056: Fix LCMS static init of critical section.

LCMS2 relies on being able to statically init a mutex
(actually a Critical Section on windows). Windows has
no official API for statically initing a critical
section, so lcms2 uses a hack (albeit it a safe one)
to do this.

Unfortunately ApplicationVerifier (and presumably other
similar tools) don't understand this idiom, and get
confused by not seeing an explicit initialisation call.
This is causing problems for a customer.

This commit therefore introduces code to properly
initialise it on Windows. In order to avoid any possible
multithreaded startup issues, we use the Windows
InterlockedCompareExchangePointer API (introduced in
Windows XP).

If anyone wants to avoid this code (so they can work
on pre-Windows XP), they can build with:

CMS_RELY_ON_WINDOWS_STATIC_MUTEX_INIT

defined, and get the old behaviour. We automatically
set this when building with any version of MSVC older
than VS2005 (i.e. those that don't have that API
available).

lcms2/src/cmsplugin.c
lcms2/src/lcms2_internal.h


2016-08-17 18:40:01 +0100
Robin Watts <robin.watts@artifex.com>
31bdc6bb9587da08d0aecddfee2533e8368706d4

MSVC solution: Reorder files in XML.

MSVC has sorted the list of files alphabetically, and this moved
one. This should be an invisible change.

windows/ghostscript.vcproj


2016-08-17 15:05:02 +0100
Robin Watts <robin.watts@artifex.com>
16fa0fbe02250839ff9c953245b5962a65c816cb

Bug 697044: Fix indeterminism in tiffscaled

When downscaling by a factor of 3, we render at the usual device
width, then take groups of 9 (3*3) pixels to combine them
together.

Externally from the downscaler we were rounding the scaled size
down, whereas internally we were rounding it up.

This means we'd potentially be calculating 1 more pixel than we
actually needed, using some uninitialised data.

Now we round down both internally and externally.

base/gxdownscale.c


2016-08-17 07:46:59 +0100
Chris Liddell <chris.liddell@artifex.com>
7dee0903b551b43e40bfa12aabce1061c0dae171

Change "GPL Ghostscript" to "Ghostscript"

and various other instances of GPL to APGL.

Note that this means changing the product string (Postscript visible),
and all the Windows registry keys we use.

base/gp_wgetv.c
base/gscdef.c
doc/Commprod.htm
doc/Install.htm
doc/Language.htm
doc/Make.htm
doc/Readme.htm
doc/Release.htm
doc/thirdparty.htm
psi/dwreg.c
psi/mkfilelt.cpp
psi/nsisinst.nsi


2016-08-10 11:27:57 -0700
Ray Johnston <ray.johnston@artifex.com>
7eda41b6392a09256447cccbe8b770717f5122f2

Remove the RECT_RECOVER and VMerror retrying logic from the clist

The entire concept relies on recovery by being able to store an entire
page raster image somewhere when the clist writing gets a VMerror, but
if we have room for a page, we could have used page mode in the first
place and totally avoid clist complexity VMerrors. Rip this code out
to make the clist more readable and maintainable.

base/gdevprn.c
base/gdevprn.h
base/gxcldev.h
base/gxclimag.c
base/gxclist.c
base/gxclist.h
base/gxclpath.c
base/gxclrect.c
base/gxclutil.c
devices/gdevbit.c


2016-08-10 07:32:29 -0700
Ray Johnston <ray.johnston@artifex.com>
a1c3ce81d35c869a2385c3f3e08250c484cfb2ab

Remove all traces of the (probably bit-rotted) async renderer

This has mostly been replaced by BGPrint and saved-pages (except for
a queue), but that will be added differently in the future.

base/gdevprn.c
base/gdevprn.h
base/gdevprna.c
base/gdevprna.h
base/gxpageq.c
base/gxpageq.h
base/lib.mak
devices/devs.mak
devices/gdevbit.c
devices/gdevbmpa.c


2016-08-11 14:56:47 +0100
Robin Watts <robin.watts@artifex.com>
ce7245f9b4eb21af76310790ac0f1ec92e237e90

Update PCL command line parser arg handling.

Certain "special" params are interpreted directly by the pcl
build, and handled directly. (Namely, BATCH, NOPAUSE,
NOINTERPOLATE and NOCACHE).

The current code can only cope with these being being used
with no argument. i.e. -dNOINTERPOLATE will be accepted, but
-dNOINTERPOLATE=1 will not trigger the no interpolation code.

Here we change the code so that we now decide whether the arg is
a 'special' one or a normal param at the last moment, and
correctly raise errors if the values are set out of line.

pcl/pl/plmain.c


2016-08-11 14:55:48 +0100
Robin Watts <robin.watts@artifex.com>
f3703d439ebea68be96654e1f74f7e77c62eb823

Fix error/warning in PCL build.

return of a function returning void is not allowed in C,
even though it semantically makes sense.

pcl/pcl/pcwhtidx.c


2016-08-11 17:50:03 +0100
Chris Liddell <chris.liddell@artifex.com>
df3d872f9e561a119eb29e7dcc25d0a466ea4a00

Decrement rather than free reference counted object

Commit b9a265a02b7d1 fixed the unintialised reference count data for the
cie_joint_caches in a temporary gstate created during CIE to ICC conversion.

I hadn't realised it was explicitly freed later on, rather than either
had the ref count decremented, or left to the default gstate freeing to deal
with. This was causing a C lib error on Windows, and a valgrind error on
Linux.

Switching to using the reference counting machinery resolves the problem.

base/gscie.c


2016-08-10 15:55:50 +0100
Ken Sharp <ken.sharp@artifex.com>
684457fff0bb980c719cd40de63b6f322068d9ce

Add a specific licence comment to ramfs.h

base/ramfs.h


2016-08-09 17:12:31 +0100
Chris Liddell <chris.liddell@artifex.com>
7c247cba2ee612b61cad624cb4915d4dbfbb6ce0

Further compensation for Freetype number representation

base/fapi_ft.c


2016-08-08 15:34:27 +0100
Chris Liddell <chris.liddell@artifex.com>
b259a1f93ad59636b9c95a57d86484e53aff47a6

Have configure add flag for AIX large file support

AIX uses a different pre-preprocessor directive to enable access to the >2Gb
file operations (fopen64 etc). Further, adding the AIX one in the same place
as the existing one (base/stdpre.h) does not work.

So, have configure add -D_LARGE_FILES to the CFLAGS on AIX.

configure.ac


2016-08-04 19:12:19 +0100
Chris Liddell <chris.liddell@artifex.com>
63f74ce638cce033f724f42ec9393056c880e37f

Preserve the clump has_refs flag.

refs are handled specially by the garbager and during a restore operation, so
it's worth, during a save, restting the flag if no refs are left in a clump.

*But*, for the garbager to work correctly, we *must* ensure the flag is set
when refs are still in a given clump.

psi/isave.c


2016-08-08 12:34:28 -0700
Ray Johnston <ray.johnston@artifex.com>
12d4dd43bab634a24a4b602e799ea1e550ab769f

Fix global/local VM issue with gstate that b9a265a trips over.

The commit to perform finalization cleanup of gstates had problems at
the alloc_restore_all when global memory was finalized because local
memory was already freed, but there was still "savedinitalgstate" in
systemdict that was in global VM but that had elements that were in
local VM.

Also .forceundef savedinitialgstate in systemdict to avoid leaving
a pointer to localVM from systemdict. This isn't strictly needed
since systemdict isn't ever traced by restore_finalize.

Resource/Init/gs_dps.ps
psi/imain.c


2016-08-08 17:00:54 +0100
Ken Sharp <ken.sharp@artifex.com>
90c660a5e1d45bee0e15ee46bf9c54d19f3f635f

pdfwrite - check return values

picked up by scan-build, I carelessly forgot to check the return value
from pdf_add_resource.

devices/vector/gdevpdfi.c


2016-08-08 13:19:50 +0100
Ken Sharp <ken.sharp@artifex.com>
f7ffeb0319e112a1657987a9e5bad5b0f834a074

pdfwrite - permit nested Forms in PDF output

Bug #696986 "Add support for nested PostScript forms as nested Form XObjects in pdfwrite"

Previously we checked for nested forms and 'unrolled' the child form(s)
into the parent PaintProc. However a simple extension (declaring the
child Form XObject(s) as Resources for the parent) permits us to have
nested forms.

Note that the way our PostScript output (from ps2write) works, it is
not possible to support nested forms, so in this case we continue to
unroll the child PaintProc into the parent. The code works, despite
the inefficiency.

devices/vector/gdevpdfi.c


2016-08-08 13:16:28 +0100
Ken Sharp <ken.sharp@artifex.com>
5f4319612f1837f89b9586a5695018d3554325d8

PosScript interpreter - don't error on nested forms

In commit fa20f5915978823a8c72a80e49fa90ce9c5c5879 I added code to check
if a Form PaintProc illegally left junk on the stack after execution
and cleaned it up if it did (issuing a warning).

However, the code didn't cease checking when it found the first Form
dictionary, which meant that if there were two Form dictionaries on the
stack (nested forms) then we would throw an error.

This commit simply terminates the loop when we find and check a Form
dictionary. If forms are nested then terminating the enclosing form will
lead it to check its own dictionary on the stack and so on.

Resource/Init/gs_lev2.ps


2016-07-27 19:48:39 -0700
Ray Johnston <ray.johnston@artifex.com>
b9a265a02b7d1522fa56a353eb2bd0074ef3c715

Fix memory leak due to PDF interpreter DefaultQstate losing scope

The graphics state is mostly tracked during gsave/grestore operations,
but the 'gstate' operator can result in a graphics state not being
freed until a garbage collection. Add a 'finalization' function for
gstates to deal with this.

The alloc_restore_all function needs to do gs_grestoreall_for_restore
so that the gstates don't end up with dangling pointers, so pass the
interpreter context instead of the dual memory pointer so it can call
that function.

Thanks to Chris for coming up with this approach to the 'finit' freeing,
and finding the fix for a SEGV due missing rc_init in gx_cie_to_xyz_alloc
that affected a couple of PS FTS files.

base/gscie.c
base/gsicc_cache.c
base/gsstate.c
base/gxgstate.h
psi/imain.c
psi/int.mak
psi/isave.c
psi/isave.h
psi/zvmem.c


2016-08-03 11:52:43 -0600
Henry Stiles <henry.stiles@artifex.com>
feaaad91269f7515692f911f29c93b3c4b6d0477

Bug 696983 - Fix bidirectional XPS spacing.

Bidirectional setting was not accounted for when advance width was set
in the XPS Indices Attribute.

xps/xpsglyphs.c


2016-06-15 08:04:41 -0600
Henry Stiles <henry.stiles@artifex.com>
af706ab3fafd2671d30fe82e4ebd431610c15d6c

Fix Coverity ID 102148, buffer not terminated.

Also, require the client to pass in a file name without spaces as a
routine precondition instead of trying to replace spaces with
underscores each time a font is built.

Note gs_font_name is a ghostscript string with a size but also requires
null termination, see the typedef's header file.

pcl/pcl/pglabel.c
pcl/pl/plfont.c
pcl/pl/pllfont.c
pcl/pl/plufont.c
pcl/pl/plulfont.c


2016-08-03 16:33:14 +0100
Ken Sharp <ken.sharp@artifex.com>
deac5c942561bc044499987e86aa46eaa7abd495

pdfwrite - don't complain about linearising encrypted files, when not linearinsing

devices/vector/gdevpdfp.c


2016-07-11 10:36:27 -0700
Ray Johnston <ray.johnston@artifex.com>
093bd18bd923644fcd25c507088c0ebc63b4c320

Support CompatibleOverprint in the interpreter (bug 696876)

If the device is not a HighLevelDevice and the device supports
overprint (ProcessColorModel == /DeviceCMYK) then transparency needs
to treat painting operations differently by pushing a non-isolated,
non-knockout group and set the BlendMode to CompatibleOverprint.
Also the opacityalpha needs to be 1 during painting in this group.

Note that although the interpreter now has code for fill, stroke,
'sh' (shaded fills), text and images, our regression suite does
not seem to have OP with transparency for the 'sh' op (yet).
Out of all of our PDF test files, only 21 trigger this code
(including all of the PDF ATS files that are not run as part of
the commit regression tests.

Resource/Init/pdf_draw.ps
Resource/Init/pdf_main.ps
Resource/Init/pdf_ops.ps


2016-07-25 11:29:17 -0700
Ray Johnston <ray.johnston@artifex.com>
82e37a2d3309381ca55cde3a5515ab8aa61e3ebe

Bug696876: Fix overprint blending when CompatibleOverprint mode not used.

base/gxblend1.c


2016-07-29 18:19:33 +0100
Robin Watts <robin.watts@artifex.com>
cc393ffc7b748c8f053eaf4028e8cf130fabbbf7

Revised gx_subpath_is_rectangular.

This copes with more cases. For a given rectangle A, B, C, D, the
original code coped with:

Move A, Line B, Line C, Line D, close
Move A, Line B, Line C, Line D, Move E, ...
Move A, Line B, Line C, Line D, Line A
Move A, Line B, Line C, Line D, Line A, Close
Move A, Line B, Line C, Line D, Line A, Move E

(and the flipped variants)

We now cope with other cases including repeated corners:

Move A, Line B, Line B, Line C, Line D, close

etc

and the case where the lines are curves that are really lines.

base/gxpath.h
base/gxpath2.c


2016-08-01 10:34:45 +0100
Ken Sharp <ken.sharp@artifex.com>
1e214a7382f35f52ae1efe2b53169704913e4df5

pdfwrite - don't coerce Dests from strings to names unless required

Bug #696974 "GS pdfwrite seems to break /GoToR's destination names /D"

We were always altering GoTo and GoToR Destinations from strings into
names, because string Dests are a PDF 1.2 feature. However its not
always possible to represent a string (eg Unicode) as a name.

In this commit we don't try to force the Dest into a name unless the
PDF level is < 1.2 and if we do try to coerce it, we check to see if it
can be represented. If not we throw an error and drop the Dest.

devices/vector/gdevpdfm.c


2016-07-29 17:06:47 +0100
Robin Watts <robin.watts@artifex.com>
f885f6395594fc52c81075ebf7698ecd5bd09e6c

Add some parentheses to clarify interpolation condition.

base/gxiscale.c


2016-07-29 17:06:17 +0100
Robin Watts <robin.watts@artifex.com>
ca7d98064b32f4ad216732dc1523016a67878b26

Include gximage.h for prototype of gx_image_compute_mat

base/gsimage.c
base/lib.mak


2016-07-29 15:48:43 +0100
Robin Watts <robin.watts@artifex.com>
7f8c86ebfc9efbb63df4898f15f93a705ff3ceaf

Remove Visual Debugger

base/gdevddrw.c
base/gdevdsha.c
base/gdevm24.c
base/gdevmr8n.c
base/gdevp14.c
base/gsimage.c
base/gxblend.h
base/gxblend1.c
base/gxclread.c
base/gxdtfill.h
base/gxfill.c
base/gxfillsl.h
base/gxfilltr.h
base/gxfillts.h
base/gxhintn.c
base/gxhintn1.c
base/gxi12bit.c
base/gximono.c
base/gxiscale.c
base/gxpath.c
base/gxpcopy.c
base/gxpflat.c
base/gxshade1.c
base/gxshade4.c
base/gxshade6.c
base/gxstroke.c
base/gzspotan.c
base/lib.mak
base/vdtrace.c
base/vdtrace.h
pcl/pl/plmain.c
pcl/pl/plwmainc.c
psi/dmmain.c
psi/dwdll.c
psi/dwdll.h
psi/dwmain.c
psi/dwmainc.c
psi/dwnodll.c
psi/dwtrace.c
psi/dwtrace.h
psi/gsdll32.def
psi/gsdll32metro.def
psi/gsdll64.def
psi/gsdll64metro.def
psi/gsdllARM32metro.def
psi/iapi.c
psi/iapi.h
psi/imainarg.c


2016-07-29 14:52:46 +0100
Robin Watts <robin.watts@artifex.com>
d98f2adc027cd995b3c66e9dddd1d2fdad18e946

Remove pseudo_rasterization.

I'ts not used any more, and is just extra complexity that we don't
need.

base/gdevddrw.h
base/gxfdrop.c
base/gxfdrop.h
base/gxfill.c
base/gxfill.h
base/gxfilltr.h
base/gzspotan.c
base/lib.mak


2016-07-29 13:26:39 +0100
Robin Watts <robin.watts@artifex.com>
4639fe50f8037a35b981ed239aa5cdf1a30a19ed

Skip 0 length edges when filling.

In theory, a zero length edge shouldn't make any difference
to the appearance of a path. In practice, they appear as
horizontal edges, and so can trip the code in gxfilltr.h that's
labelled as:

/*
* This is a hack to make sure that isolated horizontal
* lines get stroked.
*/

That code is only called for !PSEUDO_RASTERIZATION.

There is code in gxfill.c that ignores zero length edges, but
this is currently conditional on pseudo_rasterization being
turned on.

As I understand it, PSEUDO_RASTERISATION is 1 when we are
plotting chars, and should never be so anymore. The idea is that
PSEUDO_RASTERISATION prevents dropouts in characters, hence it
feels wrong that any code that has this on should plot LESS than
code with it off.

I suspect that Igor got the test the wrong way around here.

I am just removing the test, and always ignoring 0 length edges.

base/gxfill.c


2016-07-29 13:40:45 +0100
Ken Sharp <ken.sharp@artifex.com>
bd0df3ce9e72315f54d857f4de028da79412802f

Fix FirstPage/LastPage for non-PDF input

Robin spotted this one. When I added the page ranges code to augment
the existing First/Last page functionality I moved the code which
decided whether an operation was destined for a page which was being
output into a single routine. Previously this was simple code which
was replicated in each method, but the added complexity meant it was
better handled centrally.

However, when doing so I accidentally dropped the '-1' from the First
and Last Page tests (PageCount starts from 0) which meant these were
off by one throughout.

Added these back in here.

base/gdevflp.c


2016-07-26 20:31:06 -0700
Michael Vrhel <michael.vrhel@artifex.com>
8e901f44bdfcee1855378bdd6e26989fa294c8d5

Fix DeviceGrayToK. Bug 696875

By default we have -dDeviceGrayToK=true map all gray source
colors directly to the K channel when the Device is CMYK based.
This fix changes it so that Ghostscript matches Acrobat and
Distiller and does this mapping only if the source color
was truly defined as DeviceGray.

The file in Bug 696875 has the property that it has a gray image
whose color space is DefaultGray, which references an ICC color
space. This color space was being treated as DeviceGray by
Ghostscript but it really should be color managed and not
treated as DeviceGray since it is ICC based.

There are several progressions in the test suite assuming the
reference is Acrobat. The differences are caused by the fact
that gray sources that are not DeviceGray are now color
managed.

base/gsicc_cache.c


2016-07-27 12:11:13 +0100
Chris Liddell <chris.liddell@artifex.com>
200b1450b99ec4f1d3b7356b8497ff57da5460f3

Remove leftover debugging code (pstack)

Resource/Init/pdf_rbld.ps


2016-07-27 08:54:40 +0100
Ken Sharp <ken.sharp@artifex.com>
a2e50179a29ffa30f332bd19ab7b0ca50e4bc933

PDF interpreter - fix some typos

Ray noticed that the (future proofing) code to handle a 're' inside
a text block had a typo. We haven't ever encountered such a thing, the
code is there so that when we do encoutner one it will just work.

No differences expected.

Resource/Init/pdf_ops.ps


2016-07-26 18:28:52 +0100
Robin Watts <robin.watts@artifex.com>
337167e66a8edf08fc65826afdcf62cede445dc1

Fix windows_debug_out.

Simplified code that properly copes with strings longer than
4096.

Thanks to Ray for spotting the problem(s) with the last one.

psi/dwmainc.c


2016-07-25 17:57:56 +0100
Robin Watts <robin.watts@artifex.com>
016eeca9b2136d322d15f8add7bb207e61bfdb8c

Fix Memento bug.

When hunting for the block that contains a pointer, if we can't find
one, return NULL, not the unchanged pointer!

base/memento.c


2016-07-25 16:51:03 +0100
Robin Watts <robin.watts@artifex.com>
eb30a6927cf172c45bda4717a8bb8e21e7a5fe95

Import latest Memento from MuPDF.

Reintroduce the Memento_tick, and Mememto_event changes which haven't
made it to MuPDF yet.

base/memento.c
base/memento.h


2016-07-25 17:57:15 +0100
Robin Watts <robin.watts@artifex.com>
2858aea017d933b2187d6eb5ac5718f0a45f3ca1

Fix silly mistake in Windows OutputDebugString code.

psi/dwmainc.c


2016-07-26 11:18:46 +0100
Ken Sharp <ken.sharp@artifex.com>
05bdaafd166a22797dc7f58e74d415081e00d469

PDF interpreter - handle PageLabels where the number tree starts with Kids

Bug #696947 "Regression: Error: /undefined in --run-- writing pdf file starting with 5784bfbfba7191cacce5309e88afac0851287460"

This is not really a regression, exactly. Prior to the commit noted
above we discarded PageLabels, the commit added the ability to preserve
these.

However, we had a limited number of available files to test from, and
this particular file is the first one I have encountered where the
number tree defining the page ranges begins with a number tree node
which has /Kids but no /Nums (Table 3.34, p166 of the 1.7 specification
says that the Root node may have /Kids only if there are no /Nums)

I did code to cope with this but there was a minor flaw in the code,
fixed here, which we lacked a test case for.

Note that, although the specification says on p595 that the value of
the PageLabels entry in the Catalog is a number tree, this file neatly
exposes a probable bug in Acrobat. If the root of the number tree has
no /Nums, but does have /Kids (which is valid for a number tree, see
above) then Acrobat X does not display the PageLabels.

This probably explains why we have never seen such a file before.

For now I have chosen to permit the number tree to have /Kids, if in
the future we need to revise this to behave like Acrobat we can do so.

This does have the interesting side effect that if the file is sent to
the pdfwrite device (and there is no other device which can use
PageLabels) the resulting PDF file will have working labels, where the
original does not.

No differences expected

Resource/Init/gs_pdfwr.ps


2016-07-22 15:44:43 -0600
Henry Stiles <henry.stiles@artifex.com>
6f1da3c990ab7de4c3218bf8beff21f19449b284

Update PCL fonts and font table.

Replace old URW fonts and update the font table with the new font
names.

pcl/pl/plftable.h
pcl/urwfonts/A028-Ext.ttf
pcl/urwfonts/A028-Med.ttf
pcl/urwfonts/A030-Bol.ttf
pcl/urwfonts/A030-BolIta.ttf
pcl/urwfonts/A030-Ita.ttf
pcl/urwfonts/A030-Reg.ttf
pcl/urwfonts/Algiers-ExtraBold.ttf
pcl/urwfonts/Algiers-Medium.ttf
pcl/urwfonts/AntiqueOlive-Bol.ttf
pcl/urwfonts/AntiqueOlive-Bold.ttf
pcl/urwfonts/AntiqueOlive-Ita.ttf
pcl/urwfonts/AntiqueOlive-Italic.ttf
pcl/urwfonts/AntiqueOlive-Reg.ttf
pcl/urwfonts/AntiqueOlive-Regular.ttf
pcl/urwfonts/C011Condensed-Bold.ttf
pcl/urwfonts/C059-BdIta.ttf
pcl/urwfonts/C059-Bold.ttf
pcl/urwfonts/C059-Italic.ttf
pcl/urwfonts/C059-Roman.ttf
pcl/urwfonts/C093-Regular.ttf
pcl/urwfonts/CenturySchL-Bold.ttf
pcl/urwfonts/CenturySchL-BoldItal.ttf
pcl/urwfonts/CenturySchL-Ital.ttf
pcl/urwfonts/CenturySchL-Roma.ttf
pcl/urwfonts/ClarendonURW-BolCon.ttf
pcl/urwfonts/Coronet.ttf
pcl/urwfonts/D050000L.ttf
pcl/urwfonts/Dingbats.ttf
pcl/urwfonts/Garamond-Antiqua.ttf
pcl/urwfonts/Garamond-Halbfett.ttf
pcl/urwfonts/Garamond-Kursiv.ttf
pcl/urwfonts/Garamond-KursivHalbfett.ttf
pcl/urwfonts/GaramondNo8-Ita.ttf
pcl/urwfonts/GaramondNo8-Med.ttf
pcl/urwfonts/GaramondNo8-MedIta.ttf
pcl/urwfonts/GaramondNo8-Reg.ttf
pcl/urwfonts/LetterGothic-Bol.ttf
pcl/urwfonts/LetterGothic-Bold.ttf
pcl/urwfonts/LetterGothic-Ita.ttf
pcl/urwfonts/LetterGothic-Italic.ttf
pcl/urwfonts/LetterGothic-Reg.ttf
pcl/urwfonts/LetterGothic-Regular.ttf
pcl/urwfonts/Mauritius-Reg.ttf
pcl/urwfonts/Mauritius-Regular.ttf
pcl/urwfonts/NewDingbats.ttf
pcl/urwfonts/NimbusMonL-Bold.ttf
pcl/urwfonts/NimbusMonL-BoldObli.ttf
pcl/urwfonts/NimbusMonL-Regu.ttf
pcl/urwfonts/NimbusMonL-ReguObli.ttf
pcl/urwfonts/NimbusMono-Bol.ttf
pcl/urwfonts/NimbusMono-BolIta.ttf
pcl/urwfonts/NimbusMono-Bold.ttf
pcl/urwfonts/NimbusMono-BoldItalic.ttf
pcl/urwfonts/NimbusMono-Ita.ttf
pcl/urwfonts/NimbusMono-Italic.ttf
pcl/urwfonts/NimbusMono-Reg.ttf
pcl/urwfonts/NimbusMono-Regular.ttf
pcl/urwfonts/NimbusMonoPS-Bold.ttf
pcl/urwfonts/NimbusMonoPS-BoldItalic.ttf
pcl/urwfonts/NimbusMonoPS-Italic.ttf
pcl/urwfonts/NimbusMonoPS-Regular.ttf
pcl/urwfonts/NimbusRomNo9L-Medi.ttf
pcl/urwfonts/NimbusRomNo9L-MediItal.ttf
pcl/urwfonts/NimbusRomNo9L-Regu.ttf
pcl/urwfonts/NimbusRomNo9L-ReguItal.ttf
pcl/urwfonts/NimbusRoman-Bold.ttf
pcl/urwfonts/NimbusRoman-BoldItalic.ttf
pcl/urwfonts/NimbusRoman-Italic.ttf
pcl/urwfonts/NimbusRoman-Regular.ttf
pcl/urwfonts/NimbusRomanNo4-Bol.ttf
pcl/urwfonts/NimbusRomanNo4-BolIta.ttf
pcl/urwfonts/NimbusRomanNo4-Bold.ttf
pcl/urwfonts/NimbusRomanNo4-BoldItalic.ttf
pcl/urwfonts/NimbusRomanNo4-Italic.ttf
pcl/urwfonts/NimbusRomanNo4-Lig.ttf
pcl/urwfonts/NimbusRomanNo4-LigIta.ttf
pcl/urwfonts/NimbusRomanNo4-Regular.ttf
pcl/urwfonts/NimbusRomanNo9-Bold.ttf
pcl/urwfonts/NimbusRomanNo9-BoldItalic.ttf
pcl/urwfonts/NimbusRomanNo9-Ita.ttf
pcl/urwfonts/NimbusRomanNo9-Italic.ttf
pcl/urwfonts/NimbusRomanNo9-Med.ttf
pcl/urwfonts/NimbusRomanNo9-MedIta.ttf
pcl/urwfonts/NimbusRomanNo9-Reg.ttf
pcl/urwfonts/NimbusRomanNo9-Regular.ttf
pcl/urwfonts/NimbusSanL-Bold.ttf
pcl/urwfonts/NimbusSanL-BoldCond.ttf
pcl/urwfonts/NimbusSanL-BoldCondItal.ttf
pcl/urwfonts/NimbusSanL-BoldItal.ttf
pcl/urwfonts/NimbusSanL-Regu.ttf
pcl/urwfonts/NimbusSanL-ReguCond.ttf
pcl/urwfonts/NimbusSanL-ReguCondItal.ttf
pcl/urwfonts/NimbusSanL-ReguItal.ttf
pcl/urwfonts/NimbusSans-Bold.ttf
pcl/urwfonts/NimbusSans-BoldOblique.ttf
pcl/urwfonts/NimbusSans-Oblique.ttf
pcl/urwfonts/NimbusSans-Regular.ttf
pcl/urwfonts/NimbusSansNarrow-BdOblique.ttf
pcl/urwfonts/NimbusSansNarrow-Bold.ttf
pcl/urwfonts/NimbusSansNarrow-Oblique.ttf
pcl/urwfonts/NimbusSansNarrow-Regular.ttf
pcl/urwfonts/NimbusSansNo2-Bold.ttf
pcl/urwfonts/NimbusSansNo2-BoldItalic.ttf
pcl/urwfonts/NimbusSansNo2-Italic.ttf
pcl/urwfonts/NimbusSansNo2-Regular.ttf
pcl/urwfonts/P052-Bold.ttf
pcl/urwfonts/P052-BoldItalic.ttf
pcl/urwfonts/P052-Italic.ttf
pcl/urwfonts/P052-Roman.ttf
pcl/urwfonts/StandardSymL.ttf
pcl/urwfonts/StandardSymbolsPS.ttf
pcl/urwfonts/Symbols.ttf
pcl/urwfonts/U001-Bol.ttf
pcl/urwfonts/U001-BolIta.ttf
pcl/urwfonts/U001-Ita.ttf
pcl/urwfonts/U001-Reg.ttf
pcl/urwfonts/U001Con-Bol.ttf
pcl/urwfonts/U001Con-BolIta.ttf
pcl/urwfonts/U001Con-Ita.ttf
pcl/urwfonts/U001Con-Reg.ttf
pcl/urwfonts/URWBookman-Demi.ttf
pcl/urwfonts/URWBookman-DemiItalic.ttf
pcl/urwfonts/URWBookman-Light.ttf
pcl/urwfonts/URWBookman-LightItalic.ttf
pcl/urwfonts/URWBookmanL-DemiBold.ttf
pcl/urwfonts/URWBookmanL-DemiBoldItal.ttf
pcl/urwfonts/URWBookmanL-Ligh.ttf
pcl/urwfonts/URWBookmanL-LighItal.ttf
pcl/urwfonts/URWChanceryL-MediItal.ttf
pcl/urwfonts/URWClassicSans-Bold.ttf
pcl/urwfonts/URWClassicSans-BoldItalic.ttf
pcl/urwfonts/URWClassicSans-Regular.ttf
pcl/urwfonts/URWClassicSans-RegularIt.ttf
pcl/urwfonts/URWClassicSansCond-BdItalic.ttf
pcl/urwfonts/URWClassicSansCond-Bold.ttf
pcl/urwfonts/URWClassicSansCond-Italic.ttf
pcl/urwfonts/URWClassicSansCond-Regular.ttf
pcl/urwfonts/URWClassico-Bol.ttf
pcl/urwfonts/URWClassico-BolIta.ttf
pcl/urwfonts/URWClassico-Bold.ttf
pcl/urwfonts/URWClassico-BoldItalic.ttf
pcl/urwfonts/URWClassico-Ita.ttf
pcl/urwfonts/URWClassico-Italic.ttf
pcl/urwfonts/URWClassico-Reg.ttf
pcl/urwfonts/URWClassico-Regular.ttf
pcl/urwfonts/URWDings.ttf
pcl/urwfonts/URWGothic-Book.ttf
pcl/urwfonts/URWGothic-BookOblique.ttf
pcl/urwfonts/URWGothic-Demi.ttf
pcl/urwfonts/URWGothic-DemiOblique.ttf
pcl/urwfonts/URWGothicL-Book.ttf
pcl/urwfonts/URWGothicL-BookObli.ttf
pcl/urwfonts/URWGothicL-Demi.ttf
pcl/urwfonts/URWGothicL-DemiObli.ttf
pcl/urwfonts/URWPalladioL-Bold.ttf
pcl/urwfonts/URWPalladioL-BoldItal.ttf
pcl/urwfonts/URWPalladioL-Ital.ttf
pcl/urwfonts/URWPalladioL-Roma.ttf
pcl/urwfonts/Z003-MediumItalic.ttf


2016-07-25 11:16:37 +0100
Ken Sharp <ken.sharp@artifex.com>
8fedc1d7a098481e6607ffb6ef4612f18b68ed95

High level devices - handle 12 BPC image data

Bug #696944 "Lockup with pdfwrite device"

This appears to be a bug of very long standing and points up our previous
lack of image test files in the cluster runs, since it hasn't emerged
before.

The high level image stream code did not properly handle 12 bit data,
In s_compr_chooser__unpack_and_recognize() we ended up with 8 bits of
data remaining, which is not less than 8, but because the input size is
12 bits it is also not > the bits per sample. This led to an infinite
loop trying to read data at the end of a line.

Here we change the '<' to '<=' to properly detect the end of input, so
we don't fall into this trap of assuming samples are 8 BPC.

devices/vector/gdevpsds.c


2016-07-14 15:29:23 -0700
Michael Vrhel <michael.vrhel@artifex.com>
49ba79c5c27129cc0f47b150c49363b3ab3b1b63

Add support for -sPostRenderProfile="icc profile" to tiffscaled devices

With this commit, it is possible to have the tiffscaled32, tiffscaled24
and tiffscaled8 devices apply an ICC profile after rendering, which
will transform the rendered page to the color space defined by
PostRenderProfile. When used in conjunction with -dUsePDFX3Profile,
if the source file contains an Output Intent profile, the page will
be rendered first to the color space defined by the output intent profile and then
transformed to the color space defined by the PostRenderProfile setting. In this
way, we can avoid issues caused by mismatching ICC profiles in overprint
situations. This along with the commit http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=0df325b4bdbd037c92e2528fc16900de84f8d9c1
are needed to create a patch.

base/gxdownscale.c
base/gxdownscale.h
devices/devs.mak
devices/gdevpng.c
devices/gdevtfnx.c
devices/gdevtifs.c
devices/gdevtifs.h
devices/gdevtsep.c


2016-07-22 12:01:29 +0100
Robin Watts <robin.watts@artifex.com>
d89f998d1008d693592f4c69ccf92085aa277060

Send stdout/stderr to windows debug console too.

When debugging in MSVC it's much easier to watch the output pane
rather than the terminal window.

psi/dwmainc.c


2016-07-21 16:26:29 +0100
Ken Sharp <ken.sharp@artifex.com>
6a3790308268f70e1be29eb8cca0c0e55711ef67

PDF interpreter - treat invalid BaseEncoding as a missing BaseEncoding

Bug #696942 "Missing content reading PDF file"

The file contains Encoding dictionaries which contain BaseEncoding
entries which are invalid, one is '/utf-8' the other is '/'. We already
checked for '/' and ignored it, and we already checked named Encodings
against the permissible list of Encodings, so here we just extend the
checks for BaseEncoding to see if a named BaseEncoding is in the list
pf permitted names.

No differences expected.

Resource/Init/pdf_font.ps


2016-07-21 13:01:12 +0100
Ken Sharp <ken.sharp@artifex.com>
e5326d42115f162d906415bdf3b5cbcba1cb477d

Fix an inline function for storing 12-bit image data

Bug #696940 " crash with 12-bit type 3 images"

When I removed the 'load' and 'store' macros from the graphics library
code, replacing with static inline functions commit
d5008bf9092e99b5eb7f295c9d684850bf2aa66f I made an error. There was
a 'break' missed in the 12 bit store function.

We should probably add image-qa.ps to our test files for the cluster.

base/gsbitops.h


2016-07-20 17:16:22 +0100
Chris Liddell <chris.liddell@artifex.com>
19931aea2fb8e6e72f58806836f0e769cd3139dd

Fix position of 'const' modifier

base/genconf.c


2016-07-19 23:58:16 +0300
Boris Nagaev <bnagaev@gmail.com>
3e5f8d3267e8abf3330da15fa6c159dd067bedc3

Fix the --disable-contrib option for out-of-tree builds

The grep to exclude contrib/contrib.mak was not lenient enough to handle
srcdir!=dstdir.

configure.ac


2016-07-20 12:50:55 +0100
Chris Liddell <chris.liddell@artifex.com>
7795d6d4a30d923bd3c11f4dd27b86617c15f1bd

Bug 696937: readhexstring handle signed/unsigned char

When readhexstring runs out of data, we overload an integer ref with the
number of bytes from the input buffer used, and the value of a trailing
odd numbered byte shifted to the top 8 bits of the integer value. If no
trailing byte was read, the value is set to -1.

When restarting readhexstring with a full buffer, we relied on casting to
char to retrieve the signed value from the top 8 bits on the integer ref.

Unfortunately, unqualified chars are not signed on all platforms, and on
platforms where chars are unsigned, we ended up with an invalid value.

So, have the casting use qualified (signed/unsigned) chars for writing and
reading back the value.

To make this neater, and consistent, add an "schar" type to match the existing
"uchar" type.

base/stdpre.h
psi/zfileio.c


2016-07-20 12:50:22 +0100
Chris Liddell <chris.liddell@artifex.com>
49c7c0ec017baa0fe1708e185586859d9188dd2a

Remove some debugging code.

Resource/Init/gs_ttf.ps


2016-07-20 11:38:09 +0100
Robin Watts <robin.watts@artifex.com>
97a2fc7002bbaecdaa9673fc59e0929d8f61e36b

Silence warning.

base/gsfunc0.c


2016-07-19 15:20:53 +0100
Robin Watts <robin.watts@artifex.com>
d512fd15d80625557c5a3c494d7a86b89ffa5bd3

Fix debug builds.

Code I modified yesterday broke the debug printfs.

psi/isave.c


2016-07-18 18:56:50 +0100
Robin Watts <robin.watts@artifex.com>
e21bbf5f9ca6d0a75a18342cb951608ad072cddf

Bug 696837: Improve performance of memory searches.

The swap to use splay trees reduces the performance of this
file from 11 seconds to 25 seconds for me.

This is due to the additional complexity of traversing a
more complex memory structure. The hope is that in the average
case we'll do better (or at least no worse), and that we'll
make gains in more pathological cases.

It turns out that in alloc_is_since_save I was failing to
actually make use of the fact that the new structure is
sorted and can hence be searched much more efficiently.

Do that here. This gets performance back to 17 seconds - so
still a net loss, but less so.

base/gsalloc.c
base/gxalloc.h
psi/isave.c


2016-07-18 18:53:22 +0100
Robin Watts <robin.watts@artifex.com>
702bc7f6b3f0634daae556a4a2c27fae44d80300

Fix stray result of global replace.

base/gsalloc.c


2016-07-15 18:39:56 +0100
Robin Watts <robin.watts@artifex.com>
0df325b4bdbd037c92e2528fc16900de84f8d9c1

Add color management hooks for downscaler.

base/gxdownscale.c
base/gxdownscale.h


2016-07-18 10:03:24 -0600
Henry Stiles <henry.stiles@artifex.com>
2e7642ca7abdddc7fba5ab2a6450f1fc7dad62eb

Fix 696933 interpreter exit.

The PXL output device did not take into account transparency when
checking if the destination was needed.

devices/devs.mak
devices/vector/gdevpx.c


2016-07-18 13:03:35 +0100
Ken Sharp <ken.sharp@artifex.com>
00c81b3dd0dfd918168a56741c56920331890319

txtwrite - fix a conversion from bytes to shorts

Bug 696935 "SEGV in txtwrite"

When I modified the ToUnicode processing to return more than a single
code point for a given glyph, I altered the code to return a required
buffer size (or count of bytes copied). Txtwrite wanted a count of code
pints (always 2 bytes for ToUnicode) and so I should have divided the
return value by the size of a short. For some reason I multiplied it
instead, I have no idea what I was thinking of.....

I couldn't reproduce a SEGV but since this was a buffer overrun problem
it would depend on the memory layout. With this fix the text is once
again sensible, and Robin reports the SEGV has gone away.

devices/vector/gdevtxtw.c


2016-07-15 09:00:05 -0700
Ray Johnston <ray.johnston@artifex.com>
03ef4a5345cf996270679bc3c3e9103991bd8d24

Fix previous commit that was missing most of the changes.

base/gxacpath.c
base/gxclip.c


2016-07-12 14:55:28 -0700
Ray Johnston <ray.johnston@artifex.com>
9c2d7369994b7b3c4b7204c7e6fe11b34e243037

Fix problems with commit fd34a32 (bug 696841) which transposed clip

Even though the transposition of clip paths commit fd34a32 didn't
turn up any differences, it had problems, some spotted by desk check
and some as a result of testing the customer file and debug.

First, the accum_fill_rectangle needs to transpose coordinates. Then
the clip device must transpose coordinates when comparing to rectangles
in the list. The clip_enumerate function and the procedures that open
code checks against rdev->current transpose the coordinates. If they
need to call clip_enumerate_rest it is with transposed values. The
coordinates in the ccdata structure are non-transposed.

It was surprising when the previous commit didn't show any problems
(my trust in the regression test took a hit).

base/gxclip.c


2016-07-14 18:54:36 +0100
Robin Watts <robin.watts@artifex.com>
762afc5e23d658345ac0484e9eeb0186d340803c

MSVC: Tweak makefile so .pdb files go in the obj directory

This avoids them going at the top, and hence makes cleaning etc
easier.

base/msvccmd.mak


2016-07-14 11:31:31 +0100
Ken Sharp <ken.sharp@artifex.com>
fd1b84560536076f655421e98a27e58d2881ca70

XPS interpreter - fix 'synthetic bold' text style

Bug 696914 "Large black objects in output with pdfwrite device"

The problem here is that the XPS interpreter, when creating a synthetic
bold font, merely set the text rendering mode to 2 (fill and stroke),
assuming that the graphics library would deal with this.

However, the graphics library does not care about text rendering modes
at all. The graphics state parameter is used only by the high level
devices and (apart from this instance) only be the PDF interpreter. When
the PDF interpreter encounters a text rendering mode other than 0 it
checks the device to see whether it wants text rendering modes preserved.
If it does, then the interpreter simply sets the mode and does nothing
else. If, however, the device does not want the mode preserved, then the
PDF interpreter breaks the text rendering mode into its component
operations.

This commit adds the same functionality to the XPS interpreter. It seems
that the XPS interpreter only uses this for synthetic bold, and so only
uses Tr 2. So the code now checks with the device to see if it wants
the mode preserved, if it does, we simply leave it (but see below).
Otherwise, we stroke the text, and then draw it normally (fill). This
means that the artificial bold text is now actually drawn bold.

There is one slight complication. When stroking a path the pdfwrite device
takes care to undo the scaling done by the CTM from the stroke width.
But when using a text render mode, it does not do so, it uses the
line width 'as is'. The XPS interpreter sets the line width including
the CTM (which is correct for stroking), so we need to 'undo' the CTM
applied to the line width before we draw the text, when we are preserving
the text rendering mode.

xps/ghostxps.h
xps/xpsglyphs.c


2016-07-13 08:13:09 -0600
Henry Stiles <henry.stiles@artifex.com>
1d3ee57f5a57bb68d0693ca11fafdedd1f2249f5

Images of 0 area caused division by 0.

We now let the default begin image procedure handle this case.

devices/vector/gdevpx.c


2016-04-08 14:46:06 +0100
Chris Liddell <chris.liddell@artifex.com>
c8342b4a7b6cdcc4cb1261bf2b008f6df257b5c6

URW++ update to base 35 from June 2016.

This extends the Greek and Cyrillic glyphs originally supplied in only three
font families to cover all the relevant fonts in the base 35.

These remain covered by the GPL with the embedding exemption.

Resource/Font/C059-BdIta
Resource/Font/C059-Bold
Resource/Font/C059-Italic
Resource/Font/C059-Roman
Resource/Font/CenturySchL-Bold
Resource/Font/CenturySchL-BoldItal
Resource/Font/CenturySchL-Ital
Resource/Font/CenturySchL-Roma
Resource/Font/D050000L
Resource/Font/Dingbats
Resource/Font/NimbusMono-Bold
Resource/Font/NimbusMono-BoldOblique
Resource/Font/NimbusMono-Oblique
Resource/Font/NimbusMono-Regular
Resource/Font/NimbusMonoPS-Bold
Resource/Font/NimbusMonoPS-BoldItalic
Resource/Font/NimbusMonoPS-Italic
Resource/Font/NimbusMonoPS-Regular
Resource/Font/NimbusRomNo9L-Med
Resource/Font/NimbusRomNo9L-MedIta
Resource/Font/NimbusRomNo9L-Reg
Resource/Font/NimbusRomNo9L-RegIta
Resource/Font/NimbusRoman-Bold
Resource/Font/NimbusRoman-BoldItalic
Resource/Font/NimbusRoman-Italic
Resource/Font/NimbusRoman-Regular
Resource/Font/NimbusSanL-Bol
Resource/Font/NimbusSanL-BolIta
Resource/Font/NimbusSanL-BoldCond
Resource/Font/NimbusSanL-BoldCondItal
Resource/Font/NimbusSanL-Reg
Resource/Font/NimbusSanL-RegIta
Resource/Font/NimbusSanL-ReguCond
Resource/Font/NimbusSanL-ReguCondItal
Resource/Font/NimbusSans-Bold
Resource/Font/NimbusSans-BoldOblique
Resource/Font/NimbusSans-Oblique
Resource/Font/NimbusSans-Regular
Resource/Font/NimbusSansNarrow-BdOblique
Resource/Font/NimbusSansNarrow-Bold
Resource/Font/NimbusSansNarrow-Oblique
Resource/Font/NimbusSansNarrow-Regular
Resource/Font/P052-Bold
Resource/Font/P052-BoldItalic
Resource/Font/P052-Italic
Resource/Font/P052-Roman
Resource/Font/StandardSymL
Resource/Font/StandardSymbolsPS
Resource/Font/URWBookman-Demi
Resource/Font/URWBookman-DemiItalic
Resource/Font/URWBookman-Light
Resource/Font/URWBookman-LightItalic
Resource/Font/URWBookmanL-DemiBold
Resource/Font/URWBookmanL-DemiBoldItal
Resource/Font/URWBookmanL-Ligh
Resource/Font/URWBookmanL-LighItal
Resource/Font/URWChanceryL-MediItal
Resource/Font/URWGothic-Book
Resource/Font/URWGothic-BookOblique
Resource/Font/URWGothic-Demi
Resource/Font/URWGothic-DemiOblique
Resource/Font/URWGothicL-Book
Resource/Font/URWGothicL-BookObli
Resource/Font/URWGothicL-Demi
Resource/Font/URWGothicL-DemiObli
Resource/Font/URWPalladioL-Bold
Resource/Font/URWPalladioL-BoldItal
Resource/Font/URWPalladioL-Ital
Resource/Font/URWPalladioL-Roma
Resource/Font/Z003-MediumItalic
Resource/Init/Fontmap.GS
psi/psromfs.mak


2016-07-12 10:30:58 +0100
Ken Sharp <ken.sharp@artifex.com>
a086f21714dbcb710d698bb2b47ac7a9e3ce89db

pdfwrite - fix PDF/X-3 Box emission when boes supplied via pdfmark

Bug #696919 " Wrong TrimBox and Metadata not allowed in PDF/X-3 conversion"

The code to calculate, check and emit the various Boxes when creating
PDF/X output relied upon the mediabox array contents being set. However
this array was initialised to 0, and not set correctly. I suspect this
has been altered at some time in the past, since we now use a temporary
array of floats (instead of doubles) to store and emit the MediaBox.

The upshot of this is that we were writing just the differences from
the MediaBox instead of the full Box values.

No differences expected, the cluster doesn't test PDF/X-3 creation

devices/vector/gdevpdf.c


2016-07-12 10:25:06 +0100
Ken Sharp <ken.sharp@artifex.com>
9f2e9ea89e35b4857ca06056ef978005bfae48bc

Allow SubFileDecode filter to exceed 2GB

Bug #696916 "32-bit byte counter in /SubFileDecode"

Adopt the patch supplied by Alex Cherepanov, this allows a SubFileDeocde
filter to skip more than 2GB of data. I haven't tested Alex's file,
I'll assume it works for him.

No differences in cluster testing.

base/sfilter.h


2016-07-12 00:25:21 +0100
Robin Watts <robin.watts@artifex.com>
08fb4a4997cf85a0f903f55f099e266d9ab70290

Fix landscape imagemask plotting.

In commit 0fb16eb7 I implemented interpolation of imagemasks
for the non hl-color case. Unfortunately it appears I implemented
it badly.

Thanks to Ray for spotting this and supplying the fix.

base/gxiscale.c


2016-07-11 16:54:55 +0100
Ken Sharp <ken.sharp@artifex.com>
344a80aab2e4ca48f4332c49f74560d56e739ad8

PDF interpreter - cope with Default* ColorSpace definitions in Forms

Bug #696875 " Differences in output - altona swatch p"

Our existing code for dealing with DefaultGray, DefaultRGB and DefaultCMYK
ColorSpace definitions is not great. It relies upon defining these as
ColorSpace resources, and setting UseCIEColor to true. When we then
set DevicGray, DeviceRGB or DeviceCMYK the PostScript code detects the
use of CIEColor and loads the corresponding 'Default' colour space
instead of loading the device space (NB the initial definitions are
identity, ie initally DefaultGray = DeviceGray)

This was only done for Pages, not for Forms, and we now have examples
(test suite files) which use different Default* spaces in Forms.

This code extends the detection of Default* spaces to Form XObjects
and turns on UseCIEColor if it finds any. DoForm now detects any such
spaces and defines appropriate ColorSpace resources. I would like to
put save/restore around the form to preserve any existing definitions,
but that causes the transparency code to seg fault. Instead we carefully
copy any existing definitions, and replace them after running the form.

This show progressions in 2 files:
Altona_Technical_v20_x4.pdf
CATX9509.pdf

The file Bug695948.pdf now times out. This is because of the crazy way
the file is constructed, it has forms nested 50 levels deep, only the
last one making any actual marks. Each form declares every preceding
form as a resource (which it need not do, only the form it actually
uses need be declared). This causes the code attempting to detect the
use of Default* colour spaces to take an extraordinarily long time. I've
decided to accept this as the price for getting the Altona file to work.

In the long term we should rework the use of Default* colour spaces so
that the ICC manager is involved. This should ideally mean storing the
Default* spaces in the graphics state I think.

Resource/Init/pdf_draw.ps
Resource/Init/pdf_main.ps


2016-07-08 10:23:11 -0700
Michael Vrhel <michael.vrhel@artifex.com>
0d619ee9816662b4264f6d9ca3be0045a42a7d61

CompatibleOverprint blend mode addition (c-code)

This adds support in the transparency code for providing proper
application of blending when we have overprint and transparency.
The description is in Section 7.6.3 of the spec. This is for
fixing Bug 696876. This does not complete the problem yet. We
have to add code in the interpreter side to invoke this blending mode
when overprint is enabled and we are painting elementary graphics objects
(fills, strokes, text, images, and shadings) (That is from the spec).

If the blend mode is anything BUT Normal, the interpreter should
push a non-isolated non-knockout group prior to painting the object. The
blend mode should be set to BLEND_MODE_CompatibleOverprint. When
we pop the group, the blend mode should be restored to the non-Normal
blend mode for the group composition.

base/gdevp14.c
base/gstparam.h
base/gxblend.c
base/gxblend.h
base/gxblend1.c
base/gxp1fill.c
base/gxpcolor.h
base/lib.mak


2016-07-07 11:07:45 -0700
Ray Johnston <ray.johnston@artifex.com>
60195a79aff2a53662a471a59c2900c8435730f6

Improve performance for interpolated landscape images (bug 696841)

There was a comment that indicated that doing landscape runs was not
worthwhile, but on the customer's test file it improved peformance by
40%.

base/gxiscale.c


2016-07-05 08:57:24 -0700
Ray Johnston <ray.johnston@artifex.com>
fd34a32b0fd8f6d38f26c464b3a4efa6fdc37a56

Improve performance of landscape masks for bug 696841.

Since the clip list accumulator is optimized for x-major entry of rects,
if we know the information is y-major, as for landscape imagemasks, then
transpose X and Y in the list, and similarly transpose back when doing
the clip_enumeration bounds checking and calling the target operation
(process function).

This improves the processing of the customer's file from 1900 seconds to
96 seconds!

So far only landscape imagemask clip path accumulation uses this. TBD
is to evaluate if any other uses of the clip path accum device can take
advantage of this transposition.

base/gsimage.c
base/gxacpath.c
base/gxclip.c
base/gxclrast.c
base/gxcpath.c
base/gxcpath.h
base/gximage.h
base/gximask.c
base/gximask.h
base/gxipixel.c
base/gzacpath.h


2016-07-06 13:59:10 -0700
Michael Vrhel <michael.vrhel@artifex.com>
ab8f19f34d7c2b1ea7d1a853bc9fa74f58bf49e2

Extend the -sSourceObjectICC to include gray ICC profiles

This makes it possible to specify overriding gray ICC profiles
for gray color spaces as specified in the file referenced by
-sSourceObjectICC. The notation is similar to that described
for the RGB and CMYK color spaces in the color document.
Fixes Bug 696834.

base/gscms.h
base/gsicc_cache.c
base/gsicc_manage.c
base/gsicc_manage.h


2016-07-06 10:52:49 -0700
Michael Vrhel <michael.vrhel@artifex.com>
8387d9f2cb6f77dca2b12d87f865a28dd52a9840

Add support to create threshold profiles for input color spaces

This adds the ability to the ICC Creator tool in toolbin/color
to create ICC profiles that will threshold to neutral CIELAB
values of black or white. You can specify the L* point at
which to apply the transition. The input curve treats the device values as
having the traditional sRGB like gamma. This is work toward dealing
with the enhancement in Bug 696834

toolbin/color/icc_creator/ICC_Creator/ICC_Creator.rc
toolbin/color/icc_creator/ICC_Creator/ICC_CreatorDlg.cpp
toolbin/color/icc_creator/ICC_Creator/ICC_CreatorDlg.h
toolbin/color/icc_creator/ICC_Creator/icc_create.cpp
toolbin/color/icc_creator/ICC_Creator/icc_create.h
toolbin/color/icc_creator/ICC_Creator/resource.h


2016-07-05 10:17:48 -0700
Ray Johnston <ray.johnston@artifex.com>
e9b54d14d939bd038bfddc745ea765cb970c9edb

Fix force_interpolation to work properly with interpolation threshold

If the scaling was less than the threshold, interpolation would be skipped
even if it had been forced by logic in gxipixel.c. Also skip interpolation
if it doesn't do anything (Width and Height In == Out).

base/gxidata.c
base/gximage.h
base/gxipixel.c
base/gxiscale.c


2016-07-05 09:31:00 -0700
Ray Johnston <ray.johnston@artifex.com>
cdbf67714cddad97b2cad46adc56c648764be733

Use fixed_epsilon to detect downscale for force_interpolation of patterns

PCL uses patterns (a lot) but due to rounding patterns intended to be 1:1
scale end up as slightly less (grasshop.pcl) so interpolation would be
forced.

base/gxipixel.c


2016-07-04 14:25:49 +0100
Ken Sharp <ken.sharp@artifex.com>
f342b3bdf81308ff3ce90381ec741a1b0f25ed0c

pdfwrite - fix an off-by-1 error copying extension metadata

We were copying one byte too few from the supplied string. Take the
opportunity to optimise the size of the allocated data at the same
time. Its only 1 byte, but still.....

devices/vector/gdevpdfm.c


2016-07-04 10:26:07 +0100
Ken Sharp <ken.sharp@artifex.com>
810ce1e302af7d12e08650ccf0d88407b04a0d46

PDF interpreter - cope with missing parameters in Destinations

The PDF specification says that certain elements in Destinations can
be 'null' but doesn't say that this actually means 'missing'.

Commit b4fc7327fa0c792a7b218610b86d9fa4533d3e0b added support for this
in XYZ Dests, this commit adds support for FitH, FitV, FitBH and FitBV
Dests completing the variations. Note that the spec says that 'null'
values for FitR have 'undefined results' so we just throw those away
still.

No differences expected.

Resource/Init/pdf_main.ps


2016-07-04 08:13:00 +0100
Ken Sharp <ken.sharp@artifex.com>
389657cf69b2a9c612442c8222236e3ce6f869ca

PDF interpreter - handle ToUnicode CMaps with large ranges

The CMap reading code did not cope with range entries which spanned
more than 255 indices in a single range, it assumed there would never
be more than this and only used a single byte for the key values.

Fixing that revealed that the ToUnicode generation (from the decoded
CMap) also assumed that a range would never span more than 255 indices.
This was a little more complex to fix.

This commit should allow arbitrary length ranges, even though the
ToUnicode specification currently limits the keys to 0-65536. This is
not tested by cluster runs, but appears to work with all the problematic
ToUnicode files I can find on a quick sweep through Git.

Resource/Init/gs_cmap.ps
Resource/Init/pdf_font.ps


2016-06-30 16:31:09 +0100
Ken Sharp <ken.sharp@artifex.com>
bbb684bc346851cb08d615048c9f50c106ec1fe4

add per-page annotation detection to pdf_info.ps

toolbin/pdf_info.ps


2016-06-24 09:14:43 -0700
Marcos H. Woehrmann <marcos.woehrmann@artifex.com>
7dca388d4b952357c931f52b4bb16dee76cea01e

Minor changes to clusterpush.pl and improvements in its documentation.

toolbin/localcluster/clusterpush.pl
toolbin/localcluster/clusterpush.txt


2016-06-24 10:28:39 +0100
Ken Sharp <ken.sharp@artifex.com>
fd75e1678500f1ba60296ddf8fbb17e60aedcd6d

Match Acrobat's use of AutoRotatePages and DSC

When AutoRotatePages is set to anything except /None Acrobat will
honour DSC Orientation comments and use them in preference to the
heuristically determined value, which we weren't doing.

This commit matches Acrobat, including the ability to have the heuristic
override the DSC comments by setting -dParseDSCComments=false.

The documentation is updated and now correct, including mentioning that
the heuristic can be preferred by turning off DSC parsing.

A few files (7) show a difference because of different orientation
with the pdfwrite device.

devices/vector/gdevpdf.c
doc/VectorDevices.htm


2016-06-23 09:09:08 +0100
Ken Sharp <ken.sharp@artifex.com>
75e76c19392457f442d10770f6096a558fe6befc

remove memcmp() of structures from zfont1.c

Bug 696863 "memcmp() in zfont1.c"

psi/zfont1.c


2016-06-22 16:36:20 -0700
Marcos H. Woehrmann <marcos.woehrmann@artifex.com>
5ce6369cb89453e75f1915e6f520a19c49a4096b

Flip cups files right side up in bmpcmp.c.

toolbin/bmpcmp.c


2016-06-22 18:15:55 +0100
Brian Norris <computersforpeace@gmail.com>
d54d8d529fdc9515068384c6262f321bec06bf5f

Bug 696843: poor dependencies for install target

The dependencies for the install target were poorly specified causing them
to sometimes fail when called in a parallel make.

contrib/contrib.mak


2016-06-22 18:12:34 +0100
Brian Norris <computersforpeace@gmail.com>
832c32645075dcd93e8e448ec012241f79edac17

Fix use of shell built-in 'trap'

In instcopy we use the shell built-in 'trap' so that if anything goes wrong
in the copying process, we ensure cleanup afterwards. But we only setup the
trap *after* we'd started copying stuff.

It was *probably* okay, but is safer and cleaner this way.

Noticed in passing looking at Bug 696843.

base/instcopy


2016-06-22 10:00:22 +0100
Chris Liddell <chris.liddell@artifex.com>
d278f6a3b8b7baecbe23d7fa40de1164fd67e63e

More TTF post table wranglings

The original TTF spec listed name table indices between 32768 and 65536 as
"reserved for future use". The latest OTF spec (1.60) has indices up to and
including 63335 as valid.

So, tweak our post table handling to cope.

Since numGlyphs is a unsigned short (16 bit) number, there is no point checking
for the upper limit of value, now, so that check is dropped.

Also, since we pre-process the requested indices to ascertain the largest index
we have to deal with, and if the number of names is less than that, fill the
remainder of the array with /.notdef names, we can also drop the explicit check
for indices beyond the available names.

Resource/Init/gs_ttf.ps


2016-06-21 14:39:27 +0100
Ken Sharp <ken.sharp@artifex.com>
b4fc7327fa0c792a7b218610b86d9fa4533d3e0b

pdfwrite - cope with missing optional arguments in /XYZ Dests

Bug 696838 "Preserve /Dests when not named"

Well it seems that 3 of the arguments for an XYZ Destination are
optional and may be omitted, using the current setting instead. The
link destination code wasn't catering for that.

This commit checks the number of arguments in the array, throws errors
when there are too many or not enough, and replaces missing optional
values with 'null' which is equivalent and doesn't break the code.

Resource/Init/pdf_main.ps


2016-06-20 16:29:21 +0100
Chris Liddell <chris.liddell@artifex.com>
f3ed5db0fff13a4f2262e1d203ac6444df196c5d

Bug 696824 (redux): post table handling

It turns out that it is valid for the number of entries in the post table's name
list to be larger than the number of glyph indices used in the font (for what
purpose, I cannot fathom).

Worse, the number of entries in the name list is not declared anywhere, so the
only option is to pre-process to recover it. In fact, we pro-process the list
of indices (rather than the list of names) and note the highest reference -
this is more efficient as the indices are short, and fixed length values, where
names tend to longer, and of variable length.

Resource/Init/gs_ttf.ps


2016-06-19 10:59:25 -0700
Ray Johnston <ray.johnston@artifex.com>
6aff224d35988db9a388eee4ddd849eee18bd9d6

Fix clist_dev_spec_op forwarding when the device is pattern-clist

Detected while investigating bug 696841, but it doesn't help with the
performance issue. It would cause gridfitting and forced interpolation
to be different for patterns accumulated to a bitmap compared to those
that used the pattern-clist.

base/gxclrect.c
base/gxpcmap.c
base/gxpcolor.h


2016-06-18 10:21:48 +0100
Ken Sharp <ken.sharp@artifex.com>
9744319ca8e8f55fa2b8e146557e2b146deb6f1b

Coverity ID 94756 - add a 'fall through' comment

base/gxshade4.c


2016-06-18 09:30:49 +0100
Ken Sharp <ken.sharp@artifex.com>
9484cc1d16b50f506bcea80030cffc442e46d717

pdfwrite - test a return code to silence a scan-build warning.

devices/vector/gdevpdfm.c


2016-06-17 18:12:09 +0100
Ken Sharp <ken.sharp@artifex.com>
e64d0620193b05d57f37d2deceac965ec5114e67

pdfwrite - don't compress data from Metadata pdfmark when output is PDF/A

Bug 696864 "Metadata stream should not be compressed, when using a pdfmark"

This turned out to be rather more complex than expected. The stream is
constructed via a pdfmark before we add the 'Metadata' key to its
dictionary. This means that at the time we create the stream, we don't
know that it should not be compressed, so we open it with compression
filters added.

We can't throw away the stream we have at the time data is written to
it, because we've written keys to its associated dictionary. Also that
would generate a new object number leaving an unused object in the xref
which is legal but undesirable.

This means that we either have to defer the compression filters
until we write to the file, or close the compression filters when we see
the Metadata. Ideally I'd like to do the former, but I wasn't able to
prove categorically that there was no other code path leading to a
pdfmark-created stream which would evade the checks.

So I've chosen to discard the existing compressed stream when we find
a /Metadata pdfmark, and create a new uncompressed stream for the
stream object. This means also deleting the Filter and DecodeParams
entries from the dictionary, if present.

Finally, there has for some time been an icky hack in the code where we
overload the meaning of 'CompressFonts' to determine whether to compress
all streams outside of page streams (which are controlled with
CompressPages). This commit also adds the new debugging switch
CompressStreams which, if set to false (default is true) will not
compress streams other than Fonts or Pages, which still retain their
existing controls.

devices/vector/gdevpdfb.h
devices/vector/gdevpdfi.c
devices/vector/gdevpdfm.c
devices/vector/gdevpdfp.c
devices/vector/gdevpdfx.h
doc/VectorDevices.htm


2016-06-14 18:26:18 +0100
Robin Watts <robin.watts@artifex.com>
3c889ceed3b9a78da16ea2387f3b8029e25aa15b

Memento: Add Memento_tick()

Sometimes it can be useful to be able to run a program
repeatedly and stop it at a given place, just before a
problem occurs.

Suppose you know that the problem occurs in the 'foo'
function, but only after a number of runs.

Insert a call to Memento_tick() at the top of foo, rebuild
and run in the debugger. When the problem occurs, consult
memento.sequence to see what event number we are on;
suppose it's 1000.

Then you can rerun the debugger with breakpoints on Memento_inited
and Memento_breakpoint. When the program stops at Memento_inited,
call Memento_breakAt(1000) and continue execution. The program
will then stop in Memento_breakpoint within the Memento_tick
call just before the problem occurs, enabling you to step forward
and see what goes wrong.

base/memento.c
base/memento.h


2016-05-02 19:31:27 +0100
Robin Watts <robin.watts@artifex.com>
3bc51652cc962f0256acdf37f52d0a7d98b20ed1

Bobbin: Add first version of Bobbin.

A simple tool to help debug performance problems with
threads.

Build with BOBBIN defined, and all pthreads calls (or at
least all the ones gs uses) go through Bobbin. This keeps
track of the time each threads spends waiting on mutexes
or condition variables.

Hopefully this allows contention to be spotted.

A report is printed at the end.

base/bobbin.c
base/bobbin.h
base/gdevprn.c
base/gp_psync.c
base/gpsync.h
base/gsicc_cache.c
base/gsicc_lcms2.c
base/gsicc_manage.c
base/gsmalloc.c
base/gxclthrd.c
base/gxsync.c
base/gxsync.h
base/lib.mak
base/malloc_.h
base/memento.h
windows/ghostscript.vcproj


2016-06-14 15:33:46 +0100
Chris Liddell <chris.liddell@artifex.com>
b3cea386ef8ebc24198963a26c90ad33dc1f8f07

Bug 696833: Use sane way to identify fill/stroke in a glyph

There was a highly unreliable hack used in the do_fill() and do_stroke()
functions in order to the set the object type tag between line art and
text.

This uses a more robust solution

base/gspaint.c


2016-06-14 08:33:57 +0100
Chris Liddell <chris.liddell@artifex.com>
f3b34d04f6c7b58375582a6b46abb024a0bb0ab0

Clarify description comment in gdevmiff.c

devices/gdevmiff.c


2016-06-14 16:29:12 +0100
Ken Sharp <ken.sharp@artifex.com>
53d35a364f99dc2353104cfec0c684a062034456

pdfwrite - move linearisation records to non-GC memory

Bug 696832 "crashes on Windows server 2012 R2"

This seems to be because the pointer enumeration was messed up and
we didn't enumerate the 'PageList' at all, causing some spectacular
faults in Garbage collection, because linearization only occurs when
closing the device, which means we always do GC beforehand and move
all the pointers.

The simples solution is just to move the records to non-GC memory, there
is no reason for these to be tracked by the garbage collector.

devices/vector/gdevpdf.c
devices/vector/gdevpdfx.h


2016-06-14 10:01:08 +0100
Ken Sharp <ken.sharp@artifex.com>
d6c70b021c6dd2ee20dfdbd82b4bbfc213b1c64a

pdfwrite - fix octal escapes in Ext_Matadata pdfmark processing

Bug #696830 "Ext_Metadata pdfmark — does it work with general UTF-8 text string?"

The code for undoing octal escapes in the Ext_Metadata pdfmark
processing code did not subtract 0x30 (ASCII '0') from bytes before
converting them to binary, resulting in incorrect data.

Thanks to Ross Moore for finding the problem and tracking down the fix.

devices/vector/gdevpdfm.c


2016-06-13 12:38:59 +0100
Ken Sharp <ken.sharp@artifex.com>
aeabbe1b9bfbcc3a2214c030aa5c77910112e021

ps2write - permit image downsampling

For inline images we set up 'lossless' filters, which use lossless
compression, but also disable downsampling.

This seems wrong for pdfwrite, and because ps2write always uses inline
images, means that downsampling wasn't working at all for ps2write.

This commit alters the lossless filters to allow for image downsampling
even when inline. At the same time we change the ps2write defaults to
not downsample color images, so that we don't see a change in behaviour.

Resource/Init/gs_pdfwr.ps
devices/vector/gdevpdfi.c
devices/vector/gdevpsdf.h
devices/vector/gdevpsdi.c


2016-06-11 16:47:52 +0100
Robin Watts <robin.watts@artifex.com>
2fc20e2ff73b0d015f7aab9f5bc2df0e11361536

Update LZW decode to cope with TIFF 5.0 streams.

The LZW decoder used in TIFF 5.0 streams is not as strict as
normal LZW. When we hit the maximum number of codes we do not
expect a CLEAR code immediately.

base/slzwd.c
base/slzwx.h
xps/xpstiff.c


2016-06-13 08:46:41 +0100
Ken Sharp <ken.sharp@artifex.com>
aa55104b991e14e142267f85bb2695a59481cff0

Coverity ID 127203 don't test variable

The variable pgs must be valid, if it isn't we would already have
seg faulted, so there's no point testing it.

Not sure why coverity suddenly started detecting this, I don't
believe the code has changed.

devices/vector/gdevpdfg.c


2016-06-13 08:45:21 +0100
Ken Sharp <ken.sharp@artifex.com>
5eaeba97a259aca8057c48e0dc130ae7182a6bcf

Coverity ID 94741 add a 'fall through' comment to a switch

devices/gdevupd.c


2016-06-09 19:11:40 +0100
Robin Watts <robin.watts@artifex.com>
c1ea03762b602589acc27b8cea330ae99596edc4

Improve splay tree handling in clumps.

The code walks the splay tree of clumps in 3 main ways.

Firstly it can do an inorder traversal of the tree, from
min to max. We call this a "forward" traversal.

Secondly it can do a reverse-inorder traversal of the tree,
from max to min. We call this a "backward" traversal.

Finally, and most commonly, it can do an inorder traversal
of the tree, from an arbitrary starting position, so that when
it hits the max, the calling code can restart it from the min.

This latter behaviour was nastily implemented, requiring the
callers to jump through hoops. I think that some of the callers
had been getting it wrong, resulting in incomplete traversals
of the tree.

We implement a nicer version here, where the logic for looping
from max to min, and stopping when we reach the start position
is neatly encapsulated in the tree handling.

We also update the clump sanity checking and call it in more
places.

This seems to fix the stale pointer problem that Ray has
encountered, presumably because clumps are correctly freed
now.

base/gsalloc.c
base/gxalloc.h
psi/igc.c


2016-06-10 09:49:02 +0100
Ken Sharp <ken.sharp@artifex.com>
99e331527d541a8f01ad5455c4eb2aabd67281a6

Fix .locksafe

Apparently we need to .forceput the definition of getenve into
systemdict, at least when running GSView 5.0.

Discovered when trying to investigate a customer bug report using
GSView 5.

Resource/Init/gs_init.ps


2016-06-09 08:50:03 -0600
Henry Stiles <henry.stiles@artifex.com>
0d4644c003067fc14ca1db9c600dce420c06e6b1

Add strlcpy and strlcat to ghostscript.

Adds the FreeBsd implementation of the safer string functions. These
replace the xps implementations which did not have proper source
acknowledgment.

base/gsstrl.c
base/gsstrl.h
base/lib.mak
base/string_.h
xps/ghostxps.h
xps/xpscolor.c
xps/xpsdoc.c
xps/xpsimage.c
xps/xpsmem.c
xps/xpspage.c
xps/xpsresource.c
xps/xpszip.c


2016-06-07 16:16:40 -0600
Henry Stiles <henry.stiles@artifex.com>
8f0cca98368f5dd21dcbc79cae3247b57a88236c

Remove unused remap code.

Remove code to remap raster with bits per component that don't divide 8.
3,5,6 and 7 bit per pixel pcl raster is always consolidated to 8 bits
per pixel before remapping.

pcl/pcl/pcwhtidx.c


2016-06-07 07:49:46 -0600
Henry Stiles <henry.stiles@artifex.com>
d3d41654f43ff7a027cb9ffb271c90020a6c2de7

Remove unnecessary remap macros.

The free macro was never used the array has always been freed directly.

pcl/pcl/pcwhtidx.c
pcl/pcl/pcwhtidx.h
pcl/pcl/rtraster.c


2016-06-08 18:02:33 +0100
Chris Liddell <chris.liddell@artifex.com>
9d7c50bce20bd870305c3206c731498bc5ef6bbd

Bug 696824: 'post' table with out of range indices

Loading a Truetype font with a 'post' table which has glyph indices outside
the range of glyph names available, we'd previously exit the loop filling in
the array of names early - leaving subsequent entries in the array unset.
Which would, later, cause a typecheck error.

To be more tolerant, when we encounter an index outside the available range,
just use notdef for that position in the name array.

Resource/Init/gs_ttf.ps


2016-06-07 10:28:54 +0100
Ken Sharp <ken.sharp@artifex.com>
054861374d6822738865892d5a0c2bb78cd58a9d

PDF interpreter - refuse to set degenerate text matrix

Bug 696817 "Regression: text missing starting with 83e211723f975beff6ce488a2a6ee5105c089121"

The file sets a font size of 0 and then a ridiculous text matrix:

-2147483648 -2147483648 -2147483648 -2147483648 197 380 Tm

Combined with the CTM this leads to a degenerate CTM (the 2-dimensional
co-ordinates all map to a one dimensional line). This is clearly silly.

This is not in fact a regression, I modified the code so that it would
behave the same when TextAlphaBits is set as when it is not. Although
this file did 'work' previously, when TextAlphaBiots is not set, it
did not work if TextAlphaBits was set, so the code works as expected.

This commit adds a test for a degenerate matrix resulting from Tm and
ignores it if it would. We already 'fix' a font size of 0.

Resource/Init/pdf_ops.ps


2016-06-06 17:39:44 +0100
Ken Sharp <ken.sharp@artifex.com>
3cdf4f936d07333e78f545d67ce14ccbe4290b4c

Add 'fall through' comments to many switch cases to satisfy Coverity

base/gdevdrop.c
base/gdevprn.c
base/gdevvec.c
base/gsbitops.h
base/gsdevmem.c
base/gsdparam.c
base/gsfunc4.c
base/gsht.c
base/gsparamx.c
base/gxclimag.c
base/gxclrast.c
base/gxpath2.c
base/sstring.c
cups/gdevcups.c
devices/gdevupd.c
devices/gdevxalt.c
devices/vector/gdevpdfd.c
devices/vector/gdevpdtd.c
devices/vector/gdevtxtw.c
psi/imainarg.c
psi/interp.c
psi/iscan.c
psi/iscannum.c
psi/zcolor.c
psi/zmedia2.c


2016-06-06 16:45:34 +0100
Chris Liddell <chris.liddell@artifex.com>
c4dd42e0bcfd9e5bdd42a248111b5786ad7096cb

Fix two makefile typos from the imager_state->gs_gsgstate commit

First was a missing closing parenthasis in a macro reference in psi/int.mak

Second was using a period ('.') in a macro name in base/lib.mak

Oddly, neither of these manifested with GNU make, only with nmake on Windows.

base/lib.mak
psi/int.mak


2016-02-24 12:50:47 +0000
Chris Liddell <chris.liddell@artifex.com>
45dcf097558e880a76f569dd8d6c678f6ed186ce

Make gs_imager_state == gs_state.

Change how gstate initialisation is done:

Previously we relied on the imager state being a subset of the gstate (thus
assigning an imager state to a graphics state over wrote to the entries
common to both, and didn't overwrite any already set graphics state specific
entries).

Making the imager and graphics states the same means that approach doesn't work,
so this changes it to initialise the entries individually.

Renames gsistate.c->gsgstate.c and gxistate.h->gxgstate.h

Cleanup and fix the gs_state gc stuff.

Uses different check for pre/post clist pdf14 device

Previously, the code used "is_gstate" in the imager/graphics state object
to determine if the code was being called pre or post clist (post clist would
only ever have had an imager_state so is_gstate = false).

With no imager state any more, that test would no longer work (and I am dubious
about whether it was really safe, anyway). Other places check for the presence
of a clist reader device in the pdf14 device structure - so use that here
too.

Adds initial (NULL) value for show_gstate pointer in gs_state.

Removes the now pointless macro for the contents of the graphics state

Changes function names that had "imager" to use "gstate"

Removes the redundant 'is_state' flag

Cleans up gs_(g)state_putdeviceparams():

Previously we had to similar routines: one took a graphics state, and used the
device from the graphics state, the other took an imager state and the device
as an explicit parameter.

With the removal of the imager state, "merge" those two functions

Replaces gs_state with gs_gstate

It makes for less confusion as it really is a g(raphics)state

base/gdevabuf.c
base/gdevbbox.c
base/gdevddrw.c
base/gdevdevn.c
base/gdevdevn.h
base/gdevdflt.c
base/gdevflp.c
base/gdevmpla.c
base/gdevmplt.c
base/gdevnfwd.c
base/gdevoflt.c
base/gdevp14.c
base/gdevp14.h
base/gdevplnx.c
base/gdevsclass.c
base/gdevvec.c
base/gdevvec.h
base/gsalpha.c
base/gsalpha.h
base/gsalphac.c
base/gscdevn.c
base/gscdevn.h
base/gschar.c
base/gschar.h
base/gscicach.c
base/gscicach.h
base/gscie.c
base/gscie.h
base/gsciemap.c
base/gsclipsr.c
base/gsclipsr.h
base/gscolor.c
base/gscolor.h
base/gscolor1.c
base/gscolor1.h
base/gscolor2.c
base/gscolor2.h
base/gscolor3.c
base/gscolor3.h
base/gscoord.c
base/gscoord.h
base/gscpixel.c
base/gscscie.c
base/gscsepr.c
base/gscsepr.h
base/gscspace.c
base/gscspace.h
base/gscssub.c
base/gscssub.h
base/gsdevice.c
base/gsdevice.h
base/gsdfilt.c
base/gsdfilt.h
base/gsdps.c
base/gsdps.h
base/gsdps1.c
base/gsequivc.c
base/gsequivc.h
base/gsfont.c
base/gsfont.h
base/gsgstate.c
base/gshsb.c
base/gshsb.h
base/gsht.c
base/gsht.h
base/gsht1.c
base/gsht1.h
base/gshtscr.c
base/gshtx.c
base/gshtx.h
base/gsicc.c
base/gsicc_cache.c
base/gsicc_cache.h
base/gsicc_cms.h
base/gsicc_create.c
base/gsicc_create.h
base/gsicc_manage.c
base/gsicc_manage.h
base/gsicc_nocm.c
base/gsicc_profilecache.c
base/gsicc_profilecache.h
base/gsicc_replacecm.c
base/gsimage.c
base/gsimage.h
base/gsimpath.c
base/gsiparm2.h
base/gsistate.c
base/gslib.c
base/gsline.c
base/gsline.h
base/gsnamecl.c
base/gsnamecl.h
base/gsncdummy.c
base/gsovrc.c
base/gspaint.c
base/gspaint.h
base/gspath.c
base/gspath.h
base/gspath1.c
base/gspath2.h
base/gspcolor.c
base/gspcolor.h
base/gsptype1.c
base/gsptype1.h
base/gsptype2.c
base/gsptype2.h
base/gsrefct.h
base/gsrop.c
base/gsrop.h
base/gsshade.c
base/gsshade.h
base/gsstate.c
base/gsstate.h
base/gsstype.h
base/gstext.c
base/gstext.h
base/gstrans.c
base/gstrans.h
base/gstype1.c
base/gstype1.h
base/gstype2.c
base/gstype42.c
base/gx.h
base/gxacpath.c
base/gxblend.h
base/gxblend1.c
base/gxccache.c
base/gxcdevn.h
base/gxchar.c
base/gxchar.h
base/gxchrout.c
base/gxchrout.h
base/gxcht.c
base/gxcie.h
base/gxcldev.h
base/gxclimag.c
base/gxclip.c
base/gxclip.h
base/gxclip2.c
base/gxclipm.c
base/gxclist.c
base/gxclist.h
base/gxclpath.c
base/gxclpath.h
base/gxclrast.c
base/gxclrect.c
base/gxcmap.c
base/gxcmap.h
base/gxcomp.h
base/gxcoord.h
base/gxcpath.c
base/gxcspace.h
base/gxdcconv.c
base/gxdcconv.h
base/gxdcolor.c
base/gxdcolor.h
base/gxdevcli.h
base/gxdevice.h
base/gxdevmem.h
base/gxdht.h
base/gxdhtserial.c
base/gxdhtserial.h
base/gxfapi.c
base/gxfapi.h
base/gxfcache.h
base/gxfill.c
base/gxfont.h
base/gxfont42.h
base/gxgstate.h
base/gxhintn.c
base/gxhldevc.c
base/gxhldevc.h
base/gxht.c
base/gxht.h
base/gxht_thresh.c
base/gxi12bit.c
base/gxi16bit.c
base/gxicolor.c
base/gxifast.c
base/gximag3x.c
base/gximag3x.h
base/gximage.c
base/gximage.h
base/gximage1.c
base/gximage2.c
base/gximage3.c
base/gximage3.h
base/gximage4.c
base/gximono.c
base/gxiparam.h
base/gxipixel.c
base/gxiscale.c
base/gxistate.h
base/gxp1impl.h
base/gxpaint.c
base/gxpaint.h
base/gxpath.h
base/gxpcmap.c
base/gxpcolor.h
base/gxpcopy.c
base/gxpdash.c
base/gxshade.c
base/gxshade.h
base/gxshade1.c
base/gxshade4.c
base/gxshade4.h
base/gxshade6.c
base/gxstate.h
base/gxstroke.c
base/gxtext.h
base/gxttfb.c
base/gxtype1.c
base/gxtype1.h
base/gzacpath.h
base/gzht.h
base/gzline.h
base/gzstate.h
base/lib.mak
contrib/eplaser/gdevescv.c
contrib/japanese/gdevlbp3.c
contrib/japanese/gdevp201.c
contrib/lips4/gdevl4v.c
contrib/opvp/gdevopvp.c
contrib/pcl3/eprn/eprnparm.c
contrib/pcl3/eprn/gdeveprn.c
contrib/pcl3/eprn/gdeveprn.h
cups/gdevcups.c
devices/devs.mak
devices/gdevbit.c
devices/gdevdsp.c
devices/gdevepsn.c
devices/gdevgprf.c
devices/gdevijs.c
devices/gdevo182.c
devices/gdevokii.c
devices/gdevpbm.c
devices/gdevperm.c
devices/gdevpng.c
devices/gdevpsd.c
devices/gdevrinkj.c
devices/gdevsgi.c
devices/gdevsj48.c
devices/gdevtrac.c
devices/gdevtsep.c
devices/gdevx.c
devices/gdevxcf.c
devices/gdevxini.c
devices/gxfcopy.c
devices/vector/gdevpdfb.c
devices/vector/gdevpdfc.c
devices/vector/gdevpdfc.h
devices/vector/gdevpdfd.c
devices/vector/gdevpdfg.c
devices/vector/gdevpdfg.h
devices/vector/gdevpdfi.c
devices/vector/gdevpdfk.c
devices/vector/gdevpdft.c
devices/vector/gdevpdfv.c
devices/vector/gdevpdfx.h
devices/vector/gdevpdtc.c
devices/vector/gdevpdte.c
devices/vector/gdevpdti.c
devices/vector/gdevpdts.c
devices/vector/gdevpdts.h
devices/vector/gdevpdtt.c
devices/vector/gdevpdtt.h
devices/vector/gdevpsdf.h
devices/vector/gdevpsdi.c
devices/vector/gdevpsds.c
devices/vector/gdevpsds.h
devices/vector/gdevpsdu.c
devices/vector/gdevpsfx.c
devices/vector/gdevpx.c
devices/vector/gdevtxtw.c
devices/vector/gdevxps.c
doc/Drivers.htm
gpdl/psi/psitop.c
pcl/pcl/pcommand.c
pcl/pcl/pcpage.c
pcl/pcl/pcpatrn.c
pcl/pcl/pcrect.c
pcl/pcl/pcstate.h
pcl/pcl/pctext.c
pcl/pcl/pctop.c
pcl/pcl/pgdraw.c
pcl/pcl/pgfont.c
pcl/pcl/pglabel.c
pcl/pcl/pgstate.h
pcl/pcl/rtraster.c
pcl/pl/plchar.c
pcl/pl/plchar.h
pcl/pl/pldraw.c
pcl/pl/pldraw.h
pcl/pl/plfapi.c
pcl/pl/plht.c
pcl/pl/plht.h
pcl/pl/plmain.h
pcl/pl/pluchar.c
pcl/pxl/pxerrors.c
pcl/pxl/pxfont.c
pcl/pxl/pxgstate.c
pcl/pxl/pxgstate.h
pcl/pxl/pximage.c
pcl/pxl/pxink.c
pcl/pxl/pxl.mak
pcl/pxl/pxpaint.c
pcl/pxl/pxsessio.c
pcl/pxl/pxstate.c
pcl/pxl/pxstate.h
pcl/pxl/pxtop.c
psi/gserver.c
psi/icie.h
psi/icolor.h
psi/icontext.c
psi/icstate.h
psi/igstate.h
psi/int.mak
psi/zchar.c
psi/zchar1.c
psi/zchar42.c
psi/zcie.c
psi/zcolor.c
psi/zcontext.c
psi/zcrd.c
psi/zcsindex.c
psi/zdevice2.c
psi/zdpnext.c
psi/zdps.c
psi/zdps1.c
psi/zgstate.c
psi/zht2.c
psi/zicc.c
psi/zmatrix.c
psi/zpath.c
psi/zpath1.c
psi/zpcolor.c
psi/ztrans.c
psi/zupath.c
psi/zusparam.c
psi/zvmem.c
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj
xps/ghostxps.h
xps/xpscff.c
xps/xpsfapi.c
xps/xpsgradient.c
xps/xpspage.c
xps/xpstile.c
xps/xpstop.c
xps/xpsttf.c


2016-06-06 10:49:07 +0100
Chris Liddell <chris.liddell@artifex.com>
41d8d83a77ee6ea12109dde7b72dedc61cca01a3

Coverity ID: 94795 handle stack based T1 hinter state

If the Type 1 hinter state is a stack allocation, then the 'memory' pointer
will be NULL, so pass a suitable allocator into the functions that need them,
rather than assuming the hinter state one will be valid.

base/gstype1.c
base/gstype2.c
base/gxhintn.c
base/gxhintn.h


2016-06-06 13:19:20 +0100
Ken Sharp <ken.sharp@artifex.com>
8f644a331f5d5c79a523c35495b0751d8ba44916

Coverity ID 94995 - take 2....

Turns out there are two chunks of code that need to be removed. The code
is currently dead, but we might want it someday so #if 0 it out rather
than simply deleting it.

devices/vector/gdevpsfu.c


2016-06-06 13:12:06 +0100
Ken Sharp <ken.sharp@artifex.com>
1d1bcc3997e44f36b5559163cca738091c035813

Coverity ID 95084

Turns out there were two places where we needed a NULL dererference
check

devices/gdevxcmp.c


2016-06-06 12:32:50 +0100
Ken Sharp <ken.sharp@artifex.com>
d020de175b5c26f9fb06d28fa3e2010ba4dbfcb9

Coverity ID 126581 - cast to avoid implicit sign extension

devices/gdevtifs.c


2016-06-06 11:57:28 +0100
Ken Sharp <ken.sharp@artifex.com>
154c010b817eb171e10e91d5ff5aaa946127f8ad

Coverity ID 94540

missed a check on fseek return code

devices/gdevsgi.c


2016-06-06 11:30:33 +0100
Ken Sharp <ken.sharp@artifex.com>
dd0c18056a5f28ad43f23860a5e54b990d9d64a2

Coverity ID 127115

check pis before dereferencing pointer, return error if NULL

devices/vector/gdevxps.c


2016-06-06 10:31:49 +0100
Ken Sharp <ken.sharp@artifex.com>
716a2e45caac97bb1e91484b0f706e47801d71d5

Coverity IDs 94897, 127116

Missed a chack against a buffer size in earlier commit
the file descriptor 'fd' is initially set negative, need to check
the value before trying to close it.

devices/gdevijs.c


2016-06-06 10:21:01 +0100
Ken Sharp <ken.sharp@artifex.com>
25936513d5dfc0270f23be57d8c79de32a0e45eb

Coverity ID 127117

us is an unsigned short, so remove the pointless test 'us < 0'

devices/gdevifno.c


2016-06-03 16:32:27 +0100
Chris Liddell <chris.liddell@artifex.com>
bc06a8ac477bd5b08e34c5e74d70bc6107255da0

Coverity ID: 94951 limit the size of strings.....

.... read from the command line

base/mkromfs.c


2016-06-03 16:11:02 +0100
Chris Liddell <chris.liddell@artifex.com>
e48b8ea64488d065d647212eb205ae2041f6fe30

Coverity 94527: check a return code.

psi/zfapi.c


2016-06-03 15:26:17 +0100
Chris Liddell <chris.liddell@artifex.com>
3cbaf3dc7d1e8790bd9b6cb748a6ea88052522c7

Coverity ID: 94590 Initialise ref to null object.

Previously we initialised a ref pointer to NULL, which coverity reckoned could
result in a null pointer dereference.

Instead, initialise it to a reference to a null object.

psi/interp.c


2016-06-03 16:10:32 +0100
Ken Sharp <ken.sharp@artifex.com>
bc90e4de0e59a1c8ccefc4b367220d36f9213beb

Test use of 'fall through' comment to silence Coverity

When encountering switch cases where we deliberately don't have a
break.

base/gdevbbox.c
base/gdevprn.c


2016-06-03 10:43:09 +0100
Ken Sharp <ken.sharp@artifex.com>
cff9c80230086676a22c1c9f81457855bd8c69c5

Coverity ID - 95084ce inside

Move a pointer derefeferene into a if clause checking for NULL

devices/gdevxcmp.c


2016-06-01 16:01:33 +0100
Ken Sharp <ken.sharp@artifex.com>
ba73a9d5cf2dcdd84d74046288c9e056ce39f5df

Coverity ID 94895

Don't ignore a return code

devices/gdevxcf.c


2016-06-01 15:58:02 +0100
Ken Sharp <ken.sharp@artifex.com>
e63a4886b3b345db5b9656c7b82d3fcf91436d85

Coverity IDs 94767, 126581

Avoid a potential (probably impossible) divide-by-zero
Remove pointless test of unsigned variable < 0

devices/gdevstc2.c


2016-06-01 15:45:40 +0100
Ken Sharp <ken.sharp@artifex.com>
f8d1ca815990feca25a1ef5dad70aa177d9c4670

initialise some variables to silence a CPP warning

devices/gdevijs.c


2016-06-01 15:41:38 +0100
Ken Sharp <ken.sharp@artifex.com>
afbab2f5452541d45ca4186a743f95fe4c28370a

Check return code - compiler warning

The code was not checking the return value of sgi_begin_page() which
could fail. If we then continued, various members of 'cur' could
be used uninitialised and in any event the device could not possibly
continue safely.

NB this could happen if we wrote multiple pages and did not specify
'%d' in the OutputFile or if we exhausted memory.

devices/gdevsgi.c


2016-06-01 15:25:11 +0100
Ken Sharp <ken.sharp@artifex.com>
b5e474eca6e8b83f5b4a5bce2b2736c70ca3e3d6

Various Coverity IDs

94605 - logically dead code, remove the dead code
94779 - dereference NULL - test pointer before use
94940 - cast to avoid sign extension
121446 - cast to avoid overflow
126582 - cast to avoid sign extension

devices/gdevstc.c


2016-06-01 14:49:48 +0100
Ken Sharp <ken.sharp@artifex.com>
aa8ac2b01659b998f5561bbabb3b0f863d88fd3e

Coverity ID 94540 check and action a return code

devices/gdevsgi.c


2016-06-01 14:38:35 +0100
Ken Sharp <ken.sharp@artifex.com>
1ef49f0612b367bfca7ebec1642b5a20fc440852

Coverity IDs 94791, 95082

I *think* this will solve the Coverity complaint about the sprintf
mismatch. Only way to find out is to try it.

devices/gdevlp8k.c


2016-06-01 10:13:41 +0100
Ken Sharp <ken.sharp@artifex.com>
a42440365ee0fa333d28005a511090e9f7530ed1

IJS device - Coverity IDs 94848, 94897, 94970, 94997

Close an fd (result of 'dup') on error

Check the return value from a routine against array bounds before using
it as an array index.

devices/gdevijs.c


2016-06-01 09:37:12 +0100
Ken Sharp <ken.sharp@artifex.com>
3cb304a014ca7bfdfe7196bb10ca0fd6498de13a

inferno device - Coverity ID 94985 - prevent overrun

Explicitly check a calculated buffer index to ensure it is not past the
end of the buffer.

devices/gdevifno.c


2016-06-01 09:30:15 +0100
Ken Sharp <ken.sharp@artifex.com>
97c955fc3a92f8286382f5242a82f8aec45416ae

inkcov - Coverity IDs 94600, 94671, 94820, 95003

Explicit check of total_pix to guarantee no divide-by-zero error. This
could only occur if page width or height was 0, which *should* be
impossible anyway.

Promote a 32-bit signed int to a 64-bit unsigned to prevent potential
signed overflow (2 times).

devices/gdevicov.c


2016-05-31 15:28:48 +0100
Ken Sharp <ken.sharp@artifex.com>
04b455ea5a59866f4955f07c295c6fd955ea9a7f

Coverity ID 94636 Remove dead code, pointless test and now unused variable

devices/gdevescp.c


2016-05-31 14:42:05 +0100
Ken Sharp <ken.sharp@artifex.com>
5a7a7f4ed4effb576368c7b923c4aa95aef0f5b4

ToUnicode CMaps - avoid buffer overrun

Bug 696811 "Regression: address sanitizer error starting with 9dba57f0f9a53c130ec2771c0ed1d7bd6bbef6ab"

An oversight when I rewrote the ToUnicode CMap processing recently.
Originally the ToUnicode CMap array always carried 2 bytes; now it can
hold an arbitrary length of data.

However, I'd missed the fact that there is one location which expects
to read 2 bytes, if we are only storing 1, and we reach the end of the
array (maximum character code) then we would read one byte past the end
of the array.

Fixed here by checking the size of the value and only reading the second
byte if there are at least 2 (set the second byte value to 0 if not).

base/gsfcmap.c


2016-05-31 10:16:37 +0100
Ken Sharp <ken.sharp@artifex.com>
85cec887fbd31099b2c6977f4427b20d25f98714

pdfwrite - prevent invalid combination of encryption and linearisation

The pdfwrite device does linearization as a post-creation process,
this makes it difficult to deal with encryption as we alter the object
numbers, and the object number is used as part of the encryption.

In order to support this we would have to decrypt each string or stream
and then re-encrypt with a different encryption key using the new
object number.

This is way too much effort for a feature of such marginal utility.

Instead, prevent the combination taking place, and document this as a
limitation.

devices/vector/gdevpdfp.c
doc/VectorDevices.htm


2016-05-30 09:47:16 +0100
Ken Sharp <ken.sharp@artifex.com>
bce0e0b651b2ec2c14b6d28b3da290f48b2b49dd

Coverity IDs 94672, 94998 dead code, unused value

cups/gdevcups.c


2016-05-29 11:40:54 +0100
Ken Sharp <ken.sharp@artifex.com>
a99ac607787704b0171db55846976aa8438b85e7

pdfwrite - #if out some unused code

This code causes Coverity to complain about 'countof', quite rightly.
However the code cannot currently be executed as subset_glyphs is
always NULL. The code looks like it might (if fixed) possibly be
useful so for now I've used #if 0 to remove it.

devices/vector/gdevpsfu.c


2016-05-29 11:09:05 +0100
Ken Sharp <ken.sharp@artifex.com>
6d772c95b87f9d5e81b49f15badb1d58d1448fee

xpswrite - various Coverity IDs

IDs:
94615 - remove dead code (can only get to this point with pie == NULL)
94646 - check pointer non-NULL before dereference
94666 - return error if allocation fails
94878 - Move assignment after NULL pointer check
94894 - check and action a return value

devices/vector/gdevxps.c


2016-05-28 10:13:09 +0100
Ken Sharp <ken.sharp@artifex.com>
b4e0f2080b25fc3518d9e4fb68f4d7d478bac8eb

Coverity ID 94614 - remove dead code

lnum can only be 0 on the first time round the loop, initially
num_blank_lines is 0, and is only modified in the 'if' clause, whereas
the test against lnum is in the else clause. So num_blank_lines
cannot be non-zero on the first pass, and lnum cannot be zero on
subsequent passes. Therefore the code is dead.

devices/gdev3852.c


2016-05-26 14:34:25 +0100
Ken Sharp <ken.sharp@artifex.com>
1f8219335025566277364bde52315aa339d6fda4

pdfwrite - remove an unused (and rather pointless) function

devices/vector/gdevpdfx.h
devices/vector/gdevpdts.c


2016-05-26 14:02:04 +0100
Ken Sharp <ken.sharp@artifex.com>
d5f17bbf37e4090952080423e3aa35c29c2751f5

txtwrite - fix the ToUnicode processing

commit 9dba57f0f9a53c130ec2771c0ed1d7bd6bbef6ab inadvertently broke
txtweite, I changed the meaning of the return value from the font
decode_glyph method. Initially I had intended it to be a count of
unsigned shorts, but altered it to bytes. Unfortunately I had
changed txtwrite for shorts, but forgot to change it for bytes.

This led to a buffer overrun and heap corruption.

devices/vector/gdevtxtw.c


2016-05-26 13:00:24 +0100
Ken Sharp <ken.sharp@artifex.com>
094d5a1880f1cb9ed320ca9353eb69436e09b594

pdfwrite - honour PDFA-2 restriction on OPM

Bug 696799 " Conformation to PDF/A fails specification ISO 19005-2:2011, clause: 6.2.4.2, test number 2 in veraPDF"

It seems the standards committee decided to disallow OPM 1, essentially.
The spec does say that its only disallowed when a CMYK space is used
and overprinting is true for either stroke or fill, but since that's
the only time its ever used that essentially means it can't be set.

This seems like a bad idea, because PDF/A-1 did *not* enforce this,
which means that the same file cna make a valid PDF/A-1 but not a valid
PDF/A-2.

Still nobody asked my opinion, and its in the spec, so this commit
enforces it. We can't wait until its actually *used*, we have to
prevent it being set in the first place.

devices/vector/gdevpdfg.c


2016-05-25 16:56:46 +0100
Ken Sharp <ken.sharp@artifex.com>
f25436308ce95a714319c572b7fa2f571ef5e84b

PDF interpreter - fix GlyphNames2Unicode with 2 byte keys

Bug 695834 "After processing a pdf file with PDF writer copy & paste doesn't work anymore"

The .convert_ToUnicode-into-g2u function translates .CodeMapData
(which is generated from a CMap) into a GlyphNames2Unicode dictionary,
but due to an oversight, when the high byte of an integer key was set
(via the 'offset' stored in .CodeMapData) it was not being added to the
key when generating ranges, with the result that the keys were incorrect
and could overwrite earlier values.

Resource/Init/pdf_font.ps


2016-05-25 16:53:57 +0100
Ken Sharp <ken.sharp@artifex.com>
0124e1a5e635abc4cb65e53ca13930e3b95499fe

Fonts - add some new glyph names to the Unicode Decoding resource

Bug 695806 "Words with ligatures cannot be searched for in PDF created with ps2pdf"

TeX seems to use some non-standard glyph names for ligatures, just
add those names to the existing ones for the benefit of ToUnicode
CMap generation

Resource/Decoding/Unicode


2016-05-25 16:51:20 +0100
Ken Sharp <ken.sharp@artifex.com>
9dba57f0f9a53c130ec2771c0ed1d7bd6bbef6ab

pdfwrite - ToUnicode revamp

Bug 695461 " Why does the search results changes after pdf optimzation in ghostscript?"

The existing ToUnicode functions were written against the original
ToUnicode specification, and assume that there will be no more than
2 unsigned shorts returned as the Unicode code point for any given
glyph. Sadly Adobe have revised the ToUnicode CMap making it the same
as a regular CMap, and then extending it still further.

It is now possible for a single glyph to map to a string of up to
512 bytes.

This commit revises the existing C 'decode_glyph's so that instead of
returning a gs_char for the Unicode code point, we return a string of
bytes. If the caller initially says that the string it is passing is
zero bytes, then we do not copy the bytes, we just return the required
size of the string (in bytes).

A return value of 0 from a decode_glyph function means that the glyph
was not in the map and so could not be 'decoded'.

As a consequence of this change, and to further permit more than
2 unsigned shorts for ToUnicode CMaps, the CMap lookup enumerator
now needs to be able to allocate memory, so the 'next_lookup'
methods all now take a gs_memory_t pointer to make ths possible.

The ToUnicode cmap table also has to change. Formerly it was a simple
4 bytes per code, either 255 or 65535 codes array. For simplicity
I've chosen to keep it as a large continuous array, but each entry
is now the number of bytes required to store the longest defined
Unicode value for that font, plus 2 bytes. The 2 bytes give the length
of the reserved space actually used by each Unicode code point. The
bytes are stored immediately following the length (so a 2 byte length
Pascal string if you like). This may possibly cause ToUnicode maps
to use a lot of memory, in the short term we'll live with it because
these only exist with pdfwrite, and that only really is expected
to run on decent sized platforms. May need to do something better in
future.

base/gsfcid2.c
base/gsfcmap.c
base/gsfcmap.h
base/gsfcmap1.c
base/gsfont.c
base/gxfcmap.h
base/gxfont.h
devices/vector/gdevpdtc.c
devices/vector/gdevpdte.c
devices/vector/gdevpsf.h
devices/vector/gdevpsfm.c
devices/vector/gdevtxtw.c
pcl/pl/plfont.c
psi/bfont.h
psi/zbfont.c
xps/xpscff.c
xps/xpsttf.c


2016-05-25 13:44:28 -0700
Ray Johnston <ray.johnston@artifex.com>
a60087bafbaabf7052e65eb7f08548ae596d91d4

Change PCL/XPS -Z: to use wall clock time on unix rather than cpu time.

See 4a2a3c755dc51722483e3dda5eab821a9b7035d4 that does the same thing
for PS interpreter.

pcl/pl/plmain.c
pcl/pl/plmain.h


2016-05-25 12:49:04 -0700
Ray Johnston <ray.johnston@artifex.com>
4a2a3c755dc51722483e3dda5eab821a9b7035d4

Change -Z: timing output to use wall clock time rather than CPU time.

On Windows, the gp_get_usertime would give elapsed time (wall clock),
but on linux (depending on "use_times_for_usertime", which was defined
on most unix systems), the result was CPU time for the process. This
caused multi-threaded runs to show no improvement (CPU time would only
increase a bit, but elapsed time could be much better).

By using "realtime" for the minst->base_time and in print_resource_usage,
all platforms work consistently.

psi/imain.c


2016-05-25 12:33:45 -0600
Henry Stiles <henry.stiles@artifex.com>
15d4d4b5ccac7d54362d9ae2f6f400f7e26a7627

Bug 696800 - subpolygon mode flag not reset.

A flag is used in polygon mode when a subpolygon is created which is
used later when building subpolygon paths (they're special). The code
that builds the path always resets the flag so the special handling is
not applied to regular paths. The degenerate case of creating an
empty subpolygon resulted in the flag being left set. Now we reset
the flag when we exit subpolygon mode.

pcl/pcl/pgpoly.c


2016-05-25 14:12:33 +0100
Ken Sharp <ken.sharp@artifex.com>
e450c0fa22a073f468d214e763c542f7ca3a473b

pdfwrite - fix AutoFilterStrategy for Luratech

Commit 74d5e9fb7d70d3d3d9cf964c76c550134c822020 used an enum for the
autofilter strategy (as well as fixing numerous other problems in the
code) instead of a string. But this part of the Luratech code didn't
get altered, which would have led to it not working properly

devices/vector/gdevpsdp.c


2016-05-25 10:41:51 +0100
Chris Liddell <chris.liddell@artifex.com>
9308777ef5ce79552041ca138083a7f001799019

Add some directories to the list in LICENSE

Add explicit mention of iccprofiles, pcl, xps and gpdl directories to the
list in the LICENSE file.

LICENSE


2016-05-23 09:34:48 -0700
Michael Vrhel <michael.vrhel@artifex.com>
b62625272225b3d7beb2a7f4310089efebfc1903

Bug 696602: Buffer overflow

Turned out the offending code was actually unused.

base/gsicc_manage.c
base/gsicc_manage.h


2016-05-20 10:54:56 +0100
Chris Liddell <chris.liddell@artifex.com>
b2c68b707812f6a258c991241b4dde4fd4a8cc1d

Coverity ID: 122659 further impossible alpha code tweak

A while back, we identified code in gx_alloc_char_bits() that, due to long
standing changes in the setup code, simply cannot be used. We opted to
conditionally compile out that code, just in case.

Coverity spotted that some later code was dependant on that now redundant code.

So, add the later code to the conditionally compiled out code.

base/gxccman.c


2016-05-20 10:47:05 +0100
Chris Liddell <chris.liddell@artifex.com>
29b831273bf8c7ed17835ab5ece59ea7e87ff07e

Coverity ID: 94750 change where we get the memory pointer.

Use a guaranteed non-NULL pointer from which to get the memory pointer for
a fatal error message print out.

base/gxccman.c


2016-05-19 14:46:59 +0100
Chris Liddell <chris.liddell@artifex.com>
bb5ed57c5c00d139285f16f6d69505e6d0d95f9e

Coverity ID: 125640: check return from clump_locate_ptr()

In this, clump_locate_ptr() should never fail in this location, if it does, it
it is a catastrophic failure, and we should just abort.

psi/ialloc.c
psi/int.mak


2016-05-19 16:31:03 +0100
Chris Liddell <chris.liddell@artifex.com>
fb4a2e734e71c86261d386ce53ab92605dff503a

Coverity ID: 94516 remove spurious range check code.

The code alleged to be checking a length value was valid, but in fact could not
fail, and thus had no effect.

psi/iscanbin.c


2016-05-19 15:52:58 +0100
Chris Liddell <chris.liddell@artifex.com>
f196b120c236993ae5f01ccd5415be5da7c751c3

Coverity ID 94563: move the fallback assignment.

When a gc run is triggered, if a specific space (local, global etc) isn't
specified, we try to find the space which caused it. In case it wasn't found,
we were setting the pointer to the allocator, but doing so in the wrong place.

Move it to a more suitable place.

psi/ireclaim.c


2016-05-19 15:13:13 +0100
Chris Liddell <chris.liddell@artifex.com>
cb988d950c8f154e62f28b2755f2205af9b98060

Coverity ID: 94590 initialize ierror ref contents.

psi/interp.c


2016-05-19 15:02:50 +0100
Chris Liddell <chris.liddell@artifex.com>
7b0be9cc0ea4f8e2fc764b57d5c70a35d4f7b0ce

Coverity ID: 94749 check a pointer != NULL

When we search for the ID of a save level, it should never be possible to reach
the point where save == NULL when we exit the loop - if it does, it implies
a serious failure (most likely memory corruption), so return a totally
impossible value.

psi/isave.c


2016-05-19 14:55:55 +0100
Chris Liddell <chris.liddell@artifex.com>
114451da4f27bbfda36bdde201ba7bdc960a3760

Coverity ID: 95036: ignore return from interp_reclaim

In this case, we can safely ignore it, as it will be be triggered and handled
at the top, next time through the loop.

psi/interp.c


2016-05-19 09:23:08 +0100
Chris Liddell <chris.liddell@artifex.com>
d807b791559f64276d6fb1676fbab2cb66140bd0

Remove deprecated Pn macros for pre-ANSI compilers

These were, apparently, left in place for the benefit of libjpeg, but that has
long since ceased to be necessary, so they were just clutter.

base/jpeg.mak
base/lib.mak
base/stdpn.h
base/stdpre.h


2016-05-19 09:25:36 +0100
Chris Liddell <chris.liddell@artifex.com>
d2772b4017397ebd3ad69022ed440b084812096a

Add to a comment about a deprecated function

base/gsdevice.h


2016-05-18 18:35:33 +0100
Chris Liddell <chris.liddell@artifex.com>
7d3dc0cccbf7b1a1d0a273eb78287bf8bb659fb8

Remove gs_no_glyph, gs_min_cid_glyph and gs_max_glyph

These were legacy remnants. Replace their remaining uses with the upper case,
non-deprecated equivalents.

base/gsccode.h
base/gscencs.c
base/gscencs.h
base/gschar0.c
base/gsfcid.c
base/gsfcid2.c
base/gsfcmap.c
base/gsfcmap.h
base/gsfcmap1.c
base/gsfont.c
base/gstext.c
base/gxchar.c
base/gxfapi.c
base/gxfont.h
devices/gdevtrac.c
devices/vector/gdevpdtd.c
devices/vector/gdevpdte.c
devices/vector/gdevpdtf.c
devices/vector/gdevpsf.h
devices/vector/gdevpsf1.c
devices/vector/gdevpsf2.c
devices/vector/gdevpsft.c
devices/vector/gdevpsfu.c
pcl/pcl/pctext.c
pcl/pl/plchar.c
pcl/pl/plfapi.c
psi/zbfont.c
psi/zchar.c
psi/zchar32.c
psi/zcharout.c
psi/zcharx.c
psi/zfcid0.c
psi/zfcid1.c
psi/zfont.c
psi/zfont32.c
psi/zfont42.c
xps/xpscff.c
xps/xpsttf.c


2016-05-18 18:40:34 +0100
Chris Liddell <chris.liddell@artifex.com>
b1b8ec293a199d58742c3ed45c47f249359e3392

Coverity ID: 94531

Remove the check against GS_MAX_GLYPH since that is the maximum value of
the gs_glyph data type, anyway.

psi/zfont42.c


2016-05-18 18:32:43 +0100
Chris Liddell <chris.liddell@artifex.com>
3e210f8e786464ec1f4ec8524abdf8f6a9a6f39b

Fix the PCL and XPS .so builds.

The soname value wasn't being set correctly, so they both ended up being called
libgs.so... internally.

Makefile.in
base/macosx.mak
base/unix-dll.mak
base/unix-gcc.mak
base/unixansi.mak
base/unixlink.mak
configure.ac


2016-05-17 20:03:18 +0100
Chris Liddell <chris.liddell@artifex.com>
b43055a17fe8369daa100ce5b522c86f215567fd

PCL/XPS so targets typo

Remove the autotools markers ("@") and replace with make variable markers
("$()").

base/unix-dll.mak


2016-05-19 17:48:14 -0700
Michael Vrhel <michael.vrhel@artifex.com>
07b3d1c457b146d7fc6b2e63a680366cd3002e52

Update of ICC creator code

The code had suffered some bit rot due to the movement of MS to
unicode with the newer versions of Visual studio. I updated the
project to VS 2013, fixed several bugs dealing with unicode, cleaned
the code, and fixed issues in the creation of PS-like CMYK ICC profiles
when using the UCR/BG data. Updated the UCR/BG data and included an
example with Max K. Included ICC profiles for Max K and No K. The
Max K profile would be useful in for text output with -sTextICCProfile=max_k.icc

toolbin/color/icc_creator/ICC_Creator.sln
toolbin/color/icc_creator/ICC_Creator/ICC_Creator.rc
toolbin/color/icc_creator/ICC_Creator/ICC_Creator.vcproj
toolbin/color/icc_creator/ICC_Creator/ICC_Creator.vcxproj
toolbin/color/icc_creator/ICC_Creator/ICC_Creator.vcxproj.filters
toolbin/color/icc_creator/ICC_Creator/ICC_CreatorDlg.cpp
toolbin/color/icc_creator/ICC_Creator/ICC_CreatorDlg.h
toolbin/color/icc_creator/ICC_Creator/icc_create.cpp
toolbin/color/icc_creator/ICC_Creator/icc_create.h
toolbin/color/icc_creator/README.txt
toolbin/color/icc_creator/max_k.icc
toolbin/color/icc_creator/no_k.icc
toolbin/color/icc_creator/ucr_bg.txt
toolbin/color/icc_creator/ucr_bg_max_k.txt
toolbin/color/icc_creator/ucr_bg_no_k.txt


2016-05-16 10:53:53 -0700
Michael Vrhel <michael.vrhel@artifex.com>
d1e5eef9a6e62424a07194a5e04300d84a749491

Fix Coverity 94799 Explicit null dereference

Make sure we do not deference the backdrop if it is NULL when we are doing
are group composing.

base/gxblend1.c


2016-05-18 21:36:43 +0100
Mistry <smistry@trl.co.uk>
e426b1593a4b682f3cc83fc9559e4acc16ea1744

Bug 696786 : Prevent checking too early for buffer overrun

The code has reached near the end of the buffer so you can not just take the
last 4 bytes, in this case you have to read any remaining bytes and make a
return value based on that, in this edge case you have no bytes to read so the
return value is zero.

jbig2dec/jbig2.c


2016-05-18 18:54:35 +0100
Ken Sharp <ken.sharp@artifex.com>
1cfc3d978813a6ce0564a50718bb742024e62cdd

Coverity IDs 94953, 94964

Move a pointer dereference into the block that conditionally executes
when the pointer is non-NULL. I think the pointer can never be NULL
but we were doing the test anyway.

Alter the declaration of a function, it was incorrect before.

devices/gxfcopy.c


2016-05-09 12:55:56 -0700
Ray Johnston <ray.johnston@artifex.com>
33a1bb7fc1cc618e7f562a6231fc48755f4dad74

Fix Coverity ID's: 94500, 94697, 94819, 94829, 94996, 126373.

base/gxclimag.c
base/gxclpath.c
base/gxclrast.c
base/gxclthrd.c


2016-05-18 14:44:55 +0100
Ken Sharp <ken.sharp@artifex.com>
49f43fb5c95e0bf3f3f44a9cb33393470d2388b6

Coverity IDs 126566, 126567, 126568

More dead code exposed by the macro removal in gsbitops.h.

base/gximage3.c
devices/gdevxalt.c


2016-05-18 14:10:08 +0100
Ken Sharp <ken.sharp@artifex.com>
13b3c67366aef69beed5f9c7e058c59a03714997

Coverity ID 126579

Explicit cast to avoid implicit cast and potential sign extension.
Can't actually happen, but the explicit cast costs no more than the
implicit, and avoids the warning.

devices/vector/gdevpdfg.c


2016-05-18 13:51:38 +0100
Ken Sharp <ken.sharp@artifex.com>
991a906e492b23dc1199dc47cb6d48f25d2b9fc9

Coverity IDs 126564, 126565

Remove some dead code. This was also present in the macro version of
this code, revealed by move to inline functions.

base/gsflip.c


2016-05-18 13:28:13 +0100
Ken Sharp <ken.sharp@artifex.com>
93f26fbb884a6a26016c86e25c64f2bcd061949f

Coverity IDs 126571, 126572, 126577

Fallout from the change from macros to inline functions, change a function
parameter from uint32 * to ushort * and remove the redundant type casts

Change a variable from unint32 to ushort

Finally, remove a redundant check for < 0 on an unsigned variable.

base/gdevdgbr.c
base/gdevmpla.c
base/gsbitops.h


2016-05-18 08:49:00 +0100
Ken Sharp <ken.sharp@artifex.com>
a045d4290e2b371ed4ed8de210f8a9efa4989d01

Various Coverity issues - 126569 126583

While moving from macros to inline functions:
Missed a pointer dereference, fixed.
Missed an 'inline' declaration, fixed.

Fixed some casts of shifts which were implicitly promoted resulting in
potential sign problems. These were also present with the former
macros, but are fixed now.

base/gsbitops.h


2016-05-13 15:11:07 +0100
Ken Sharp <ken.sharp@artifex.com>
26aa9f163805f69ec54d05a1237aebbda719706a

Font copying - fix the dropping of 'extension' (duplicate) glyphs

Bug #696777 "AddressSanitizer heap-buffer-overflow in copied_drop_extension_glyphs"

When we find that we have a glyph which is processed with different
/Widths, we need to encode it specially in the font. We do this by
extending the glyph name with a ~GS~x where x is an integer.

For output though (pdfwrite and friends) we really don't want to emit
these non-standard glyphs which are duplicates of existing glyphs, the
Widths emission should take care of the metrics problem for us. (in
fact we deal with it by leaving ghe Widths alone and alter the
spacing with a TJ operator).

This is supposed to be performed by 'copied_drop_extension_glyphs()'
but the code for detecting additional duplicates was incorrect and
caused us to read off a block of memory. Fixing that revealed another
problem, the code which was supposed to truncate the 'extended' name
to the normal name was using the wrong loop index and was updating
the 'non-extended' rather than 'extended' glyph name, which of course
had no effect.

I've fixed both cases, and altered the names of the loop counters to
be a little more descriptive in the hope of avoiding future such
problems.

This then exposed faults in the type 1 to Type 2 (CFF) conversion
code which simply wasn't expecting slots to be unused (and as Chris
points out rather begs the question of what this is for). Fixing this
required ratehr more extensive changes to the converter, but it seems
to work correctly now.

No differences expected

devices/gxfcopy.c
devices/vector/gdevpsf2.c


2016-05-17 12:05:17 +0100
Chris Liddell <chris.liddell@artifex.com>
fd35140f473cd64f7c27daae268858e2277127a9

Bug 696782: Fix the asciitilde glyph.

The asciitilde glyph was at the wrong y offset, meaning it appeared at the top
of the font bounding box, rather than near the middle of it.

Resource/Font/NimbusSanL-ReguCond


2016-05-17 08:06:57 -0600
Henry Stiles <henry.stiles@artifex.com>
0b2375b2e94e08a13bf972c22eafc9c9917421da

Missing va_end.

pcl/pcl/pcstatus.c


2016-05-17 07:58:27 -0600
Henry Stiles <henry.stiles@artifex.com>
b0a19d008448ca5952506f6bfc67f5982de78a07

Faulty parser control flow fixed.

The PCL parser did not properly transition from scanning data to
scanning parameters in short hand mode. Coverity uncovered the
problem (102252).

pcl/pcl/pcparse.c


2016-05-13 11:40:36 -0600
Henry Stiles <henry.stiles@artifex.com>
39b2eb4200b81e081fb97be0df4575c5ceb3afd3

Coverity fixes.

pcht.c 102234: parameter list released twice.
pcsymbol.c 102225: insecure data handling.

The latter is not a bug as far as we can tell but the readability of the
code and directness of the checks have been improved anyway.

pcl/pcl/pcht.c
pcl/pcl/pcsymbol.c


2016-05-13 11:31:30 -0600
Henry Stiles <henry.stiles@artifex.com>
6c9e348bde9a8f007352c88477fb3655291b12f8

Fix symbol set lookup.

The PJL symbol set lookup could potentially dereference NULL for a
couple of the sets, also we rebuild the table to simply return the
associated symbol set number, there is no need to calculate the number
at runtime.

pcl/pl/pjparse.c


2016-05-13 10:01:44 +0100
Ken Sharp <ken.sharp@artifex.com>
fcedd5c71e5edac73f4240c635c6280dce918152

pdfwrite - prevent buffer overrun

While investigating Bug #696777, the new rectangular subpath code threw
errors with address sanitizer. This was due to trying to pick up the
last segment co-ordinate using the loop counter, when it should have
been using the segment index.

devices/vector/gdevpdfd.c


2016-05-12 17:38:44 +0100
Chris Liddell <chris.liddell@artifex.com>
6bba1f6fa4d48e9651873d34815ede36bca73a74

Bug 696776: Allow gs run without pdfwrite installed.

With the build consolidation change, one of the requirements was that there
should be no dependencies in the graphics library build objects on any of
the interpreter objects.

That meant that gs_pdfwr.ps always gets built in, and then run by the
initialization code, which then throws an error when pdfwrite is not
present.

To handle this, check if pdfwrite is available, and if not, skip executing
the contents of gs_pdfwr.ps.

Resource/Init/gs_pdfwr.ps
devices/devs.mak


2016-05-13 08:29:25 +0100
Ken Sharp <ken.sharp@artifex.com>
f7b9321be1a0d029e1465af699dff52319b1c906

Revert the use of gp_get_realtime in pdfwrite

base/gp_win32.c
base/time_.h
devices/vector/gdevpdf.c
devices/vector/gdevpdfe.c


2016-05-09 11:40:59 +0100
Chris Liddell <chris.liddell@artifex.com>
14e151e48e07af8eee5efbbc336e1a1b59eb93a2

Build PCL and XPS as shared library and DLL

Also, most of building gpdl as a shared lib and DLL is here, too.

There isn't really an "API" here: the library has one entry point:
"pl_main_aux()", this is really just the build skeleton on which we can
assemble a real API.

On Windows, PCL, XPS and (if forced to build) GPDL will all default to building
a DLL and a "loader" executable (rather than the monolithic exe it build
previously). The monolithic builds can still be done by passing nmake the
MAKEDLL=0 option.

On other (Unix-like) systems, they will default to the monolithic builds.

This all mirrors the gs builds.

Makefile.in
base/gscdef.c
base/std.h
base/unix-dll.mak
pcl/pl/gpcl6dll32.def
pcl/pl/gpcl6dll64.def
pcl/pl/gpdldll32.def
pcl/pl/gpdldll64.def
pcl/pl/gxpsdll32.def
pcl/pl/gxpsdll64.def
pcl/pl/pl.mak
pcl/pl/plapi.h
pcl/pl/plmain.c
pcl/pl/plwimg.c
pcl/pl/plwmainc.c
pcl/pl/plwreg.c
psi/msvc.mak
xps/xps.mak


2016-05-12 12:20:33 +0100
Ken Sharp <ken.sharp@artifex.com>
a39fa755db3f83a1d1fd8611d66dde487ed95f9d

Typo in language.htm

Bug #696775 "Typo in documentation"

Noticed and reported by "rrt@sc3d.org", fixed ehre.

doc/Language.htm


2016-05-12 11:27:22 +0100
Ken Sharp <ken.sharp@artifex.com>
3e825c0ee714a26633395e95bdf143d30b14fc28

Fix gp_get_realtime commit

The gp_get_realtime commit attempted top use both the upper and lower
values in the long[2] array, this turns out to be a bad idea on Unix
systems, because that uses timeofday() instead of time(), and results
in a time_t which causes a GPF in gmtimte() (NB I think its pretty poor that a
function which takes a 64-bit value can cause a GPF if the value is
sufficiently large!)

Instead use only the bottom long. This will, eventually, cause us to
write incorrect time stamps (when we overflow a long), we will have
to look into that when the time comes.

At the same time fix the definitions of gp_get_realtime() and
gp_get_usertime() in gp.h as these were incorrect.

base/gp.h
devices/vector/gdevpdf.c
devices/vector/gdevpdfe.c


2016-05-11 16:15:19 +0100
Ken Sharp <ken.sharp@artifex.com>
646248bf7730c8d2ecf4ff2d06c494a5c280d211

Make pdfwrite use the OS-agnostic gp_get_realtime () function

Also fix the Windows go_get_realtime() function so that it returns
the same values as the other OS's

The change in time_.h is to prevent the definition of timeval if we
have already included windows.h (_WINDOWS_ is defined) as this also
defines timeval (actually in winsock.h, claims to be copied from a BSD
header).

base/gp_win32.c
base/time_.h
devices/vector/gdevpdf.c
devices/vector/gdevpdfe.c


2016-05-11 09:59:09 -0600
Henry Stiles <henry.stiles@artifex.com>
545defc11cdb1b7a1009ccf8103417273fb3d7ee

Coverity fixes.

122662 plparams.c: resource leak.
122664 plparams.c, 122663 pjparse.c: unnecessary null check.
122661 plparams.c: negative returns.
102248 pcpage.c: uninitialized pointer write.
102237 pjparse.c: uninitialized variable.

pcl/pcl/pcpage.c
pcl/pl/pjparse.c
pcl/pl/plparams.c


2016-05-11 14:34:02 +0100
Ken Sharp <ken.sharp@artifex.com>
4e9c4db88f1aff478230b7cb0c32eb60846231a3

remove an unused variable

commit c4a33f573adbf8627f08407e4357475285b46cf0 replaced the variable
'int i' with 'unsigned int j', but left the definition of i, which
meant it was then unused leading to a cppcheck warning.

Simply remove the now unused variable.

devices/vector/gdevpdfg.c


2016-05-11 14:01:47 +0100
Ken Sharp <ken.sharp@artifex.com>
d5008bf9092e99b5eb7f295c9d684850bf2aa66f

Remove a load of macros in the graphics library

The 'load' and 'store' macros were deemed offensive for a number of
reasons; they declared variables, hiding them from casual view, they
hid flow control (switch statements started in one macro, ended in
another), returns from inside macros, some macros were not (and could
not be) bounded by "do{...} while" which means care needed to be taken
with ';' and were very deeply nested, the names chose for the macros
made them look like functions, finally macros are hard to debug, even
with a macro-expanding debugger.

Additionally there were the 'LINE_ACCUM' macros, some of which simply
called the 'load/store' macros directly, which just added another
layer of obfuscation, particularly since these macros were defined in
a different header file. Macros could be nested 4 or 5 levels deep.

This commit finishes removing all but one of the macros, the last
remaining macro has been renamed to upper case to make it clearer that
it is a macro. It can't easily be removed since it depends on the size
of gx_color_index, which is a compile time #define.

The functionality of the macros has either been expanded in line or
replaced with inline functions declared in gsbitops.h. The majority
of the macros have been replaced with functions, even for small functions
where it seemed useful to keep the name as a description of the actual
functionality.

I don't anticipate any differences, but I think this makes the code
easier to understand, easier to debug, and therefore easier to maintain.

base/gdevdbit.c
base/gdevdgbr.c
base/gdevmpla.c
base/gsalphac.c
base/gsbitops.c
base/gsbitops.h
base/gsflip.c
base/gxcindex.h
base/gximag3x.c
base/gximage3.c
base/gxiscale.c
devices/gdevpng.c
devices/gdevxalt.c


2016-05-10 07:21:45 -0600
Henry Stiles <henry.stiles@artifex.com>
473afa3fbc71bd8cd1814f5e9d7f551ebbda436d

Fix Coverity identified dereferences before null check.

Coverity id's: 102199, 10220[012]

pcl/pcl/pcdraw.c
pcl/pcl/pcfrgrnd.c
pcl/pxl/pxgstate.c


2016-05-09 10:42:50 -0600
Henry Stiles <henry.stiles@artifex.com>
a09336ddb6257103ea9d020ed8ace474e1e12df6

Fix Coverity identified potential buffer overflows.

Coverity numbers: 122665 (#1 - #8). Also fixes a reversed argument
problem with an unimplemented function (100212) and a typo with a
previous coverity problem was fixed.

pcl/pl/pjparse.c


2016-05-10 10:15:12 +0100
Chris Liddell <chris.liddell@artifex.com>
2bf16c4c6942ffe38ded65df1d17e485843de4f0

Remove remaining persistent cache code.

base/gp.h
base/gp_dvx.c
base/gp_mac.c
base/gp_mswin.c
base/gp_os2.c
base/gp_os9.c
base/gp_vms.c


2016-05-06 15:54:32 +0100
Chris Liddell <chris.liddell@artifex.com>
db1ecd47087fa139e310d42772cb912184f5bc6a

Remove the (unused) "persistent cache" code

base/gp_unix_cache.c
base/unix-aux.mak
psi/zmisc.c


2016-05-09 09:28:00 -0700
Michael Vrhel <michael.vrhel@artifex.com>
c4a33f573adbf8627f08407e4357475285b46cf0

Change max_components and num_components in dev.color_info to uchar

There are locations in the code where Coverity has complained about
code logic that resulted in passing of unintialized values that
could only occur if num_components < 0 . Since this should never
be the case, we will make it clear by setting num_components and
max_components to uchar. This will limit our support to 256 colors
by a device.

base/gdevdbit.c
base/gdevddrw.c
base/gdevdevn.c
base/gdevdevn.h
base/gdevdgbr.c
base/gdevdrop.c
base/gdevmem.c
base/gdevmpla.c
base/gdevp14.c
base/gdevplnx.c
base/gscspace.c
base/gsdparam.c
base/gsicc_cache.c
base/gsovrc.c
base/gsptype2.c
base/gxblend1.c
base/gxclist.c
base/gxclrast.c
base/gxclread.c
base/gxclrect.c
base/gxcmap.c
base/gxdcolor.c
base/gxdevcli.h
base/gxdtfill.h
base/gxpcmap.c
base/gxshade6.c
cups/gdevcups.c
devices/gdevcmykog.c
devices/gdevpbm.c
devices/gdevrinkj.c
devices/gdevxcf.c
devices/vector/gdevpdfg.c
devices/vector/gdevpsdi.c
psi/zcolor.c
psi/zdpnext.c


2016-05-09 11:04:25 +0100
Ken Sharp <ken.sharp@artifex.com>
ccd831b1b17b7e5f62e43583da51505d202b4de7

Coverity ID 126372 - incorrect test '||' instead of '&&'

base/ttfmain.c


2016-05-09 08:38:27 +0100
Ken Sharp <ken.sharp@artifex.com>
16328264c44400e242fd2a7c0a2b38ef16abfe3c

Coverity IDs 102152, 126374 - 1x check return value and 3x cleanup

Missed a check of the return value from fseek in a prior commit and
3 cases where I added a check of a file operation, exited the function
on error, but did not close the locally opened file.

xps/xpszip.c


2016-05-09 08:30:54 +0100
Ken Sharp <ken.sharp@artifex.com>
ef840222e42df8d69d3e3f8a0f153c8cbe0b96db

Coverity ID 102187 (again) - remove 2 more tests of unsigned variables > 0

Missed the fact there were multiple occurrences in the first commit

xps/xpsttf.c


2016-05-07 09:41:19 +0100
Ken Sharp <ken.sharp@artifex.com>
5aef585cd506caad237972953fe62f013f0fd4e2

Replace the 'sample_load*' macros with inline functions

base/gdevdgbr.c
base/gdevmpla.c
base/gsalphac.c
base/gsbitops.c
base/gsbitops.h
base/gximag3x.c
base/gximage3.c


2016-05-08 10:15:11 +0100
Robin Watts <robin.watts@artifex.com>
49a22e649644cc71e42e8f87954a01322133e96e

Fix memset of incorrect size.

base/gp_psync.c


2016-05-07 12:28:18 -0700
Ray Johnston <ray.johnston@artifex.com>
6329a63a5b358ff2522c9a2fee04afc7dea6e125

Fix Coverity ID's in gdevp14.c (too many for one line)

ID list: 95577, 94594. 94612. 94628, 94637, 94689, 94958, 94978, 95032
95033, 96060

base/gdevp14.c


2016-05-06 17:09:04 +0100
Robin Watts <robin.watts@artifex.com>
43d009b93762d1c69d6f7d08b2fb7962e1ccba78

Coverity 95029: Out of bounds write in gdevijs.c

While parsing params, if we hit the end of the buffer, stop
rather than trying to write into it.

devices/gdevijs.c


2016-05-06 16:16:59 +0100
Robin Watts <robin.watts@artifex.com>
429bddce6bb0089d247e7bd6c32dbb6b7d7efdeb

Coverity 95056: Uninitalised variable use.

The analysis of this case going wrong relies on the variable being
negative. Change it to be unsigned to avoid this.

base/sfilter2.c


2016-05-06 16:07:51 +0100
Robin Watts <robin.watts@artifex.com>
20b13a63253d1271ee1b3eeaea090e269a0f27fb

MSVC: Add missing jpegxr directory to solution

windows/ghostscript.vcproj


2016-05-06 16:05:18 +0100
Robin Watts <robin.watts@artifex.com>
b5e075d70152429f2216ba5d002bdc9e5dadfc14

Coverity 102233: Uninitialised variable use.

Looks like an initialisation was dropped. Copying from similar
functions as inspection suggets this is correct.

jpegxr/r_strip.c


2016-05-06 08:47:41 -0600
Henry Stiles <henry.stiles@artifex.com>
224a4a9a3315873c59e6d688635615ed1a5be3d5

Various Coverity fixes

pjparse.c: 102194 Resource leak and 102181 argument can't be negative,
and 102171 logically dead code.
pjparsei.c: 102174 Dereference after null.
plfont.c: 102189 unsigned compare against 0.
pxfont.c: 102176 Deref after null check.

pcl/pl/pjparse.c
pcl/pl/pjparsei.c
pcl/pl/plfont.c
pcl/pxl/pxfont.c


2016-05-04 15:44:56 -0600
Henry Stiles <henry.stiles@artifex.com>
5f12ea458d83bf9f301fae6066526c4f890bae06

Fix many unchecked returns in PCL.

Coverity ids: 10215[013568], 10216[0579].

pcl/pcl/pcsfont.c
pcl/pcl/pgchar.c
pcl/pcl/pginit.c
pcl/pcl/pglfill.c
pcl/pcl/rtmisc.c
pcl/pl/pjparse.c
pcl/pl/plmain.c
pcl/pxl/pxgstate.c


2016-05-05 10:22:51 +0100
Robin Watts <robin.watts@artifex.com>
8e1d95eea940bca0892f016cd79d6ee72a2219ba

Bug 696703: Shading disappears at high dpi.

The Shading doesn't disappear, it simply plots solid white.

This is due to an overflow in the tensor patch calculations.

(fixed + fixed + fixed)/3 can overflow.

Change this to be (int64_t + int64_t + int64_t)/3.

For efficiency (and improved accuracy) we postpone the /3 until
the end of the series of operations that use it (where it becomes
a /9).

base/gxshade6.c


2016-05-05 13:15:25 +0100
Robin Watts <robin.watts@artifex.com>
7032b71519c04432f2c56748103bd9dfe32ac6ff

Revert "Makefile for Android MuPDF libgs.so"

This reverts commit e350758ceb8d9f7ec6bb209908a6ce1fe35e2397.

Committed in error.

Makefile.android
arch/android.h


2016-05-05 10:19:43 +0100
Robin Watts <robin.watts@artifex.com>
219ac028f804f8470faf502830c545b7858845b4

Remove free variables from macros.

In macro-hell, the lowest level is reserved for macros that
rely on free variables. While removing the macros would be
nicer, this at least moves it up a level.

base/gsshade.c


2016-05-05 09:14:29 +0100
Ken Sharp <ken.sharp@artifex.com>
7cef5b5e9746ade53779ae13989e3d070337ac68

Coverity IDs 94574, 94743, 94524, 94691


ttfmain.c:
Use 'code' instead of 'error', error is the wrong variable to test
Remove pointless code with no effect

ttinterp.c:
Correct a copy/paste error (cur_x should be cur_y)
remove pointless self-assignment

base/ttfmain.c
base/ttinterp.c


2016-05-05 06:59:31 +0100
Ken Sharp <ken.sharp@artifex.com>
e03821104b5752c7b343f7b839ec9a9c01c5f4b1

Fix to commit 5b173d99c6ed3ebbd84eff6e63e987441a5da10d

Slightly over-enthusiastic commit, potentially tried to free an object
'part' before it had been created. Three occurrences in three different
error conditions.

xps/xpszip.c


2016-05-04 18:55:36 -0700
Ray Johnston <ray.johnston@artifex.com>
7b916edd3554e42a4cd3de4c9bd17450e9cbb202

Fix Coverity ID 95026: Code not reachable -- seems to be editing error.

psi/imainarg.c


2016-05-04 13:19:59 -0700
Ray Johnston <ray.johnston@artifex.com>
c2ba126a3ca1b740526b998e5e49a1c6c6f98ce8

Fix Coverity ID: 94491 Buffer not nul terminated.

Leave room for the 'nul' in the count for strncpy.

base/gxclread.c


2016-05-04 13:24:45 -0700
Michael Vrhel <michael.vrhel@artifex.com>
88f49c9ae729336e8b1e68e2e8b231eac56b6d96

Coverity ID 119184

Use floating point math for scaling the colors when doing the smoothness test.

base/gscspace.c


2016-05-04 13:14:02 -0700
Ray Johnston <ray.johnston@artifex.com>
cbe50881d78c9c9bb13745569f806cb92bc14dd9

Fix Coverity ID's: 94501, 94697 and 94712 (only last was non-trivial)

The change to gximask.c checks to make sure that pcpath == NULL is never
dereferenced. Others were minor/trivial and easily fixed).

base/gxclrast.c
base/gximask.c


2016-05-04 11:02:10 -0700
Ray Johnston <ray.johnston@artifex.com>
91158cabe4fd1d4faef98408ed3a36c3cbcc3ec7

Fix Coverity issue 94826, Buffer overrun, 94595 De-ref after NULL check

The 'buf' declaration had 1 instead of 2 for the cap_join case.

The dereference after NULL check is a warning, and two case call the
gx_default_fill_path (for shading fill) where ppath==NULL is OK, but
we add a check before emitting the ppath via cmd_put_path since that
_would_ dereference ppath elements. The first two are "Ignore".

base/gxclpath.c


2016-05-04 08:51:41 -0700
Ray Johnston <ray.johnston@artifex.com>
c98fd2a26df5498593e562b2551b637acebb2896

Fix Coverity issues 94873, 121257, 121258 and 121859.

in gxclpage, strncpy should have the copy length 1 less than buffer size
so that there will be room for the terminating nul. Also check return
from clist_close_writer_and_init_reader.

The scan of saved_pages_keys needed the countof, not sizeof the array
of pointers (sizeof(a)/sizeof(a[0]))

base/gxclpage.c


2016-05-03 18:00:39 +0100
Robin Watts <robin.watts@artifex.com>
a6a7e077b4936f82a32b5de1c944ae14c1881950

Fix potential cleanup error in pthreads handling.

When creating a semaphore, if the mutex inits, but the condition
variable doesn't, we'd fail to destroy the mutex.

base/gp_psync.c


2016-05-04 09:52:45 +0100
Ken Sharp <ken.sharp@artifex.com>
5b173d99c6ed3ebbd84eff6e63e987441a5da10d

Coverity IDs 102152, 102157, 102159, 102161, 102162, 102164, 102182, 102183

A load of unchecked return values from fseek/fread

xps/xpszip.c


2016-05-04 09:31:21 +0100
Ken Sharp <ken.sharp@artifex.com>
ab551afbaa92aacf0a451364e1273ff6e138fab5

Coverity ID 102152 - check if fseek failed and throw error if so

xps/xpszip.c


2016-05-04 09:25:59 +0100
Ken Sharp <ken.sharp@artifex.com>
4327987dc81df5f9e48af83de340af8973c529cb

Coverity ID 102188 - remove redundant check if unsigned variable < 0

xps/xpsttf.c


2016-05-04 09:24:53 +0100
Ken Sharp <ken.sharp@artifex.com>
eeeeacfb3c62ec7954b3982edab3d39c4a4faccc

Coverity ID 102187 - remove a redundant check of unsigned variable < 0

xps/xpsttf.c


2016-05-04 09:23:20 +0100
Ken Sharp <ken.sharp@artifex.com>
4b252650fa3d07348b680b3b19e3d3b8672eafc2

Coverity ID 102187 - check and action a return code

xps/xpstop.c


2016-05-04 09:19:45 +0100
Ken Sharp <ken.sharp@artifex.com>
e99becee24fd1608084c734e34be5297ec3b4141

Coverity ID 102257 - check and action a return value

At the same time, cleaned up a whole load of potential memory leaks
on error conditions.

xps/xpspage.c


2016-05-04 09:13:41 +0100
Ken Sharp <ken.sharp@artifex.com>
fca4b8dab7f588c9e7439ce7c06d347b6eeabf59

Coverity ID 102184 - fix white space indenting

xps/xpsmem.c


2016-05-04 09:11:51 +0100
Ken Sharp <ken.sharp@artifex.com>
358c42de2691b9b0adb020244d6c70a20d94257c

Coverity ID 102195 - clean up memory on error exit.

xps/xpsjxr.c


2016-05-04 09:08:36 +0100
Ken Sharp <ken.sharp@artifex.com>
7c95a58878fd3fca7b964eb6e067cac55587286e

Coverity ID 102246 - initialise a pointer variable

xps/xpsgradient.c


2016-05-04 09:04:06 +0100
Ken Sharp <ken.sharp@artifex.com>
b933637c55943ce50eefdd665666ec7fc90fa25b

Coverity ID 102235 - initialise a memory array to 0

xps/xpscff.c


2016-05-04 08:43:45 +0100
Ken Sharp <ken.sharp@artifex.com>
e1ac3e1ce877bbbc89edbd719fab6ee304e0da38

Luratech decoder - set the initial colour space to 'unset'

If the image dictionary has a ColorSpace we set the colorspace member,
and if we get to disconvering the 'N' value, and its still unset then
we set it from the N value. But the Luratech decoder 'set_defaults'
method didn't initially set the colorspace member to 'gs_jpx_cs_unset'
so we might never set it from the /N value.

base/sjpx_luratech.c


2016-05-04 08:34:51 +0100
Ken Sharp <ken.sharp@artifex.com>
b8678aa57feaf7fa60273f7c0e4fe28e44fa78c3

Coverity ID 94683 - check pointer is not NULL before dereference

I'm pretty sure this can't happen, but this makes certain.

psi/zcontext.c


2016-05-02 07:55:50 -0700
Ray Johnston <ray.johnston@artifex.com>
d56fc8010e3c8456e565bab38eb54d7f218bed27

Prevent buffer overrun during image interpolation (NOCIE, UseFastColor)

When using NOCIE and UseFastColor to revert to non-ICC color conversion,
we encounter a few instances where we decode samples, but the buffer was
not being allocated for it. Bug691466.pdf and fts_17_1700.pdf through 1707
and fts_31_3116.pdf were examples going to ppmraw.

base/gxiscale.c


2016-05-03 09:03:54 +0100
Ken Sharp <ken.sharp@artifex.com>
e4c06b9c1cd3130cbbd4fc5599e55056f2136cf1

Bug #692945 " Need warn equivalent of -dPDFSTOPONERROR, like -dPDFSTOPONWARN"

This commit adds (and documents the new command line switch
PDFSTOPONWARNING. When set this will cause the PDF interpreter to raise
an 'undefined' error if a warning is encountered, and stop processing
the input.

Note that PDFSTOPONWARNING implies that PDFSTOPONERROR is true, and sets
it if it is not.

Resource/Init/gs_init.ps
Resource/Init/pdf_main.ps
doc/Use.htm


2016-05-02 15:24:33 +0100
Ken Sharp <ken.sharp@artifex.com>
e8fe0ee8255c0ee8a71e811ddeeb49a211dd6586

Bug #696687 - cannot open encrypt pdf file

We need to treat a /StmF value of /Identity the same as we would if the
key was missing....

No differences expected

Resource/Init/pdf_sec.ps


2016-05-02 13:31:35 +0100
Ken Sharp <ken.sharp@artifex.com>
6b7d44b001788183e1222856ad84737612c84466

Coverity ID 94530 (again) - Check and action a return code

Missed a second occurence of the same thing.

devices/vector/gdevpdfm.c


2016-05-02 12:28:59 +0100
Ken Sharp <ken.sharp@artifex.com>
3c99fe662db97d01a76e59a9548dd49ce6b65256

Coverity ID 94730 - fix an incorrect index

This one's a puzzle. Coverity is absolutely correct that the '-1'
is invalid, as we use it later as an array index, in fact we possibly
use it in several different sub-functions, as an array index, and its
not valid for it to be negative in any of them. There are no tests
on the value to take special action.

I'm forced to conclude that it should simply be a positive '1' not a
negative '1'.

I am also unable to get the code to take this path, so I can't test the
change, but the -1 was definitely wrong, and a step of 1 looks correct.

base/gsfunc0.c


2016-05-02 11:57:22 +0100
Ken Sharp <ken.sharp@artifex.com>
08d98e00bc18b47bdf357f2c3f3ba5f47995ce68

Coverity ID 94487 - use pre-calculated value to avoid shift

base/gsfunc0.c


2016-05-02 09:43:34 +0100
Chris Liddell <chris.liddell@artifex.com>
7253f0cfd8f67ffab1683fb1ad9c54b4250a930f

Coverity ID: 125783

Move memory freeing into the common cleanup code before function returns:
fixes leak in event of an error.

Also, add some pointer initialisation for safety.

base/mkromfs.c


2016-05-02 09:41:28 +0100
Chris Liddell <chris.liddell@artifex.com>
a8f8634c36cdfcf516cd0576127a84f1b09921c2

Coverity ID: 125785

Move string buffer freeing *after* the error message that uses the buffer

base/genconf.c


2016-05-02 09:35:07 +0100
Chris Liddell <chris.liddell@artifex.com>
417aacf016f3e4298e9c825aa9b4586434b36a76

scan-build warnings in zfapi.c and gxfapi.c

zfapi.c: initialize pointer and check it's valid before using it

gxfapi.c: remove unnecessary assignment.

base/gxfapi.c
psi/zfapi.c


2016-05-02 09:44:18 +0100
Ken Sharp <ken.sharp@artifex.com>
ebdb8acb36a8084089fa7093882a40a4484640fb

Coverity ID 94546 - correct impossible condition

the a_all bit mask does not include the 'a_executable' bit, making the
r_has_masked_attrs() test always return false. We do not have a test
case for this invalid parameter, but I think this is at least an
improvement.

psi/zshade.c


2016-04-30 11:18:12 +0100
Chris Liddell <chris.liddell@artifex.com>
c8827f917d2ff40ffeda384fa8df0ceaed2670de

Coverity IDs: 94798, 94930, 94932, 94951, 95022

94798: check for null before using pointer

94930: Initialize structure before using

94932: use %d for "int" in printf (rather than %ld)

94951: Use an intermediate string buffer (limiting string size) to protect from
buffer overflow.

95022: use %d for "int" in printf (rather than %ld)

base/mkromfs.c


2016-04-30 11:07:01 +0100
Chris Liddell <chris.liddell@artifex.com>
ad59c4428676c61ce2c44b21d76b84154bbec26d

Coverity IDs: 94527, 94804, 94888

94527: fix ignored return value

94804: the code could not fall into the condition Coverity warned about (the
condition is checked by the calling code. But adding a "default" to the innner
switch should clear the warning, make the code clearer, and not cost us
anything.

94888: explicit cast to avoid unintended sign confusion.

psi/zfapi.c


2016-05-02 08:26:14 +0100
Ken Sharp <ken.sharp@artifex.com>
7ba62042a98039203b45b019ffc523778de38513

Coverity ID 94706 - fix a copy/paste error

Commit 1ba0d89544ba6d057867648027c5a6919888c619 was meant to test for
'pgd' being non-NULL but a silly copy/paste error tested 'pgd->bits.data'
by mistake.

base/gstype1.c


2016-05-02 08:19:43 +0100
Ken Sharp <ken.sharp@artifex.com>
94c7469f9d4dff9c32314b95b89f00e584ec1ed4

Coverity ID 125639 (again) - clamp page number to 0

Commit 83353631064ac5307a9b62877d5a0664e7ac800e fixed 2 occurrences
but missed a 3rd one.

base/gdevflp.c


2016-05-02 08:16:21 +0100
Ken Sharp <ken.sharp@artifex.com>
8b8725f7fbf9bd51a20459caeeda487bee019cf4

Coverity ID 121436 (again) - guard a 2nd place where a pointer is dereferenced

Commit 5655e62da7ad0a4c6368994a11cdb9954d1fa296 missed a second place
where 'textures' is dereferenced.

base/gdevdrop.c


2016-05-02 08:11:54 +0100
Ken Sharp <ken.sharp@artifex.com>
38de4f3a79583a2b7147a369a86cb1e599331300

Coverity ID 94765 (again) - really make sure array index is not negative

commit fa1757fe4317171cd45755d0b66111ebf12be920 only fixed half the
problem (possibility of num_planes being 0 or less), technically we can
still go round the loop and have no planes requested (params-data[]
all being 0). This should never happen of course, but this ensures that
if it does we throw an error, instead of crashing.

base/gdevdgbr.c


2016-05-02 08:05:02 +0100
Ken Sharp <ken.sharp@artifex.com>
ee023598f2f16ab07cd4dced768729a39c2a9369

Coverity ID 94880 (again) - explicit cast to avoid signed implicit cast

Missed a couple of cases the first time....

base/aes.c


2016-05-02 08:00:14 +0100
Ken Sharp <ken.sharp@artifex.com>
2d8ddfb13033f53795120eb700e9618e0b15f486

Coverity ID 125784 - initialise a variable

base/gdevdbit.c


2016-04-30 10:14:30 +0100
Ken Sharp <ken.sharp@artifex.com>
957f6cdd4376a12e7b037808f8c9326887d32ef3

Bug #696334 - Don't clean up exec stack after a stackoverflow error

The problem is that the CET file leaves junk on the operand stack after
running the colour transform, it also runs three nested loops, 10 steps
in each loop, for each of the of R, G and B components. This (eventually)
leads to a stack overflow error.

This wouldn't normally be a problem, but we then go round and increase
the stack size, and retry the operation. But, because we had removed the
execution stack operands, the operator failed, leading to a typecheck
error.

We can (and I have) fix this by not popping the elements off the exec
stack when the error is a stackoverflow. This permits us to properly
clean up the exec stack for other types of error, and we can hope that
the stackoverflow is self-correcting. Its not ideal but its the best I
can think of.

No differences expected

psi/zcolor.c


2016-04-29 10:07:10 -0700
Michael Vrhel <michael.vrhel@artifex.com>
b24e0938edf4477a8d318e79a60497fd39e25a57

Bug 696700: Reduce error messages in release

base/gsicc.c


2016-04-29 15:49:57 +0100
Ken Sharp <ken.sharp@artifex.com>
71fdcc8a7e15271928587637def7187c1e2ac807

Coverity ID 94498 - Make size clearer

There was nothing actually wrong with the previous code, but it took
the sizeof() a value rather than using the #define for the actual
number of bits in a color_value, using the #define is clearer

psi/zdpnext.c


2016-04-29 15:23:41 +0100
Ken Sharp <ken.sharp@artifex.com>
9980daa62eb9909ef5a33935886df24008180c4b

Coverity ID 94732 - prevent a NULL dereference

psi/zcontext.c


2016-04-29 14:42:54 +0100
Ken Sharp <ken.sharp@artifex.com>
7b96281dec9a53a56a444ef18f00a8c6611a4395

Fix bug in Commit 117eac07f12948d4c581335a5587c22815ad18dd

As was more or less inevitable, I made a mistake in one of these
Coverity fixes. I believe this resolves the problem

psi/iutil.c


2016-04-29 11:57:40 +0100
Ken Sharp <ken.sharp@artifex.com>
85ebe6e6ec96e0f24ca057fe6b628bf9d33e61e6

Coverity ID 94603 - guard against a NULL pointer dereference

Other cases return error, but ths is a void function....

psi/zcontext.c


2016-04-29 11:50:11 +0100
Ken Sharp <ken.sharp@artifex.com>
117eac07f12948d4c581335a5587c22815ad18dd

Coverity ID 95013 - prevent a potential 1 byte buffer overrun

psi/iutil.c


2016-04-29 11:25:54 +0100
Ken Sharp <ken.sharp@artifex.com>
ab82e27e0941582a879f01e53a6fd7e41dcf8bb2

Coverity ID 94852 - explicit cast to prevent 32-bit overflow

base/siscale.c


2016-04-29 11:20:40 +0100
Ken Sharp <ken.sharp@artifex.com>
8ccd0c1a010e78de76e7f84c5659964444de53fe

Coverity ID 94564 - remove dead code

I'm practically certain we don't use this code anyway since the adoption
of FreeType.

base/gzspotan.c


2016-04-29 11:15:09 +0100
Ken Sharp <ken.sharp@artifex.com>
e2d61987cc597e121ff68b9cdf3a80f82fce03e2

Coverity ID 95044 - remove dead code

A 'goto' was unreachable, being preceded by a goto (after macro expansion)
Replaced with a break just to match the other cases.

base/gxtype1.c


2016-04-29 11:10:59 +0100
Ken Sharp <ken.sharp@artifex.com>
6df3e33a8445ef53ab5cb5debdf28b2384001284

Coverity ID 94883 - array overrun

This appears to be genuinely a potential problem. A triangular line cap
requires 3 points which, together with the start and end points
results in a total of 5 points, the array is only 4.

Extend the array to 5 to ensure that we cannot run off the end.

base/gxstroke.c


2016-04-29 10:46:07 +0100
Ken Sharp <ken.sharp@artifex.com>
2eeb1cf7951dc0184082adbaf30167eac4dffcf9

Coverity ID 94664 - make an else clause clearer

The >0 (actually == 1), < 0 cases were already covered, and terminated
with a goto, so the only way to get here was if code == 0, so it
doesn't actually matter if we enclose the 'else' clause in
parentheses or not, in any event we will execute the 'goto out'.

But this is clearer.

base/gxshade6.c


2016-04-29 10:25:46 +0100
Ken Sharp <ken.sharp@artifex.com>
f083229e242b8a0ce4f55935a17ad006502bc5bb

Coverity ID 94537 - inconsistent use of a variable

It doesn't actually seem to matter whether we use 'big' or 'big1' here
but we should be consistent throughout, since they need not be the
same. Three places use big1 (which is variable, big remains unchanged)
and one uses big, so I believe that is the incorrect case and have
changed it accordingly,

base/gxshade6.c


2016-04-29 09:12:42 +0100
Ken Sharp <ken.sharp@artifex.com>
55bb1e8f7c3ff1bfcf6bea0149f7ce05c2323401

Coverity IDs 94982, 95068 - extend 2 arrays by 1 to prevent overrun

I can't quite convince myself that its impossible to overrun these arrays
and it only costs 8 bytes of heap storage, so lets just extend them.

base/gxpcopy.c


2016-04-29 09:11:09 +0100
Ken Sharp <ken.sharp@artifex.com>
9bb3550bb02656203e29e6984160cc097757bcb6

Coverity ID 94547 - don't ignore a return value

I think its very unlikely this could ever cause a problem, but it is
theoretically possible.

base/gxpcopy.c


2016-04-29 08:47:41 +0100
Ken Sharp <ken.sharp@artifex.com>
4b87ec33e0bd4b0383e186e9b4d5d21fe20fa98f

Coverity IDs 94875, 95076 - explicit cast to avoid integer overflow

I don't believe this is a real problem.

base/gxpcmap.c


2016-04-29 08:28:08 +0100
Ken Sharp <ken.sharp@artifex.com>
4080ef1c210020e6c3ba22f5b21b5eb6181cc28e

Coverity ID 94693 - Fix a return check

The code looks like it was originally of the form:
if ((code = .....) < 0)
and has been changed to return the error code instead, but the
'< 0' was accidentally left behind.

base/gxpcmap.c


2016-04-28 17:04:36 +0100
Ken Sharp <ken.sharp@artifex.com>
07c424bda4443ab51442d18fe8502a9610efd070

Coverity ID 121447 - explicit cast to avoid potential overflow

base/gxcmap.c


2016-04-28 16:55:05 +0100
Ken Sharp <ken.sharp@artifex.com>
22d1de0456139c2e93e67372f574536794800268

Coverity ID 94874 - remove pointless code

There was no point in checking for penum being NULL as we had already
dereferenced it. I'm certain we should not get here with penum NULL.

base/gxccache.c


2016-04-28 16:35:11 +0100
Ken Sharp <ken.sharp@artifex.com>
1f324ef9520f49ee03136c8c8a438662d3d1fba0

Coverity ID 94584 - prevent a potential divide by zero

This would only be possible with an invalid font, but we've seen plenty
of those over the years!

base/gstype2.c


2016-04-28 16:08:52 +0100
Ken Sharp <ken.sharp@artifex.com>
1ba0d89544ba6d057867648027c5a6919888c619

Coverity ID 94873 - prevent a potential NULL dereference

I'm almost certain this condition cannot arise, but lets be safe.

base/gstype1.c


2016-04-28 15:36:07 +0100
Ken Sharp <ken.sharp@artifex.com>
8b5def7074f49c4a231b5b49046af2a510c0fa37

Coverity ID 121453 - reorder code to check pointer before dereferencing

base/gsshade.c


2016-04-28 14:33:45 +0100
Ken Sharp <ken.sharp@artifex.com>
60455507951739cc7826c9e0429d1273adf6b87c

Coverity ID 94900 check and action a return code

base/gspaint.c


2016-04-28 14:31:33 +0100
Ken Sharp <ken.sharp@artifex.com>
4722eeefcd1f084e335422b53d6b87b5e73efa18

Coverity ID 94849 - initialise a member of a structure

I'm certain this doesn't matter, but this should get rid of the warning.

base/gsovrc.c


2016-04-28 14:26:19 +0100
Ken Sharp <ken.sharp@artifex.com>
4a550a4bdca8dec8cd7907bfc11d9ce454f85dbf

Coverity ID 94555 - check a return code

And if we overflowed the buffer, emit the customary 'truncated'
warning after writing the output.

base/gsmisc.c


2016-04-28 13:57:26 +0100
Ken Sharp <ken.sharp@artifex.com>
6ab7be0da61c115d95ecead8ba5be99dfb82e777

Coverity ID 94583 - guarantee prevention of NULL dereference

I don't think this was actually possible to generate, as p_ctx->profiledir_len
ought to be 0 if p_ctx->profiledir is NULL.

But this is safer.

base/gslibctx.c


2016-04-28 13:47:02 +0100
Ken Sharp <ken.sharp@artifex.com>
6957a9b2daad5256ae91f7416cc62368e0817847

Coverity ID 94864 - don't dereference a pointer until after NULL check

base/gsioram.c


2016-04-28 13:43:55 +0100
Ken Sharp <ken.sharp@artifex.com>
e92d375e70f9db4f332135a8dba1d4b5ef5379a0

Coverity ID 95053 - ensure we do not dereference a potential NULL pointer

base/gsht.c


2016-04-28 13:23:34 +0100
Ken Sharp <ken.sharp@artifex.com>
29570038d7a5ef3e0e606a8e92680a7a2a159a8d

Coverity ID 94649 - prevent potential NULL dereference

base/gsht.c


2016-04-28 12:15:10 +0100
Ken Sharp <ken.sharp@artifex.com>
6911125a371ba43f2014e43d4a3a12516aeebad9

Coverity IDs 94657, 94867, 94995

Set some array contents to NULL to ensure we cannot access uninitialised
data. Ensure an array index cannot be negative (return error if it
ever is).

base/gsfunc4.c


2016-04-28 11:53:49 +0100
Ken Sharp <ken.sharp@artifex.com>
2bf6fe4fe5b0e32cc8961843e7f4752f13536208

Coverity ID 94844 - pay attention to parameter checking

We checked the parameters for validity, but ignored the result !

base/gsfunc3.c


2016-04-28 11:42:05 +0100
Ken Sharp <ken.sharp@artifex.com>
a51b3d81caf2936ad017236b6099bc97acf5584a

Coverity ID 121451 - explicit cast to avoid potential overflow

base/gdevmr2n.c


2016-04-28 11:33:04 +0100
Ken Sharp <ken.sharp@artifex.com>
ba0d94c3f1628f1f36358e7ff513d699bf5aa87c

Coverity ID 94662 - ensure argument is not NULL

gx_make_rop_texture_device checked 'target' to see if it is NULL, but
then later dereferenced target without checking. It 'looks like' this
is a condition which can't happen, because we would get a seg fault.

In fact it is only called from one place, and that location
(gx_image_enum_begin) can return an error, so I've chosen to ensure
that the argument cannot be NULL before calling gx_make_rop_texture_device

base/gdevrops.c
base/gxipixel.c


2016-04-28 10:23:31 +0100
Ken Sharp <ken.sharp@artifex.com>
a1625fe7efe8da391f77932f866504ee75b936ac

Coverity ID 94796 - guard against (throw an error) possible NULL dereference

base/gdevprn.c


2016-04-27 16:42:18 +0100
Ken Sharp <ken.sharp@artifex.com>
d9cc10861f21fe7c5dde8836a09028d9ad8b8d97

Coverity ID 94705 - prevent a NULL pointer dereference

gs_cie_jc_complete dereferences pis->cie_render.

base/gsciemap.c


2016-04-27 15:27:35 +0100
Ken Sharp <ken.sharp@artifex.com>
405236003e7a0cc472f46fda556f011d58cc2ca9

Coverity ID 121450 - explicit cast to 64-bit type, avoids faulty implicit 32-bit cast

base/gsbitops.c


2016-04-27 15:04:26 +0100
Ken Sharp <ken.sharp@artifex.com>
1446fbba1351efc867f9dedcc96c27e8be0c4f06

Coverity ID 94825 - initialise struct members so copying doesn't give a warning

base/gsalphac.c


2016-04-27 14:35:15 +0100
Ken Sharp <ken.sharp@artifex.com>
b04a8f07705611a731629ca328f117b12e617776

Coverity ID 125641 - remove a harmless line of dead code

base/gsalloc.c


2016-04-27 14:26:44 +0100
Ken Sharp <ken.sharp@artifex.com>
dab434b2058d77088c6f495904602b30539effd1

Coverity ID 121452 - resource leak

free 'filekey' if we successfully allocated it, and then later aborted.

base/gp_unix_cache.c


2016-04-27 10:09:20 +0100
Caolán McNamara <caolanm@redhat.com>
abeee8de532a512aeb5e4b0c3f7b11abcea30b72

Resolves: gs#696735 valgrind bits_bounding_box uninitialized values

base/gxfapi.c


2016-04-26 11:07:14 +0100
Chris Liddell <chris.liddell@artifex.com>
934af9c2ac583542d7a167cda75b83e79adc6c7e

Coverity IDs: 36550, 94906, 94907, 95028, 95064

36550: handle errors from file operations.

94906, 94907, 95028, 95064: ensure we don't overflow string buffers.

base/genconf.c


2016-04-26 11:05:43 +0100
Chris Liddell <chris.liddell@artifex.com>
0efb1a2a5b49dab22afb2cb9985f6fb155f1db29

cppcheck: uninitialized variable in gsmd5.c

In practice, porbably can't happen - simple initialization should resolve the
warning

base/gsmd5.c


2016-04-26 11:04:44 +0100
Chris Liddell <chris.liddell@artifex.com>
1de3af7338592b108fa01dfed496df3092ed1fa9

Address some error handling issues in mkromfs.c

cppcheck reported some potential resource leaks in error conditions.

base/mkromfs.c


2016-04-26 09:05:49 +0100
Chris Liddell <chris.liddell@artifex.com>
94c93f7841ad4b90522756acc7ed0083475cd74a

Change allocator initialization.

cppcheck reckoned the pointer to the memory allocator (cmem) could possibly be
a NULL pointer dereference (in fact, that's not true).

But a simple tweak to how cmem is initialized can prevent the error arising.

base/fapi_ft.c
base/fapiufst.c


2016-04-27 10:23:10 +0100
Ken Sharp <ken.sharp@artifex.com>
33b190011e6aa70b7ab2049842a10b090544c2d1

Coverity ID 94842 - initialise some variables

Worst case (I think) would have resulted in indeterminate, incorrect,
rendering, so not a huge issue but fixed just in case.

base/gdevmpla.c


2016-04-27 10:02:22 +0100
Ken Sharp <ken.sharp@artifex.com>
1497b768ef1463a952f981a97b66900138268005

Coverity ID 94578 - avoid dereferencing a pointer if its NULL

The variable 'textures' was checked for being NULL before assigning
traster from it, but we then later used textures without checking it.

I did consider adding a similar check to the original one here, at the
point flagged by Coverity, but the loop would then have proceeded to
use a NULL pointer as an array, leading to further problems.

I suspect that textures cannot (or at least should not) be NULL, and
none of our test files exercise ths case. So I've chosen to simply
return if it ever is.

base/gdevmpla.c


2016-04-27 09:36:30 +0100
Ken Sharp <ken.sharp@artifex.com>
fbeade5f65fe17607df5da0b20ab562c2e68dc01

Coverity ID 94508 - check and action a return code

base/gdevmem.c


2016-04-27 09:10:12 +0100
Ken Sharp <ken.sharp@artifex.com>
5655e62da7ad0a4c6368994a11cdb9954d1fa296

Coverity ID 121436 - guard against a NULL dereference

textures is checked for NULL in the procedure initialisation, so it
seems it may be possible for it to be NULL. Make sure we don't try to
dereference it if so.

base/gdevdrop.c


2016-04-27 08:34:14 +0100
Ken Sharp <ken.sharp@artifex.com>
fa1757fe4317171cd45755d0b66111ebf12be920

Coverity ID 94765 guard against invalid array index

We checked to ensure that no more than 1 plane was requested, but we
didn't check to ensure that at least 1 plane *was* selected.

base/gdevdgbr.c


2016-04-26 10:22:56 -0700
Michael Vrhel <michael.vrhel@artifex.com>
da2d4893743831b9739eaa3f7f4373e011a39e36

Coverity ID 94879 and 94963 Performance inefficiency

Pass pointer to landscape information instead of structure when
applying threshold.

base/gxht_thresh.c
base/gxht_thresh.h


2016-04-25 15:45:41 -0700
Ray Johnston <ray.johnston@artifex.com>
341a0b9a1268cb246c1e0cc12d684a59b39cf876

Fix nocm (-dUseFastColor) allocation when using NumRenderingThreads>0

Rendering threads use a chunk_memory allocator that is, by nature, not
GC'ed so its non_gc_memory points to itself, but the icc_cache_cl of the
(and the icc_cache_list[]) link caches use thread_safe_memory (the heap
allocator) so when the thread exits, we have "leaked" nocm elements from
the chunk allocator (seen with a DEBUG build) and end up with stale pointers
in the link_cache that cause SEGV when the link cache's contents are removed.

Problem seen with:
-dNOCIE -dUseFastColor -dNumRenderingThreads=1 -dMaxBitmap=0 j9_acrobat.pdf

base/gsicc_cache.c
base/gsicc_nocm.c


2016-04-26 15:39:02 +0100
Chris Liddell <chris.liddell@artifex.com>
979d208cb52fb7fda65d742aa09311067c60aba6

Bug 696733: Make sure we have an open file before writing to it

The lj3100sw writes the last data to the output file on closing, but if there
have been no pages written, there is no open output file.

On close, check we have an open (non-NULL) output file before attempting to
write the final data.

devices/gdevl31s.c


2016-04-26 15:40:41 +0100
Ken Sharp <ken.sharp@artifex.com>
10da8a2209c066b9060e2de0c2641a977266d115

Typo in commit 7f42fb28229370fa9829c56c42e203ba3da5c1d2

I put the parenthesis in the wrong place and missed the failure to
compile due to the cluster being very busy

base/gdevdbit.c


2016-04-26 15:15:15 +0100
Ken Sharp <ken.sharp@artifex.com>
e1c3a86d9d9845c717bd09b65b219b2add238ac8

coverity ID 104077 - pass a large data structure as a pointer

base/gdevdevn.c
base/gdevdevn.h
devices/gdevgprf.c
devices/gdevtsep.c


2016-04-26 15:14:12 +0100
Ken Sharp <ken.sharp@artifex.com>
7f42fb28229370fa9829c56c42e203ba3da5c1d2

silence compiler warning, make sure variable is initialised

base/gdevdbit.c


2016-04-26 14:38:08 +0100
Ken Sharp <ken.sharp@artifex.com>
24065aee02fd942cd81ff373514489e9e6177491

Coverity IDs 94687 & 94762 - prevent NULL dereference

Don't attempt to set pequiv_colors data, if the pointer is NULL

base/gdevdevn.c


2016-04-26 14:15:37 +0100
Ken Sharp <ken.sharp@artifex.com>
5649f1d05a3dbdd7dfc969b0b7b05328bde07629

Coverity ID 94589 and 94687 - prevent a NULL dereference

The code contained a poorly named macro (copy_tile) which executed
a device method without testing to see if it was NULL. We know from
prior work that the original intention was that device methods should
*never* be NULL, but we also know that some devices do have NULL methods
and indeed this very routine sets some NULL methods.

So to be safe we now check the method before executing it. At the same
time I've renamed the macro, using upper case so we have some chance of
seeing its a macro, and prevents the macro name collisions with the
code in gdevwddb.c and gdevwprn.c.

I also rewrote it to use if....else instead of ? : because it was
practically unreadable before.

Removed the (pointless) 'return_if_interrupt' macro.

Finally, added the do..while(0) construction around the macro body.

base/gdevdbit.c


2016-04-26 13:15:24 +0100
Ken Sharp <ken.sharp@artifex.com>
fc2e6a0517d4ecc7a486647da8bfaa9e1ab9e03e

Coverity ID 121448 - change the order of casting

Change the cast position to avoid implicit type promotion, and consequent
potential integer overflow.

I don't believe this is really a problem, but the explicit early casting
prevents any problems and makes no differences otherwise.

base/gdevabuf.c


2016-04-26 11:56:42 +0100
Ken Sharp <ken.sharp@artifex.com>
e79881cba48fcbfa84d09a4c0f78cfaaf53347d9

Coverity IDs 94851, 94872, 94880, 94884, 94885, 94918, 94939, 95050, 95061

I *think* that casting the intermediate result to an unsigned int should
prevent the implicit cast to a signed int, which will prevent the
sign extension which Coverity is warning about.

I'll check after the next Coverity submission and rework this if it
should turn out to be insufficient.

base/aes.c


2016-04-25 16:32:00 -0600
Henry Stiles <henry.stiles@artifex.com>
bc5657a8613d078d5774a5453d47fa9c5f410f54

Bug 696675 - UI message in output file.

Update this file to be a bit more in sync with its analog in gs
dwmain.c. Hopefully by redirecting output to stderr we will avoid the
issue reported in the bug where error messages were being directed to
output files. I was unable to reproduce it locally with Windows 10 once
the changes were applied.

pcl/pl/plwmainc.c


2016-04-24 15:01:32 -0700
Michael Vrhel <michael.vrhel@artifex.com>
86f15f469c2015a6f2c85593eab08c3625a24df2

Coverity ID 95017 Null dereference possible

Check for device NULL and if it is return NULL for link
in the replacement color code.

base/gsicc_replacecm.c


2016-04-24 14:58:27 -0700
Michael Vrhel <michael.vrhel@artifex.com>
2761b30ed29f3e6b87ebe739fbb289d5c345db44

Coverity ID 94960: Dereference before NULL check.

It has already been checked if pis was NULL on
all the paths leading to this, so remove the check here.

base/gsicc_nocm.c


2016-04-24 14:55:06 -0700
Michael Vrhel <michael.vrhel@artifex.com>
c09d5f52594f04966d93c7001fec49707970e6bf

Coverity ID 94714: Possible Null Dereference

If device is NULL in the no_cm color management return NULL for the link.
The device is required for this transform.

base/gsicc_nocm.c


2016-04-24 14:49:09 -0700
Michael Vrhel <michael.vrhel@artifex.com>
142ebba4e98047b0ebd1acce28911b042c19f899

Coverity ID 125642 Possible dereference NULL issue

Make sure we do the testing correct to avoid any
possible dereference of NULL.

base/gsicc_cache.c


2016-04-24 14:36:48 -0700
Michael Vrhel <michael.vrhel@artifex.com>
d683717565b3e09ff6bcacbc1fec50352cd08507

Coverity ID 94673 Dead code removal

base/gsicc_cache.c


2016-04-23 12:37:23 -0700
Ray Johnston <ray.johnston@artifex.com>
4d417ff8cbfe7b6a04a15bc9f898e77ab2ffd737

Change PS interpreter allocator chunks to clumps.

We are in the confusing position of having the PS interpreter
allocator that allocates in chunks, along with a chunked allocator.

To avoid this confusing clash of terminology, we do some
global renames to change the standard allocator to allocate
in 'clumps' instead.

base/gdbflags.h
base/gdevprna.c
base/gxobj.h
psi/ialloc.c
psi/igcref.c
psi/imain.c
psi/imainarg.c
psi/iminst.h
psi/inameidx.h
psi/interp.c


2016-04-25 17:09:50 +0100
Ken Sharp <ken.sharp@artifex.com>
d1cc9c37f2b437244235222832989b4f0fb42ae4

pdfwrite - continue writing fonts even after one fails

File Bug693711.pdf has a number of broken fonts which we cannot write
out (Acrobat throws an error on these pages in the original PDF file).
Previously when we encountered an error writing a font we would stop
writing fonts, even the ones which were valid.

Here we store the error (we don't want to forget there was one, so we
can report it at the end) but carry on emitting the PDF file. This
does a better job of emitting a file from broken input.

devices/vector/gdevpdtw.c


2016-04-25 09:21:24 -0600
Henry Stiles <henry.stiles@artifex.com>
dca281c3d8011a2afe3caadc23009fe38d8df839

Bug 696314, Add PJL to staple documents.

Staple setting for the PXL devices courtesy of Hin-Tak Leung.

devices/gdevlj56.c
devices/gdevpxut.c
devices/gdevpxut.h
devices/vector/gdevpx.c


2016-04-25 15:12:45 +0100
Ken Sharp <ken.sharp@artifex.com>
22e08ac60e5363282631b596e996c0d0ad806484

pdfwrite - clear/delete extra temp files when run with %d in OutputFile

Bug #696727 "Regression: pdfwrite leaves temp files"

For some reason this does not exhibit on Windows, I have no idea why.
This commit adds a call to the function that closes and removes
pdfwrite's temporary files if we exit due to a '%d' in OutputFile in
order to prevent a spurious extra file being output.

For me this fixes the problem on Linux.

devices/vector/gdevpdf.c


2016-04-25 13:20:35 +0100
Chris Liddell <chris.liddell@artifex.com>
efe7fd03e0ca45aac5ee4610ed9a23b7ea712e0d

Bug 696730: print meaningful error when device shutdown fails

When we explicitly close the default device, previously we just printed the
error code, and a reference to gserrors.h - this finds the error code in the
Postscript world, and prints the Postcript error string instead.

psi/imain.c


2016-04-25 10:17:48 +0100
Chris Liddell <chris.liddell@artifex.com>
17b6456984a0676a8cf271ff7abc29fdd5ff10a5

Coverity IDs 95065, 121457: tidy up error conditions

base/fapi_ft.c


2016-04-25 09:54:26 +0100
Chris Liddell <chris.liddell@artifex.com>
43e5273d8ce5e8c7ec02da874129fd2bea26301e

Coverity IDs 94494, 94617, 94818, 95043

94494: increase size of string buffer to allow for NULL termination.

94617: Initialize string pointer to avoid NULL dereference.

94818: Initialize string variable (fmode).

95043: Swtich to strncpy() to ensure we don't overflow string buffer

base/echogs.c


2016-04-25 10:34:07 +0100
Robin Watts <robin.watts@artifex.com>
3787c3f9753c542a5bd3f040b2aaa73db2f2f527

Fix clump splay tree backward in-order traversal.

When walking backwards, we stop for 'in-order' operation when
stepping from the right, not the left.

Also, backward walking requires different initialisation from
forward walking.

Add some debug code to dump a clump tree, and fix a prototype.

base/gsalloc.c
base/gsalloc.h
base/gxalloc.h
psi/isave.c


2016-04-25 09:22:00 +0100
Ken Sharp <ken.sharp@artifex.com>
99c712e4b10b459d2eab687d0f4db481999aad96

Coverity ID 101841, change order of code so that NULL check comes before dereference

base/gdevp14.c


2016-04-25 09:17:18 +0100
Ken Sharp <ken.sharp@artifex.com>
3cd70f69f9054fdb9da2c18d4d1bdbbd5cd752ad

add parentheses to make the control flow obvious, as requested by owner.

psi/ialloc.c


2016-04-25 09:01:58 +0100
Ken Sharp <ken.sharp@artifex.com>
74fd7f6bbe5e2aa493ef9bd087ab64adbabe71bc

Coverity ID 94725 - correct misleading indenting

psi/ialloc.c


2016-04-25 08:45:13 +0100
Ken Sharp <ken.sharp@artifex.com>
a3d988b75d952367ed898d0e1ac2af79add49296

Coverity ID 94530 check and action a return code

devices/vector/gdevpdfm.c


2016-04-25 08:25:03 +0100
Ken Sharp <ken.sharp@artifex.com>
83353631064ac5307a9b62877d5a0664e7ac800e

Coverity ID 125639 - clamp page numbers to 0

The PageList is supposed to be page numbers 1 onwards. Putting a zero
in the list would potentially have caused the numbers to 'wrap' resulting
in no output.

base/gdevflp.c


2016-04-23 10:59:46 +0100
Ken Sharp <ken.sharp@artifex.com>
88a145bebee34481862ea79d09098eb71dd15e38

Coverity ID 94810 - properly bracket macro

gx_setcurrentpoint is a macro, with 2 lines of code. This meant the else
clause was only applied to the first line, and the second was always
processed.

Fortuitously the if clause would have invalidated the current point so
I believe this is always safe, but its best to be certain and not
corrupt the current point.

base/gspaint.c


2016-04-22 14:51:02 -0700
Michael Vrhel <michael.vrhel@artifex.com>
2f622fe34c6290e737216dbc85d93efcdd3895fd

Coverity ID 94776 Dereference after null check

This should not have been an issue since the only
case where we called with a NULL device we have a profile,
but we will add the check for safety.

base/gsicc_cache.c


2016-04-22 11:55:57 -0700
Marcos H. Woehrmann <marcos.woehrmann@artifex.com>
644914cb5cef5b6138cb5f2a2ac541ea2333edc1

Bug 696726: gdevcmykog.c - insure that temp files are deleted

Call gp_open_scratch_file_rm() instead of gp_open_scratch_file() to insure
that no temp files are left around if Ghostscript is killed or crashes.

devices/gdevcmykog.c


2016-04-22 11:36:24 -0700
Michael Vrhel <michael.vrhel@artifex.com>
263b9e169ec5cf09c4b671ef9ea58f3e0edbe994

Coverity ID 94766: Self assignment (no effect)

Remove spurious code.

base/gxcmap.c


2016-04-22 11:25:56 -0700
Michael Vrhel <michael.vrhel@artifex.com>
ae840462e761fbb798e0a3f9ca822a69b252220d

Coverity ID 94882 and 95018: Uninitialized variables

If someone sets the number of inputs to an out of range
value in the transform, we will return 0 for our output
in the no_cm and replace_cm color management work flow.

base/gsicc_nocm.c
base/gsicc_replacecm.c


2016-04-22 10:55:18 -0700
Michael Vrhel <michael.vrhel@artifex.com>
6026f85a1a30738a8f453d9d3bbd8a785aff1d1b

Coverity ID: 94515, 94513, 94528 copy-paste errors

Output buffer was using input plane stride.

base/gsicc_monitorcm.c
base/gsicc_nocm.c
base/gsicc_replacecm.c


2016-04-22 10:44:59 -0700
Michael Vrhel <michael.vrhel@artifex.com>
199d49a64706673643671bbb74c19a91809f7e38

Coverity ID 94935 Out-of-bounds read

Mistake when we are resetting the proof or the device link
profile. We would have ended up overrunning the profile
array that is used for the default/text/graphic/image array.

base/gsicc_manage.c


2016-04-22 10:30:18 -0700
Michael Vrhel <michael.vrhel@artifex.com>
55d58a84767b82fe9f81b7b2357e1feafa06f017

Coverity ID 94570, 94785, 94915 Missing break in switch

The CIEXYZ case can't occur so it has been removed. It
was a vestige from the early days of the ICC development.
The CIEXYZ case was missing a break statement, which led to three
coverity complaints.

base/gscms.h
base/gsicc_manage.c


2016-04-22 18:22:30 +0100
Robin Watts <robin.watts@artifex.com>
15ee3fb57b660a796f8ac40c8784cfb165405336

Change standard allocator chunks to clumps.

We are in the confusing position of having a standard
allocator that allocates in chunks, along with a chunked
allocator.

To avoid this confusing clash of terminology, we do some
global renames to change the standard allocator to allocate
in 'clumps' instead.

base/gdbflags.h
base/gsalloc.c
base/gxalloc.h
base/gxobj.h
doc/Develop.htm
doc/Use.htm
psi/ialloc.c
psi/igc.c
psi/igc.h
psi/igcstr.c
psi/igcstr.h
psi/ilocate.c
psi/ireclaim.c
psi/isave.c
psi/zcontext.c


2016-04-22 09:56:04 -0700
Michael Vrhel <michael.vrhel@artifex.com>
e749f3d65d203edbc7c140ec8fd76b66805d27ff

Coverity ID 94910 Uninitialized pointer read

Set indices to avoid use of uninitialized index. It is actually not
possible to access them using real data but someone could perhaps
be malicious and cause a problem

base/gsicc_cache.c


2016-04-22 13:11:31 +0100
Robin Watts <robin.watts@artifex.com>
7b0baf9dc683b3ed6ac27b7a8f89718220589f7c

Rework gsalloc chunk list to use splay trees.

Instead of using a simple linked list (that can result in
slow searching in pathological cases), change to a splay tree
structure.

base/gsalloc.c
base/gxalloc.h
psi/ialloc.c
psi/igc.c
psi/ilocate.c
psi/isave.c


2016-04-22 09:24:52 -0700
Michael Vrhel <michael.vrhel@artifex.com>
dd683d444dba28a6bb4701be065353e4f5344de0

Coverity ID 94568 Dereference after null check

The device profile is not even used in this function.
Likely left over by mistake. Dereference of NULL no
longer possible here.

base/gsicc.c


2016-04-22 09:07:12 -0700
Michael Vrhel <michael.vrhel@artifex.com>
dd34f9f634b2d179bb898138255bb20c3de8c76f

Coverity ID 95055 Uninitialized scalar variable

If we have an invalid color space (non-CIE) we should
not be in this part of the code. Throw an error in
this case (the default in the switch) which will make
us avoid the uninitialized access.

base/gsicc_create.c


2016-04-22 13:59:03 +0100
Ken Sharp <ken.sharp@artifex.com>
e821df35998b594b844edf3e554d5a8002a6311d

Coverity ID 94783 - prevent a NULL dereference

If the device doesn't have a 'color_usage_array' then trying to use it
will be fatal. There is a check for the array being NULL, but it was
empty!

As a work-around, if it is NULL then return -1 which looks like its a
'do nothing' value.

base/gdevprn.c


2016-04-22 13:28:42 +0100
Ken Sharp <ken.sharp@artifex.com>
b49a4b5142dba407e63e2b8907efce3d38202ac4

Coverity ID 94751 - error in return check

Looks like this was a "if ((code= ...) < 0)" converted into "code=.. if
(code < 0)" but mistakenly.

psi/zpcolor.c


2016-04-22 13:17:35 +0100
Ken Sharp <ken.sharp@artifex.com>
3204fa03a809db3d8ff26d629012096ff1aecef6

Coverity ID 94977 - check and action 2 return codes

psi/zicc.c


2016-04-22 12:59:42 +0100
Ken Sharp <ken.sharp@artifex.com>
bffaddf2c2c1d3f0a52e205cf33c9023a779ace7

Coverity ID 94543 check a return code

This does actually lead to a memory leak, but there is equivalent code
below (allocating prci) which potentially leaks in exactly the same
way, so I'm going to ignore the leak. A real VM error will quickly
cause the interpreter to exit anyway.

psi/zgstate.c


2016-04-22 11:54:44 +0100
Ken Sharp <ken.sharp@artifex.com>
caf54da6fe8635a17f069e947ff87d0b6c37a592

Coverity ID 94789 - missing parentheses could cause error

This appears to be a genuine bug, even if the parameters were valid
we would jump to the failure condition. Seems we do not have a test
case for this code path.

psi/zfsample.c


2016-04-22 11:36:13 +0100
Ken Sharp <ken.sharp@artifex.com>
58db0de140dc12170d4fb4b33d32a90f5d57f0e2

Coverity ID 94947 - initialise an unused paramter

delta is only used for Dissolve blend modes, so I'm pretty certain this
is really a false positive, but it does no harm to initialise it to 0.

psi/zdpnext.c


2016-04-22 11:27:52 +0100
Ken Sharp <ken.sharp@artifex.com>
56315a80d2bd49d3d9baa71ea3be8b1dba64adcd

Coverity ID 95062 - check and action a return code

Almost certainly impossible to trigger, the only way to get an error
here would be for the ref pointed to by arr to not be an array, which
should have been checked earlier, All the same, lets check the return
code.

psi/zcolor.c


2016-04-22 10:57:14 +0100
Ken Sharp <ken.sharp@artifex.com>
5bfdb858ea41d0018acc3c022e885fc6b4a1ccfc

fix Coverity ID 94865 - free some memory on exit

This is minor, as the memory leak only occurs on a fatal error and
application exit.

psi/imain.c


2016-04-22 10:23:45 +0100
Ken Sharp <ken.sharp@artifex.com>
5ee4779b097da19ef0b50cd4c04d0f7f6da46da4

Coverity ID 94725 - purely cosmetic indenting

psi/ialloc.c


2016-04-22 10:16:55 +0100
Ken Sharp <ken.sharp@artifex.com>
8d6c1c1396d3678afd37f8492be7e31aed405c59

Coverity ID 94927 - initialise a string buffer

Set the buffer contents to all 0, prevents possibility of using
uninitialised data and makes a 'buf[] = 0' redundant.

psi/dscparse.c


2016-04-22 09:48:23 +0100
Ken Sharp <ken.sharp@artifex.com>
2a5d6cd40a49c89efdb83c6f4399ec7ad8692218

txtwrite - Coverity fix, Adobe glyph list lookup not working

Coverity ID 94593

The code to search the Adobe Glyph List in an attempt to find a Unicode
value for a named glyph was incorrect, and simply didn't work. Because
'index' started at -1, and all the searches started by testing if
'index >= 0', all the table searches were skipped.

This should actually run the searches and may improve the text extraction
a little.

devices/vector/gdevtxtw.c


2016-04-21 18:04:55 -0700
Michael Vrhel <michael.vrhel@artifex.com>
42bca0e60954adc27d78998905e0daab97136be2

Fix for Bug 696724

This issue was caused by the interaction of the AA alpha and the fact
that we have a knock out group. In such a case, we don't want the
AA alpha to be knocking out what was already drawn. Instead we want
to do a blend with the AA alpha and then force the alpha to what ever
the alpha is in the graphic state. This is achieved by looking at
what is already drawn in our destination and if there is nothing there,
then we just copy. If there is something there, then we blend and
then set the alpha value appropriately.

base/gdevp14.c
base/gxblend.c
base/gxblend.h


2016-04-21 16:26:27 +0100
Ken Sharp <ken.sharp@artifex.com>
fa3dbd3a9fa9ddb2894ef80738d95c3c1b6a92a6

Coverity fix - CID 94748 and 94805 potentail NULL dereference

In both these cases we check dev for NULL and then either dereference dev
or dereference a pointer set to NULL if dev is NULL.

Simply guard against that. I don't believe this should be possible
in any event, I don't think the graphics state should *ever* have no
device.

base/gscspace.c


2016-04-21 15:43:06 +0100
Ken Sharp <ken.sharp@artifex.com>
e9d0f658f01ca857f18c9e038adbdad899979f25

Coverity fix - CID 95051, initialise a variable

base/gdevvec.c


2016-04-20 09:22:16 +0100
Chris Liddell <chris.liddell@artifex.com>
3f8b170b6a7ab90cb64814502c0cde317f9fd4ae

Remove some defunct references to old wisc site.

doc/API.htm
doc/Release.htm


2016-04-19 12:05:58 -0700
Ray Johnston <ray.johnston@artifex.com>
43a88f4e6377fa6d4ea0a609450ddb19ee0474cb

Add max_used to gs_memory_status and use it for -Z: resource usage

By adding this to the gs_memory_status_t and returning it (if available)
from the gs_memory_status function of allocators, we can print the max
used even when it is not a DEBUG build and avoid the ugly gs_debug
hack previously used to print the max_used for a DEBUG build. The
time for tracking this is microscopic. Also the chunk_mem allocator
now tracks this always, not just for DEBUG builds.

base/gsalloc.c
base/gsmalloc.c
base/gsmalloc.h
base/gsmchunk.c
base/gsmemory.h
base/gsmemraw.h
psi/imain.c


2016-04-19 15:56:09 +0100
Chris Liddell <chris.liddell@artifex.com>
4976a1a4a0b44cd44467e6fe2ba5d453e7573434

Bug 696716: cff parser: cope with incomplete encoded numbers

The fonts in the test case had an incomplete 32 bit number at the end of the
stream - meaning it threw an error trying to read 4 bytes when only 1 byte
was available.

Update the code to read *up to* 4 bytes in these cases.

The fonts are still invalid because they leave a dirty operand stack, but the
cff parser ignores such problems.

Also quieten an uninitialised variable warning.

psi/zfont2.c


2016-04-19 16:02:36 +0100
Ken Sharp <ken.sharp@artifex.com>
a1e2d8b247955e65a7e1ed26e3b8163a58fa6ca7

page processing - remove a spurious line of code

Spotted by scan-build, this line of code did no harm, but served no
useful purpose either, since its return value wasn't tested.

base/gdevflp.c


2016-04-19 15:03:26 +0100
Ken Sharp <ken.sharp@artifex.com>
3376c638a5d5cad500c48862ace55b8e1eafc458

txtwrite action a return code

From Coverity ID 94593

devices/vector/gdevtxtw.c


2016-04-19 14:27:54 +0100
Ken Sharp <ken.sharp@artifex.com>
e9e077eff06e8fb4141885d9225f212920af431c

pdfwrite - remove some dead code in the ICC handling: Coverity analysis

devices/vector/gdevpdfk.c


2016-04-19 11:18:40 +0100
Ken Sharp <ken.sharp@artifex.com>
69c20a21a5bd53284437029b5b9d316a408a7392

Add a system to allow processing of individual pages and ranges of pages

Bug #692752 "Implement mechanism to specify a range (or ranges) of pages for txtwrite"

Documented in Use.htm, this introduces a new command line parameter
'PageList' which allows for ranges and individual pages to be specified
for processing.

Resource/Init/pdf_main.ps
base/gdevdflt.c
base/gdevflp.c
base/gdevflp.h
base/gdevkrnlsclass.c
base/gsdevice.c
base/gsdparam.c
base/gxdevcli.h
base/gxdevice.h
devices/gdevbit.c
doc/Use.htm


2016-04-18 17:06:58 +0100
Robin Watts <robin.watts@artifex.com>
e6ecf9ccab71740fddc70f2e6cb30bef3b831d61

On windows, in profile builds, disable DLL build.

This enables Very Sleepy to reliably find symbols for me.

psi/msvc.mak


2016-04-18 15:31:53 +0100
Robin Watts <robin.watts@artifex.com>
7c0e498f47b97a3086fdb4297de600b0ef66d584

BBox device: speed up.

When taking the bbox of a stroked path, don't stroke the entire
path to a new path, and then take the bbox of that. Instead
allow the stroke code to call the underlying bbox code for each
path segment directly.

On files with HUGE paths this can save a lot of mallocs/frees.

base/gdevbbox.c


2016-04-18 15:17:06 +0100
Robin Watts <robin.watts@artifex.com>
952ac2015ef8e1e1d3fe84224e99e6b98bc84f05

Remove unneeded padding byte.

This made sense until 2002 when another byte was added. Since then
it's been bloat.

base/gzpath.h


2015-07-18 09:35:37 +0100
Robin Watts <Robin.Watts@artifex.com>
e350758ceb8d9f7ec6bb209908a6ce1fe35e2397

Makefile for Android MuPDF libgs.so

make -f Makefile.android so

Makefile.android
arch/android.h


2016-04-16 10:34:58 +0100
Ken Sharp <ken.sharp@artifex.com>
e1e13aa4492918ff0dec6062faab351ba9ae6ac0

pdfwrite - when fill->bitmap conversion degenerates to empty, just drop it

Bug #696705 "crash in pdfwrite"

This is caused by a combination of a low resolution and converting
colours into RGB, when a shading uses Separation colour spaces.

The code renders the shading as a bitmap, but the path to fill is empty
triggering the use of the mask instead of the path. However, because
we are a shading not a masked image, there is no mask.

Instead we now simply drop the shading.

No differences expected

devices/vector/gdevpdfd.c


2016-04-14 10:00:57 +0100
Ken Sharp <ken.sharp@artifex.com>
df5b3426d31f79c13a735dff9118e9798ce97af9

PDF Interpreter - try to work around invalid ICCBased spaces

Bug #696690 and Bug #696120

These files have ICCBased spaces where the value of /N and the number of
components in the profile differ. In addition the profile in Bug #696690
is invalid. In the case of Bug #696690 the /N value is correct, and the
profile is wrong, in the case of Bug #696120 the /N value is incorrect
and the profile is correct.

We 'suspect' that Acrobat uses the fact that Bug #696120 is a pure image
to detect that the /N is incorrect, we can't be sure whether it uses the
profile or just uses the /N to decide on a device space.

What we now do is; If the /N and device profile number of components
don't match, we assume the device profile is correct and patch /N to be
the same as the profile (see /ICCBased-resolve), but we save the
original value of /N in /OrigN. In the PostScript setcolor operator, if
the space is a genuine ICCBased space (not a replacement for a device
space) we call set_dev_color which will actually exercise the profile.
If that fails we return an error. For ICCbased spaces we run setcolor in
a stopped context, and if it fails we check to see if there is a /OrigN
(this occurs only if the /N was different to the number of components in
the profile). If there is a /OrigN then prefer that to the profile,
otherwise they agreed, so just use /N and select a device space. If we
can't select a device space with the correct number of components, give
up and throw an error.

This produces some differences in a small number of files, mostly the
PAM device at 72 dpi. These are not visually perceptible, and since they
only occur on one device at low resolution I think they are spurious.

Resource/Init/pdf_draw.ps
Resource/Init/pdf_main.ps
Resource/Init/pdf_ops.ps
psi/zcolor.c


2016-04-11 14:28:47 +0100
Ken Sharp <ken.sharp@artifex.com>
87665c0a73e3d53f791017813424d6f3ba5f85c7

txtwrite - reinstate an earlier commit by Robin Watts

This was removed as I couldn't, at the time, be certain that it was not
required. Having spent some time working through the various macros, and
the code, I'm now convinced that this is not required, and is probably
a remnant of an early attempt at this device, which used garbage collected
objects.

This was originally added by Robin as a small part of commit
fd9a66f997bb57e9628a703774eddcf933475a34 and removed by me in commit
15b3f5cbf12461e2ed318e793669b7c34e32089b


No differences expected

devices/vector/gdevtxtw.c


2016-04-11 13:32:06 +0100
Ken Sharp <ken.sharp@artifex.com>
faa3f93a3f7f2da9c53501fc5780999ba14cb1e3

pdfwrite - remove some deleted code accidentally left with #if

devices/vector/gdevpdfp.c


2016-04-11 10:06:29 +0100
Ken Sharp <ken.sharp@artifex.com>
416aa779312c296dfbecd87e6ba88ea57284a337

pdfwrite - Remove the 'old' (non-ICC) colour management code

Removal of this code has been warned for some time, since there have
been practically no reports of problems, and those few have been
fixed, I'm now removing the old and deprecated colour conversion
code.

We also now process, but ignore, changes to ProcessColorModel. If you
want output in a specific colour space, then use ColorConversionStrategy
to select the output colour space. Note that although we ignore the
value, we do change it, so that code which attempts to set the
ProcessColorModel won't produce an error (ie some of the Quality Logic
test files).

This does produce one small difference; Bug692106.ps run through
ps2write, the result is somewhat improved when rendered to RGB.

devices/vector/gdevpdfb.h
devices/vector/gdevpdfc.c
devices/vector/gdevpdfg.c
devices/vector/gdevpdfi.c
devices/vector/gdevpdfk.c
devices/vector/gdevpdfp.c
devices/vector/gdevpdfv.c
devices/vector/gdevpdfx.h
devices/vector/gdevpsdf.h
devices/vector/gdevpsdu.c
doc/VectorDevices.htm


2016-04-09 14:38:17 +0100
Ken Sharp <ken.sharp@artifex.com>
6cab1a4b2a08a7d0bcb4772d28a22c72eff62052

pdfwrite - write fonts as ProcSet resources instead of fonts

Seems that font names aren't allowed to have spaces and aren't supposed
to use string syntax (bloody stupid idea). So just write a DSC comment
that its a ProcSet instead of a Font, problem solved.

devices/vector/gdevpdfu.c


2016-04-09 09:18:25 +0100
Ken Sharp <ken.sharp@artifex.com>
b28091a97d3c153feeecf47dc8fefa90ab5984a2

PDF interpreter - fix a typo in an error message

Resource/Init/pdf_ops.ps


2016-04-05 10:51:24 +0100
Ken Sharp <ken.sharp@artifex.com>
0ec0f1627b7f7f5ffa1347123a926cd1e32c9f19

PDF interpreter + pdfwrite - use font object numbers to detect identical fonts

Previously we have had problems when dealing with multiple input PDF files
where the files contain subset fonts with poorly chosen subset prefixes.
Because we only have the font name to work with it was difficult to
determine whether two fonts with the same name were, in fact, the same font.
Incorrectly deciding that fonts were the same led to glyphs being wrong
in the pdfwrite output, whereas treating all fonts as unique resulted in
outputting far, far too many font instances.

In ths commit we add a means to determine from PostScript the filename
associated with a PostScript file object and we use that to get the
filename of the current PDF file being processed in the PDF interpreter.

When we encounter a font in a PDF file, we check to see whether it has
an object number and a FontDescriptor, if the FontDescriptor is present
we get its object number. We then check to see if the FontDescriptor
has a FontFile, if it does not then the font is not embedded.

If the font is embedded then we use the object number of the FontDescriptor
(two fonts can have the same FOntDescriptor, and we can treat these as
being the same font) and combine it with the PDF filename using a
CRC to produce a hash which we store in the font as an XUID.

pdfwrite then uses the XUID (if present) to determine if two fonts
are in fact the same font.

Adding the XUID causes a very small number of pixel differences in
the text of some PDF files (especially, for some reason, with the
psdcmy device). Also, a few PDF files have multiple copies of the
same font, with different FontDescriptors, which were previously merged
but now are not, whch leads to a small increase in file size.

This new behaviour can be disabled by adding the -dPDFDontUseFontObjectNum
switch on the command line.

Resource/Init/pdf_base.ps
Resource/Init/pdf_font.ps
Resource/Init/pdf_main.ps
Resource/Init/pdf_ops.ps
devices/vector/gdevpdtf.h
devices/vector/gdevpdtt.c
doc/VectorDevices.htm
psi/zfile.c


2016-04-08 11:59:16 +0200
Tor Andersson <tor.andersson@artifex.com>
d3d767d9b91ae7d82c261fbdfd735f3042161032

Reindent jbig2dec source to follow gs coding style.

First a pass through gnu indent:
indent \
-bad -nbap -nsob -br -ce -cli0 \
-npcs -ncs -i4 -di0 -psl -lp -lps -nut -l160 \
*.c *.h

Followed by astyle to patch over some of the indentation bugs in gnu indent:

astyle --style=kr -H -U -k3 *.c *.h

jbig2dec/config_win32.h
jbig2dec/getopt.c
jbig2dec/getopt.h
jbig2dec/getopt1.c
jbig2dec/jbig2.c
jbig2dec/jbig2.h
jbig2dec/jbig2_arith.c
jbig2dec/jbig2_arith.h
jbig2dec/jbig2_arith_iaid.c
jbig2dec/jbig2_arith_iaid.h
jbig2dec/jbig2_arith_int.c
jbig2dec/jbig2_arith_int.h
jbig2dec/jbig2_generic.c
jbig2dec/jbig2_generic.h
jbig2dec/jbig2_halftone.c
jbig2dec/jbig2_halftone.h
jbig2dec/jbig2_huffman.c
jbig2dec/jbig2_huffman.h
jbig2dec/jbig2_hufftab.h
jbig2dec/jbig2_image.c
jbig2dec/jbig2_image.h
jbig2dec/jbig2_image_pbm.c
jbig2dec/jbig2_image_png.c
jbig2dec/jbig2_metadata.c
jbig2dec/jbig2_metadata.h
jbig2dec/jbig2_mmr.c
jbig2dec/jbig2_mmr.h
jbig2dec/jbig2_page.c
jbig2dec/jbig2_priv.h
jbig2dec/jbig2_refinement.c
jbig2dec/jbig2_segment.c
jbig2dec/jbig2_symbol_dict.c
jbig2dec/jbig2_symbol_dict.h
jbig2dec/jbig2_text.c
jbig2dec/jbig2_text.h
jbig2dec/jbig2dec.c
jbig2dec/memcmp.c
jbig2dec/memento.c
jbig2dec/memento.h
jbig2dec/os_types.h
jbig2dec/pbm2png.c
jbig2dec/sha1.c
jbig2dec/sha1.h
jbig2dec/snprintf.c


2016-01-05 15:21:43 +0100
Tor Andersson <tor.andersson@artifex.com>
22506f32c40851e9ec6d0321f7ef82f1c9e12605

Update C-style to mention that we don't mix tabs and spaces.

doc/C-style.htm


2016-01-05 14:53:03 +0100
Tor Andersson <tor.andersson@artifex.com>
08b7f1ef45a844138df28e678c062400036a7b8b

Fix warning: for loop has empty body (semicolon at end of line).

jbig2dec/jbig2_text.c


2016-04-08 09:42:13 +0100
Chris Liddell <chris.liddell@artifex.com>
9c29e53a5955c3c12ed1b1dff66a564cbec8d24d

Close file on error before exit

jbig2dec/jbig2dec.c


2016-04-08 09:37:32 +0100
Chris Liddell <chris.liddell@artifex.com>
d65f57bc4dc4732dc828a342498c34308101e507

Fix jbig2dec libpng API versions support

jbig2dec/jbig2_image_png.c


2016-04-07 15:33:53 +0100
Chris Liddell <chris.liddell@artifex.com>
b0878d062cf7acefbc2b47e038af4e3392132981

Update version number and dates for jbig2dec release

will be v0.13

jbig2dec/CHANGES
jbig2dec/config_win32.h
jbig2dec/configure.ac
jbig2dec/jbig2dec.1


2016-03-31 08:00:34 +0100
Chris Liddell <chris.liddell@artifex.com>
1e6f5f00082ee7aa8dbcf65bfcc3ba85acd89443

Correct a couple of typos

doc/History9.htm
doc/News.htm


2016-04-05 12:28:19 +0100
Ken Sharp <ken.sharp@artifex.com>
f29334eac74485b8274d13b56915b5e28290e6c7

txtwrite - remove some commented out code

devices/vector/gdevtxtw.c


2016-04-05 12:27:53 +0100
Ken Sharp <ken.sharp@artifex.com>
734ebbf2ca118da7fbc56ae53e7c08db477ce96d

pdfwrite - remove various chunks of dead/deprecated code

devices/vector/gdevpdfc.c
devices/vector/gdevpdfd.c
devices/vector/gdevpdte.c
devices/vector/gdevpdtw.c


2016-03-05 14:56:03 -0800
Chris Liddell <chris.liddell@artifex.com>
ab109aaeb3ddba59518b036fb288402a65cf7ce8

Bug 694724: Have filenameforall and getenv honor SAFER

Resource/Init/gs_init.ps
psi/zfile.c


2016-03-29 15:25:05 +0100
Chris Liddell <chris.liddell@artifex.com>
bcdbe51791cf38240c73862af9ca1cacb8f3e177

Tidy up the 'sanitize' target

Have configure check that the compiler and linker can handle the address
sanitizer options, and if not, put something dummy in so the 'sanitize'
will fail pretty much immediately.

Remove the '-i' option from the recursive make call since we no longer need
that.

Makefile.in
base/unix-end.mak
configure.ac


2016-02-03 11:38:44 +0000
Chris Liddell <chris.liddell@artifex.com>
8b1d6f2f8d9e9f1706e2893042872a723a6d3ce3

Bug 696563: tidy memory use in genconf and mkromfs

Both tools failed to free all their working memory before exit.

genconf was especially bad.

base/genconf.c
base/mkromfs.c


2016-01-05 15:52:35 +0000
Chris Liddell <chris.liddell@artifex.com>
fc1d455fe97e3c306a04c5f3674bb61969d9302d

Bug 693179: move gc related variables off C stack

The variables ticks_left and gc_signal were local stack variables in interp()
and gs_call_inter() respectively, a pointer to which was set in the
gs_memory_gc_status_t of each memory "space".

This moves and "merges" the variables into a single entry in gs_lib_ctx, and
has the memory spaces access that variable directly in gs_lib_ctx, rather than
through a pointer belonging to each space.

base/gsalloc.c
base/gsalloc.h
base/gslibctx.h
psi/interp.c
psi/isave.c


2016-03-29 08:42:50 +0100
Ken Sharp <ken.sharp@artifex.com>
96a779957d6d0dc83e0f97e302b1e5ecdc924f61

pdfwrite - silence some compiler warnings

devices/vector/gdevpdfd.c


2016-03-28 17:41:16 +0100
Chris Liddell <chris.liddell@artifex.com>
22dac7b2fa8f5015687396433ceb6c5038002ec9

Remove a couple of mac specific hidden files

These shouldn't be in the repo

lcms2/Projects/mac/._.DS_Store
lcms2/Projects/mac/LittleCMS/._.DS_Store


2016-03-28 17:15:16 +0100
Ken Sharp <ken.sharp@artifex.com>
fa20f5915978823a8c72a80e49fa90ce9c5c5879

High level forms - cope with junk on stack after PaintProc

Bug #696678 " "Error: /typecheck in --.execform1--" writing pdf file"

Form PaintProc procedures are supposed to have no side effects, in
particular they should not disturb the stacks. There are some
PostScript programs which (usually by negligence) don't obey this
restriction.

If the PaintProc deliberately disturbs the stacks, or has other side-
effects, then there is nothing we can do about it, but if its just an
oversight we can 'fix' the problem by removing extraneous objects from
the operand stack after we execute the PaintProc and before we call
.endform.

This allows some badly behaved PostScript programs to work.

No differences expected.

Resource/Init/gs_lev2.ps


2016-03-22 15:12:10 +0000
Ken Sharp <ken.sharp@artifex.com>
f124ca485a4a0648cc502f5e5adb3e2b8b9de955

pdfwrite - optimise rectangular subpaths as 're' where possible

The current 'vector device' path code doesn't work properly with clips and
doesn't optimise rectangular subpaths as rectangles. (For the purposes
of 're' optimisation a rectangular subpath is a moveto, followed by 4
lineto's at right angles, followed by a closepath).

This commit creates new code to handle pahts in pdfwrite, if the enumerator
is a clip enumerator it correctly enumerates the subpaths from the clip
instead of enumerating the path.

We buffer up operations looking for rectangles; when we find one, if the
current matrix is not sheared or skewed, then we check to see if the
rectangle is 'x first'. If it isn't we move the starting point round by one
as 're' always emits width first. We also check to see if we are doing
a dashed stroke, as if we are we cannot move the initial vertex as this
will cause the dash to be incorrect (abort the optimisation).

We copy the code from gdevvec whcih checks to see if the whole path is
a rectangle, and also the 'optimise' code whch will concatenate colinear
moveto and lineto operations into a single operation.

Finally we also preserve the heuristic that prevents a fill with a trailing
moveto as ths apparently exposed a bug in old versions of Acrobat.

Ths does result in a number of single pixel or single pixel wide
differences in the test suite, but they all look like simple differences
to me, not regressions. The new code doesn not appear to be
singificantly slower and ths does produce a useful reduction in file
size for some files.

base/gdevvec.h
devices/vector/gdevpdfd.c


2016-03-23 17:28:08 +0000
Robin Watts <robin.watts@artifex.com>
efc6c6f3587b0c08522f3d9f45e611dc1dceba23

Bring Memento up to date with MuPDF version.

base/memento.c
base/memento.h


2016-03-23 17:24:04 +0000
Robin Watts <robin.watts@artifex.com>
7152391110d4b58287740e4de90912024169ac9d

Add comment to misleading device code.

devices/gdevdjtc.c


2015-09-24 11:04:22 +0100
Chris Liddell <chris.liddell@artifex.com>
5a7b20755617cde8c915ab24725f94fd74be3aee

Bring master up to date with gs919 branch

Add words to 9.18 release notes

about the revised directory structure, build and executable names

Tweak changelog for 9.18 release

Update dates versions in docs etc

Changelog + release "highlights".

Dates, strings and changelog for release.

Makefile.in
base/version.mak
doc/API.htm
doc/C-style.htm
doc/Commprod.htm
doc/DLL.htm
doc/Deprecated.htm
doc/Details8.htm
doc/Details9.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/Helpers.htm
doc/History1.htm
doc/History2.htm
doc/History3.htm
doc/History4.htm
doc/History5.htm
doc/History6.htm
doc/History7.htm
doc/History8.htm
doc/History9.htm
doc/Install.htm
doc/Issues.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.htm
doc/Projects.htm
doc/Ps-style.htm
doc/Ps2epsi.htm
doc/Psfiles.htm
doc/Readme.htm
doc/Release.htm
doc/SavedPages.htm
doc/Source.htm
doc/Unix-lpr.htm
doc/Use.htm
doc/VectorDevices.htm
doc/WhatIsGS.htm
doc/Xfonts.htm
doc/gs-vms.hlp
doc/thirdparty.htm
man/dvipdf.1
man/font2c.1
man/gs.1
man/gslp.1
man/gsnd.1
man/pdf2dsc.1
man/pdf2ps.1
man/pf2afm.1
man/pfbtopfa.1
man/printafm.1
man/ps2ascii.1
man/ps2epsi.1
man/ps2pdf.1
man/ps2pdfwr.1
man/ps2ps.1
man/wftopfa.1
psi/int.mak
psi/winint.mak


2016-03-21 10:38:58 +0000
Ken Sharp <ken.sharp@artifex.com>
7ee0a82260050b2b7391b4968cd02682557e2cbc

PDF interpreter - cope with Indexed space with 'hival' being indirect

The code to handle an Indexed colour space expected that the 'hival',
that is the highest index, would be an integer. It can legally be an
indirect reference. Dumb, but legal.

Here we 'resolve' the hival in case it is an indirect reference.

No differences expected

Resource/Init/pdf_draw.ps


2016-03-17 17:12:41 +0000
Chris Liddell <chris.liddell@artifex.com>
2dda1c123c76a126059808c04df63805f1694686

Bug 696665: add extra brackets for better compatibility

Some versions of autoconf enforce macro arguments to macros being bounded by
"[" and "[", others do not (the version I have does not), but we should use
them for best compatibility.

configure.ac


2016-03-17 10:21:16 +0000
Chris Liddell <chris.liddell@artifex.com>
2e262fac0f15b51dd3588e3e92157b5fd2a90bb2

Remove some left debug code.

configure.ac


2016-03-17 10:06:14 +0000
Chris Liddell <chris.liddell@artifex.com>
c281807816be4dcc10c3fc66b32651098f321600

Bug 696665: fix gs only install

I added dummy gpcl6 and gxps exe names to avoid a warning when building from a
gs only release archive. I neglected to add appropriate dummy install targets
for those, and that caused an error with "make install".

base/unixinst.mak


2016-03-15 08:29:03 -0700
Ray Johnston <ray.johnston@artifex.com>
aeb5c1e3d2b47ffb9f4ccd01d32429ebd2c5effc

Increase limits for tile_clip_buffer and Max VM on 64-bit machines

These changes allow the file from bug 696257 to complete on 64-bit gcc
builds where a "long" is 64 bits. Also the MaxLocalVM and MaxGlobalVM
values returned in CPSI mode are truncated to return only the low 32
bits (CET 99-01.ps)

base/gsalloc.c
base/gxmclip.h
psi/zusparam.c


2016-03-15 08:17:34 -0700
Ray Johnston <ray.johnston@artifex.com>
28049debc650116b9762d7b0ec82f52d45039927

Revert change to mswinpr2 device from commit 5cf300b

This caused us to ignore the printer specified by -s%printer%___
and always use the default printer if QueryUser was not specified

devices/gdevwpr2.c


2016-03-15 10:38:15 +0000
Ken Sharp <ken.sharp@artifex.com>
38990b3619ed74308454d0d3910bd394a982e7cd

pdfwrite - more changes for composite object emission

This 'fixes' Bug 696657, but it is not correct in general.

We break the emission of composite objects up into blocks of less than
255 characters for compliance with DSC output, but if any one of the
objects contains certain characters ('/' '[' '{' '(' or ' ') then we
might break the object inappropriately (this is likely for strings and
is the case for ths file).

There is no way to address this 'properly' in general, its perfectly
possible to create a PostScript object more than 255 bytes which
cannot be broken up, so I'm going to ignore the problem for now, since
it only occurs when writing pdfmarks to the ps2write device and having
DSC turned on (which is the default).

If anyone really needs to do this, they should set ProduceDSC to false.

devices/vector/gdevpdfu.c


2016-03-15 09:37:53 +0000
Chris Liddell <chris.liddell@artifex.com>
15240a6631e2c721402dcbaf58d9b784707bde42

Bug 696655: have configure support --without-pcl

and --without-xps.

configure.ac


2016-03-15 09:19:33 +0000
Ken Sharp <ken.sharp@artifex.com>
5d1ffe2669e7523e579a4cc47bb6debe805c0a2c

pdfwrite - fix writing of composite objects

When emitting composite objects we attempt (for reasons which are
unclear) to do so in chunks of 256 bytes or less. The code to split a
large buffer into smaller buffers was simply broken, did not work
properly at all.

This commit fixes the logical flaw, allowing us to write composite
objects larger then 254 bytes without error.

NB this is a rare condition, such objects are usually only created
from input such as pdfmarks, normal composite objects are created and
emitted by pdfwrite itself and do not go through this code.

devices/vector/gdevpdfu.c


2016-03-14 10:09:42 +0000
Chris Liddell <chris.liddell@artifex.com>
ebd8585aabd050b64e33221478d0bcb6b7f41abf

Always have configure set gpcl6 and gxps exe names

But still skip adding them to the targets list if the source is not available.

This avoids a warning when building a Ghostscript only release archive.

configure.ac


2016-03-11 10:13:03 +0000
Chris Liddell <chris.liddell@artifex.com>
36ea2f21ee862f6e3d3276389cf71a8d0008865b

Bump version number/date

Resource/Init/gs_init.ps
base/version.mak


2016-03-23 08:19:58 +0000
Chris Liddell <chris.liddell@artifex.com>
50a8b6fcd897e71344965d6bc300f0d01b850fad

Dates, strings and changelog for release.

base/gscdef.c
base/version.mak
doc/API.htm
doc/C-style.htm
doc/Commprod.htm
doc/DLL.htm
doc/Deprecated.htm
doc/Details8.htm
doc/Details9.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/Helpers.htm
doc/History1.htm
doc/History2.htm
doc/History3.htm
doc/History4.htm
doc/History5.htm
doc/History6.htm
doc/History7.htm
doc/History8.htm
doc/History9.htm
doc/Install.htm
doc/Issues.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.htm
doc/Projects.htm
doc/Ps-style.htm
doc/Ps2epsi.htm
doc/Psfiles.htm
doc/Readme.htm
doc/Release.htm
doc/SavedPages.htm
doc/Source.htm
doc/Unix-lpr.htm
doc/Use.htm
doc/VectorDevices.htm
doc/WhatIsGS.htm
doc/Xfonts.htm
doc/gs-vms.hlp
doc/thirdparty.htm
man/dvipdf.1
man/font2c.1
man/gs.1
man/gslp.1
man/gsnd.1
man/pdf2dsc.1
man/pdf2ps.1
man/pf2afm.1
man/pfbtopfa.1
man/printafm.1
man/ps2ascii.1
man/ps2epsi.1
man/ps2pdf.1
man/ps2pdfwr.1
man/ps2ps.1
man/wftopfa.1


2016-03-17 17:12:41 +0000
Chris Liddell <chris.liddell@artifex.com>
9cf6bfee8d3c285e84d28437bff0747f601a7827

Bug 696665: add extra brackets for better compatibility

Some versions of autoconf enforce macro arguments to macros being bounded by
"[" and "[", others do not (the version I have does not), but we should use
them for best compatibility.

configure.ac


2016-03-17 10:21:16 +0000
Chris Liddell <chris.liddell@artifex.com>
d7e175bc49d8dcdc38af093cd744c62cb6451686

Remove some left debug code.

configure.ac


2016-03-17 10:06:14 +0000
Chris Liddell <chris.liddell@artifex.com>
a529498d1a52bbb91cca5e32512d6c49e665a004

Bug 696665: fix gs only install

I added dummy gpcl6 and gxps exe names to avoid a warning when building from a
gs only release archive. I neglected to add appropriate dummy install targets
for those, and that caused an error with "make install".

base/unixinst.mak


2016-03-15 08:17:34 -0700
Ray Johnston <ray.johnston@artifex.com>
3a089782b11699fe83c22a92544623a9c21e0c4a

Revert change to mswinpr2 device from commit 5cf300b

This caused us to ignore the printer specified by -s%printer%___
and always use the default printer if QueryUser was not specified

devices/gdevwpr2.c


2016-03-11 12:17:57 +0000
Chris Liddell <chris.liddell@artifex.com>
1a8b008b6d34efcc00b8c10507a28b517ab5b7db

Changelog + release "highlights".

doc/Devices.htm
doc/History9.htm
doc/News.htm


2016-03-14 10:09:42 +0000
Chris Liddell <chris.liddell@artifex.com>
2e7c06dc36d9fe255a6171a28967eb53395abe4f

Always have configure set gpcl6 and gxps exe names

But still skip adding them to the targets list if the source is not available.

This avoids a warning when building a Ghostscript only release archive.

configure.ac


2016-03-11 10:34:00 +0000
Chris Liddell <chris.liddell@artifex.com>
7f9c8fbce554eebdbda21f25d208c541355e177d

Update dates versions in docs etc

Makefile.in
doc/API.htm
doc/C-style.htm
doc/Commprod.htm
doc/DLL.htm
doc/Deprecated.htm
doc/Details8.htm
doc/Details9.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/Helpers.htm
doc/History1.htm
doc/History2.htm
doc/History3.htm
doc/History4.htm
doc/History5.htm
doc/History6.htm
doc/History7.htm
doc/History8.htm
doc/History9.htm
doc/Install.htm
doc/Issues.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.htm
doc/Projects.htm
doc/Ps-style.htm
doc/Ps2epsi.htm
doc/Psfiles.htm
doc/Readme.htm
doc/Release.htm
doc/SavedPages.htm
doc/Source.htm
doc/Unix-lpr.htm
doc/Use.htm
doc/VectorDevices.htm
doc/WhatIsGS.htm
doc/Xfonts.htm
doc/gs-vms.hlp
doc/thirdparty.htm
man/dvipdf.1
man/font2c.1
man/gs.1
man/gslp.1
man/gsnd.1
man/pdf2dsc.1
man/pdf2ps.1
man/pf2afm.1
man/pfbtopfa.1
man/printafm.1
man/ps2ascii.1
man/ps2epsi.1
man/ps2pdf.1
man/ps2pdfwr.1
man/ps2ps.1
man/wftopfa.1
psi/int.mak
psi/winint.mak


2016-03-11 10:30:26 +0000
Chris Liddell <chris.liddell@artifex.com>
837d4dcaff85a7c96726caaeeb10b690aa6e18f1

Change product string for 9.19 RC1

base/gscdef.c


2015-09-30 14:57:38 +0100
Chris Liddell <chris.liddell@artifex.com>
50efb7307dab9df334ad45acdfbe83bf2f3ffba3

Tweak changelog for 9.18 release

doc/History9.htm


2015-09-24 11:04:22 +0100
Chris Liddell <chris.liddell@artifex.com>
32e59ede8dddc2838478dfaeac2a238318c22835

Add words to 9.18 release notes

about the revised directory structure, build and executable names

doc/History9.htm
doc/News.htm



Version 9.19 (2016-03-23)

This is the thirteenth full release in the stable 9.x series, and is mainly a maintenance release.

Highlights in this release include:

For a list of open issues, or to report problems, please visit bugs.ghostscript.com.

Incompatible changes

Changelog

2016-03-17 17:12:41 +0000
Chris Liddell <chris.liddell@artifex.com>
9cf6bfee8d3c285e84d28437bff0747f601a7827

Bug 696665: add extra brackets for better compatibility

Some versions of autoconf enforce macro arguments to macros being bounded by
"[" and "[", others do not (the version I have does not), but we should use
them for best compatibility.

configure.ac


2016-03-17 10:21:16 +0000
Chris Liddell <chris.liddell@artifex.com>
d7e175bc49d8dcdc38af093cd744c62cb6451686

Remove some left debug code.

configure.ac


2016-03-17 10:06:14 +0000
Chris Liddell <chris.liddell@artifex.com>
a529498d1a52bbb91cca5e32512d6c49e665a004

Bug 696665: fix gs only install

I added dummy gpcl6 and gxps exe names to avoid a warning when building from a
gs only release archive. I neglected to add appropriate dummy install targets
for those, and that caused an error with "make install".

base/unixinst.mak


2016-03-15 08:17:34 -0700
Ray Johnston <ray.johnston@artifex.com>
3a089782b11699fe83c22a92544623a9c21e0c4a

Revert change to mswinpr2 device from commit 5cf300b

This caused us to ignore the printer specified by -s%printer%___
and always use the default printer if QueryUser was not specified

devices/gdevwpr2.c


2016-03-14 10:09:42 +0000
Chris Liddell <chris.liddell@artifex.com>
f75b4a8160d60039d850c581c7fbe18f1574bc39

Always have configure set gpcl6 and gxps exe names

But still skip adding them to the targets list if the source is not available.

This avoids a warning when building a Ghostscript only release archive.

configure.ac


2016-03-11 10:34:00 +0000
Chris Liddell <chris.liddell@artifex.com>
7f9c8fbce554eebdbda21f25d208c541355e177d

Update dates versions in docs etc

Makefile.in
doc/API.htm
doc/C-style.htm
doc/Commprod.htm
doc/DLL.htm
doc/Deprecated.htm
doc/Details8.htm
doc/Details9.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/Helpers.htm
doc/History1.htm
doc/History2.htm
doc/History3.htm
doc/History4.htm
doc/History5.htm
doc/History6.htm
doc/History7.htm
doc/History8.htm
doc/History9.htm
doc/Install.htm
doc/Issues.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.htm
doc/Projects.htm
doc/Ps-style.htm
doc/Ps2epsi.htm
doc/Psfiles.htm
doc/Readme.htm
doc/Release.htm
doc/SavedPages.htm
doc/Source.htm
doc/Unix-lpr.htm
doc/Use.htm
doc/VectorDevices.htm
doc/WhatIsGS.htm
doc/Xfonts.htm
doc/gs-vms.hlp
doc/thirdparty.htm
man/dvipdf.1
man/font2c.1
man/gs.1
man/gslp.1
man/gsnd.1
man/pdf2dsc.1
man/pdf2ps.1
man/pf2afm.1
man/pfbtopfa.1
man/printafm.1
man/ps2ascii.1
man/ps2epsi.1
man/ps2pdf.1
man/ps2pdfwr.1
man/ps2ps.1
man/wftopfa.1
psi/int.mak
psi/winint.mak


2016-03-11 10:30:26 +0000
Chris Liddell <chris.liddell@artifex.com>
837d4dcaff85a7c96726caaeeb10b690aa6e18f1

Change product string for 9.19 RC1

base/gscdef.c


2015-09-30 14:57:38 +0100
Chris Liddell <chris.liddell@artifex.com>
50efb7307dab9df334ad45acdfbe83bf2f3ffba3

Tweak changelog for 9.18 release

doc/History9.htm


2015-09-24 11:04:22 +0100
Chris Liddell <chris.liddell@artifex.com>
32e59ede8dddc2838478dfaeac2a238318c22835

Add words to 9.18 release notes

about the revised directory structure, build and executable names

doc/History9.htm
doc/News.htm


2016-03-10 11:16:51 +0000
Robin Watts <robin.watts@artifex.com>
e980dc6f1356e659254974838a94e16d6506af44

Bug 696640: Fix stack overflow in memento.

Windows backtraces are limited to 63 levels. Linux ones can be
any size. I'd mistakenly overflown the buffers in the linux
case.

While we're fixing that, improve the code to require less copying.

base/memento.c


2016-03-10 04:32:36 -0800
Robin Watts <robin@peeves.(none)>
596e5b0bb0bc470cc177e5dca35bc69de7c664d1

Memento: Fix linux memento builds.

The fix for windows builds broke linux due to -DMEMENTO
being in CFLAGS on windows, and GENOPT on configured builds.

Also tidy the code to avoid things detected by the more picky
compiler on Linux.

base/lib.mak
base/memento.c
base/memento.h


2016-03-09 23:44:10 +0100
Vincent Torri <vincent dot torri at gmail dot com>
80c9d7671534c51e7239e0f7c5ca8a67a43c842d

Bug 696641 - support build with MSYS2

uname in MSYS2 terminal reports MSYS_NT-6.1, so add MSYS* to all the "case"
in configure.ac.

Note: cygwin terminal's uname reports CYGWIN_NT-6.1

configure.ac


2016-03-10 11:11:35 +0000
Robin Watts <robin.watts@artifex.com>
f79377b1a156c40ff304a3d161b54865e35f23a3

Fix windows memento builds.

So, windows.h cannot be used unless Microsoft extensions are enabled.
How dumb is that?

base/lib.mak
base/memento.c


2016-03-09 10:49:26 +0000
Chris Liddell <chris.liddell@artifex.com>
0e787367c085457a106890ce4c2068dccee86933

Removing hacky HAVE_LIBDL stuff for memento....

Replace with proper configure setting.

base/lib.mak
configure.ac


2016-03-09 15:36:50 +0000
Chris Liddell <chris.liddell@artifex.com>
4f0dd9dd527451c1a2b625c667c4bf0a131e9ce3

Properly fix building with shared OpenJPEG.

configure.ac


2016-03-07 06:26:25 -0800
Robin Watts <robin@peeves.(none)>
0d4339898f181acb77bc4cc2a419f38cf4727b4e

Memento: Store/display backtraces with blocks.

If built with MEMENTO_DETAILS (on by default), we store the
backtrace on every event that affects a block.

Memento_details(address) will display the events that affected
a block (typically malloc, {realloc}*, free), including the
backtrace at each point.

Windows and linux use different mechanisms for this. Windows
loads a DLL and calls windows specific functions - no extra
libraries are required.

Linux also loads a shared object (libbacktrace.so). This is not
present on all platforms, so on platforms where it is not available
we just get addresses. These can be converted using addr2line
(unless ASLR is enabled).

base/lib.mak
base/memento.c


2016-03-05 15:25:01 -0800
Chris Liddell <chris.liddell@artifex.com>
8692d5e0996ab3995e1d02efc3d0ca145ccced71

Fix psdcmyk handling of output to /dev/null or equivalent.

The PSD file format does not support multiple images (pages) in a single file,
so we spot such an attempt (by checking whether or not the output file string
has a "%d" in it) and throw an error.

This also throws an error if an attempt is made to write multiple pages to
/dev/null (as is done for performance testing).

Since it really doesn't matter if the output "file" is invalid when we're just
discarding the data, spot this case, and allow multi-page files to run
without error.

devices/gdevpsd.c


2016-03-05 14:34:20 -0800
Chris Liddell <chris.liddell@artifex.com>
49852e6060f63b3feaa15157ee27644eb1d1b8c9

Remove pointless (Mac classic only) setenv()

base/gp_macio.c


2016-03-05 13:12:46 -0800
Chris Liddell <chris.liddell@artifex.com>
381bc0729b96f47ebe1ee5d49cb603d688361291

Bug 696610: add pngmonod into the configure build

configure.ac


2016-03-05 20:01:04 +0000
Ken Sharp <ken.sharp@artifex.com>
cd3c6a408bd64e515a46cfb4bdbbb7e42d0b943e

Now that we have contatced the original author and received written
copyright assignment, update the copyright headers for the RAM file
system code.

base/gsioram.c
base/ramfs.c


2016-03-04 16:18:23 -0800
Marcos H. Woehrmann <marcos.woehrmann@artifex.com>
284cd94895a68c0d558c2b9d5325b77cce90f807

Document psdcmykog device.

doc/Devices.htm


2016-03-04 15:15:07 -0800
Ray Johnston <ray.johnston@artifex.com>
5cf300b7347c509f7530f5f9e7d6b0b997581f33

Fix bug 696559, default to QueryUser=3 so that printer properties are correct.

Thanks to Nikolaus Kreuzer for suggesting this method. It now seems to work
as requested and as I would expect.

devices/gdevwpr2.c


2016-03-04 13:56:09 -0800
Chris Liddell <chris.liddell@artifex.com>
53ee0f551785f8ae3689f8cef77b48d76ba6340f

Bug 696518: remove long deceased pcx2up device.

base/unix-gcc.mak
configure.ac
devices/devs.mak
devices/gdevp2up.c


2016-03-04 14:04:19 -0800
Ray Johnston <ray.johnston@artifex.com>
ab70c0f9de22ff012d5d73f9b2aab9ae724a743b

Fix bug 696515 -- the snowflak.ps did not handle page size < 250 points.

examples/snowflak.ps


2015-10-14 10:26:16 -0700
Ray Johnston <ray.johnston@artifex.com>
449604f1a31067fa8e32227c3ce234b55b8cf143

Get rid of code allowing for no 12 bit or 16 bit image support.

The gxino12b.c and gxino16b.c modules were no longer used and the
graphics library always supported 12 and 16 bit images, so remove
the leftover code allowing for these to be build time options.

This was causing false positives with helgrind since the procs
were being set into the two-dimensional array at run time. The
unpackicc_16 had this same code even though there was no method
or check for non-support.

base/gxi12bit.c
base/gxi16bit.c
base/gximage.h
base/gximdecode.c
base/gxino12b.c
base/gxino16b.c
base/gxipixel.c
base/gxiscale.c
base/gxsample.h


2016-03-04 19:17:10 +0000
Ken Sharp <ken.sharp@artifex.com>
f71dca797cbcdf0430fd8009c6c517baed62b4cb

pdfwrite - FunctionType 2 C0 and C1 are optional

Bug #696626 " A PDF file causes ps2pdf crash"

The code fro serialising a Type 2 function was assuming that C0 and C1
were valid (validated by the interpreter) and always present. In fact
both of these are optional. We were attempting to dereference a NULL
pointer.

Altered the type 2 serialise code to write the default values if either
or both of C0 and C1 are not present.

No differences expected.

base/gsfunc3.c


2016-03-04 18:50:01 +0000
Ken Sharp <ken.sharp@artifex.com>
a90ca3d4c30339f93b1e595ee81d08f1ca7174e4

ps2write - suppress an address sanitizer warning for MM fonts

ps2write does not currently handle Multiple Master fonts well, we know
this there is an open enhancement for it. We do have a hacky work-around
which turns the MM OtherSubrs into regular OtherSubrs using the blended
values.

This doesn't work when the font program uses constrcuts such as ' x y div'
in order to create floating point values. This could mean that we did
not have as many paramters as expected on the stack as are required for
a given MM OtherSubr, leading to us indexing off the bottom of the
stack.

This meant we were using random values, but this didn't really matter
as the data is always going to be wrong. However the address sanitizer
complains about this.....

In this commit if we would underrun the stack we just write a 0 instead

devices/vector/gdevpsf1.c


2016-03-04 15:40:30 +0000
Ken Sharp <ken.sharp@artifex.com>
8175c6993efa8637ac39a050cc0696a19214abe1

pdfwrite fix address sanitizer complaint.

When checking a font name to see if its a URW replacement for a base 14
font we were doing a memcmp with the length of the candidate name.

If that length exceeded the length of the URW name then we were in
effect comparng against part of the next name (or random bytes off the
end of the table.

Of course this is harmless except in the highly unlikely case of the end
of the table not being followed by more data bytes. But the address
sanitizer complains. So we now compare the length of the two strings
first.

devices/vector/gdevpdtb.c


2016-03-03 15:50:48 -0800
Robin Watts <Robin.Watts@artifex.com>
b40526038481dd3158331df6c42c47654e02c3ab

Memento: Speed improvements.

Avoid searching the linked list of blocks in order to remove a
block by moving to a doubly linked list. This can be done
without increasing the amount of memory in use by making better
use of the 'parent' pointer that is only used when displaying
nested blocks.

Also store magic values in the 'child' and 'sibling' pointers
(again only used when displaying nested blocks) so that we
can quickly verify that a block is real before doing too much
with it.

Those changes drastically reduce the time required for
MEMENTO_LEAKONLY runs (now the same order of magnitude as non
memento runs).

Normal memento runs are still very slow when the numbers of
blocks increase due to the paranoid checking taking time.

To ameliorate this a bit, we try 2 other things.

Firstly, we optimise the searching of blocks by making use of
int aligned tests. This still doesn't make much difference.

Secondly, we introduce a new mechanism for the 'paranoia'
levels. If a negative number is given for the paranoia level
(say -n) then we first perform our overwrite checks after n events.
We next test after 2n events, then 4n, then 8n etc.

The new default paranoia level is set to be -1024.

This makes a huge difference, and brings normal memento runs
down to be comparable with debug runs.

base/memento.c
base/memento.h


2016-03-01 16:58:43 +0000
Robin Watts <robin.watts@artifex.com>
83055a87a2ce1910ede8cdfe722766a8a4c13d55

Bug 696616: Move antidropout downscaler functionality.

The current code globally enables use of the antidropout
downscaler on all halftoned devices (unless they override
the gxdso call), when interpolation is enabled.

We now introduce a -dAntidropoutDownscaler option that
defaults off. That sets a bit in dev.color_info that is
used to control the option. This decouples it from
interpolation.

base/gdevdflt.c
base/gsdparam.c
base/gxdevcli.h


2016-03-01 17:20:04 +0000
Chris Liddell <chris.liddell@artifex.com>
7a3d6527825a79471e93b723bbd2e6dad0c61b64

Fix up some broken/out of date links

Marcos did some cleanup identifying broken links, based on his work, I've fixed
the broken links, and removed those to files that no longer exist.

doc/Develop.htm
doc/Drivers.htm


2016-03-01 15:04:38 +0000
Robin Watts <robin.watts@artifex.com>
579f5891d69bcb057f27e44d49bf686d64a9f2ee

Bug 696620: Avoid rangecheck errors in tiff devices.

Only write downscaler options if we will read them.

devices/gdevtifs.c


2016-02-29 15:33:23 +0000
Ken Sharp <ken.sharp@artifex.com>
3c4c85ae660c22d8442c3a9ea17bbc295f2a2fac

high level forms - account for flipped/mirrored CTM

For high level forms support, if the device requests a specific CTM be
applied we calculate a clip path which includes negative co-ordinates
to ensure that a translated form won't be erroneously clipped to the
page.

When doing this, we need to account for the CTM when the form is executed
potentially being flipped or mirrored (or both!)

No differences expected.

psi/zform.c


2016-02-28 09:02:43 +0000
Ken Sharp <ken.sharp@artifex.com>
5d15322e32f85f9b4d9fbebd19148d7a95428adf

pdfwrite - silence Coverity warning

Change an indent to silence Coverity.....

devices/vector/gdevpdfi.c


2016-02-26 09:38:46 -0800
Marcos H. Woehrmann <marcos.woehrmann@artifex.com>
f682ba02caa1cb974e475cc387efce1e04d901f5

Fixed links in Develop.htm and Drivers.html.

Some referenced files appear to no longer exist, I've left those in
the documentation but commented out with a 'missing' notation.

doc/Develop.htm
doc/Drivers.htm


2016-02-25 14:23:02 +0000
Robin Watts <robin.watts@artifex.com>
b94ac333a172558441726e47f257cb26a3b6f924

Bug 696615: Solve incorrect copy_alpha of hl_color

The code that expanded alphas to 8 bits was incorrect for the
4 bit case.

base/gdevdbit.c


2016-02-25 10:56:35 +0000
Robin Watts <robin.watts@artifex.com>
65b72cece8e2462fd787e8d54d9f990327a061ac

Fix dropped error code in clist code.

base/gxclrect.c


2016-02-25 11:47:27 -0800
Marcos H. Woehrmann <marcos.woehrmann@artifex.com>
8f69cda3004976da8da5c23ca86fdb62086ec508

Another set of broken doc links.

doc/WhatIsGS.htm


2016-02-25 11:30:19 -0800
Marcos H. Woehrmann <marcos.woehrmann@artifex.com>
09ca513fbcd7e3a843cc2690dd9dadecfd50bad9

Fixed another broken link in doc.

doc/WhatIsGS.htm


2016-02-25 11:18:26 -0800
Marcos H. Woehrmann <marcos.woehrmann@artifex.com>
4d954bfd6b0bb8e3d7400ca1f5e4b6494ec91384

Fixed broken links in doc/*.htm.

There are still broken links in doc/Psfiles.htm, doc/Develop.htm, and
doc/Drivers.htm caused by the files they refer to having been moved to
a different directory. Those will be fixed in a separate commit.

doc/Devices.htm
doc/Language.htm
doc/Readme.htm
doc/Use.htm


2016-02-24 20:09:58 +0000
Robin Watts <robin.watts@artifex.com>
bcf738d762ef65e16f060d57ea15824f1f6bd57c

Bug 696611: Avoid imagemask interpolation errors with pbmraw.

pbmraw (deliberately) doesn't know how to copy_alpha. We never
call copy_alpha when going to pbmraw direct because of this, but
the clist wrapping defeats our detection. This results in an
error.

Tests enabling copy_alpha for pbmraw show a degredation in render
quality, so instead, we just disable all imagemask interpolation
when going to halftone devices.

base/gxiscale.c


2016-02-24 15:56:23 +0000
Robin Watts <Robin.Watts@artifex.com>
036710b85c9e1b08ea0c0c7d5e2ad0734a1460eb

Add some 'sanitize' targets to the Makefile

These build with address sanitizer enabled.

These hackily set the '-i' flag in the recursive calls to make
to sidestep the problems with genconf/mkromfs leaking at the
moment. These issues will be fixed and the -i removed.

Makefile.in
base/unix-end.mak


2016-02-24 17:51:29 +0000
Robin Watts <Robin.Watts@artifex.com>
dd65a40fa66835646972b665f352498c696557a1

Bug 696609: Fix operation in non 24bpp modes.

I had the depth checks in blank_unmasked_pixels wrong.

base/gxpcmap.c


2016-02-24 16:34:35 +0000
Robin Watts <Robin.Watts@artifex.com>
1386dbd1ad0bef6b6264e198162d0b7c9abfce54

Bug 696603: Quieten address sanitiser.

mem_mono_copy_mono includes some clever code that reads
16 bits at a time and shifts to do fast mono copies of
unaligned data. This can result in overreading the end
of data by a byte, but never so far as to cause address
overflows due to the granularity at which data can be
allocated.

The 'overread' data is never actually used.

The simple fix here just extends the source block by
a byte to avoid error sanitizer complaining. Valgrind
correctly does not flag this.

pcl/pcl/pcbiptrn.c


2016-02-24 13:45:20 +0000
Robin Watts <robin.watts@artifex.com>
628f3de2f47e46d2b56fa9f6bfd7b7a479d8b10e

Bug 699613: gs leaves temp files in GS_NO_UTF8 windows builds.

Adopt Cecil Hornbakers patch to solve this. Many thanks!

base/gp_mswin.c


2016-02-24 12:30:28 +0000
Robin Watts <robin.watts@artifex.com>
8fa7be62354e783551661cbda24b56deb3e67f1f

Remove unused variables/conditions from gdevpdf.c

Spotted while debugging bug 696612.

Various places in the code do:

{ int j, code = 0;
for (j = 0; j < n && code >= 0; j++)
{
STUFF
}
}

which is a perfectly reasonable thing to do - except for the
facts that: 1) STUFF never alters the value of code, and 2) even
if STUFF did alter the value of code, we never check the value
and return it.

Accordingly, I've just removed the references to code.

devices/vector/gdevpdf.c


2016-02-24 12:31:17 +0000
Robin Watts <robin.watts@artifex.com>
e2a848f1157fdecab41165ac790394202e13d9d0

Bug 696612: Swallow rangecheck errors in psf_check_outline_glyphs

At the closedown of the file, we run through and write out fonts.
As part of this process, we check the glyphs in the font. If any
of the glyphs come back as bad, we abort the whole process.

Previously we ignored any errors here, and my change to make us
not ignore errors in the pdf_close routine caused this regression.

After discussion with Ken and Chris, the correct fix, I believe,
is to continue to catch and honour all errors in pdf_close, but
to explicitly swallow certain errors lower down.

Chris suggested, and I agree with him, that simply swallowing
the rangecheck error in psf_check_outline_glyphs would be an
acceptable fix (for now at least).

I am leaving the bug open and passing it to Ken so that he can
double check this area in more detail at his convenience.

devices/vector/gdevpsfu.c


2016-02-23 19:53:31 +0000
Robin Watts <robin.watts@artifex.com>
636bb0bce0ece581f3004915e2c10c79c00439eb

Bug 695180: Maintain antialias levels into pdf14 devices.

When creating a pdf14 device, ensure that the antialias level
of the pdf14 device matches that of the underlying device.

This prevents antialiasing getting lost when the clist kicks
in for transparency.

base/gdevp14.c


2016-02-23 18:57:28 +0000
Robin Watts <Robin.Watts@artifex.com>
b85daf6bdb43c09fe92ac9c319c9fea5b012989a

Bug696540: Fix pattern accumulator initialisation

When we create a pattern accumulator the bitmap contents are
initially undefined. We then draw a rectangle over them to set
them to known values.

Unfortunately the code that writes this bitmap does not check
for the ctm being sane, so in some cases the initialisation
can fail.

This shows up as indeterminisms in the alpha blending.

The simple fix is to set the ctm to the identity matrix before
rendering.

base/gxpcmap.c


2015-12-28 17:35:10 +0000
Robin Watts <Robin.Watts@artifex.com>