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.50 (2019-10-15)

Highlights in this release include:

  • The change to version 9.50 (rather than the intended 9.28) follows recognition of the extent and importance of the file access control redesign/reimplementation outlined below.

  • The file access control capability (enable with -dSAFER) has been completely rewritten, with a ground-up rethink of the design. For more details, see: SAFER.

    It is important to note that -dSAFER now only enables the file access controls, and no longer applies restrictions to standard Postscript functionality (specifically, restrictions on setpagedevice. If your application relies on these Postscript restrictions, see OLDSAFER, and please get in touch, as we do plan to remove those Postscript restrictions unless we have reason not to.

    IMPORTANT: File access controls are now enabled by default. In order to run Ghostscript without these controls, see NOSAFER

  • Important Note for Windows Users: See below under Incompatible Changes

  • IMPORTANT: We are in the process of forking LittleCMS. LCMS2 is not thread safe, and cannot be made thread safe without breaking the ABI. Our fork will be thread safe, and include performance enhancements (these changes have all be been offered and rejected upstream). We will maintain compatibility between Ghostscript and LCMS2 for a time, but not in perpetuity. Our fork will be available as its own package separately from Ghostscript (and MuPDF).

  • The usual round of bug fixes, compatibility changes, and incremental improvements.

  • Special thanks to Akira Kakuto, Paul Wessel, William Bader, Nelson H. F. Beebe and everyone else who put time and effort into testing this new release.

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

Incompatible changes

  • There are a couple of subtle incompatibilities between the old and new SAFER implementations. Firstly, as mentioned above, SAFER now leaves standard Postcript functionality unchanged (except for the file access limitations). Secondly, the interaction with save/restore operations, see SAFER.

    Important Note for Windows Users:
    The file/path pattern matching is case sensitive, even on Windows. This is a change in behaviour compared to the old code which, on Windows, was case insensitive. This is in recognition of changes in Windows behaviour, in that it now supports (although does not enforce) case sensitivity.

  • The following is not strictly speaking new to 9.50, as not much has changed since 9.27 in this area, but for those who don't upgrade with every release:

    The process of "tidying" the Postscript name space should have removed only non-standard and undocumented operators. Nevertheless, it is possible that any integrations or utilities that rely on those non-standard and undocumented operators may stop working, or may change behaviour.

    If you encounter such a case, please contact us (either the #ghostscript IRC channel, or the gs-devel mailing list would be best), and we'll work with you to either find an alternative solution or return the previous functionality, if there is genuinely no other option.

    One case we know this has occurred is GSView 5 (and earlier). GSView 5 support for PDF files relied upon internal use only features which are no longer available. GSView 5 will still work as previously for Postscript files. For PDF files, users are encouraged to look at MuPDF.

Changelog

2019-10-14 18:07:29 +0100
Chris Liddell <chris.liddell@artifex.com>
f2e2a3fe85d64cabde82d0f6eb982643bc6e8427

Add words about .currentpathcontrolstate operator

doc/Language.htm


2019-10-14 10:28:15 +0100
Chris Liddell <chris.liddell@artifex.com>
ad5b08d8be2e7a91599d3bbbc6aa841144662239

Change version to 9.50

Resource/Init/gs_init.ps
base/version.mak
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Internal.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gs-vms.hlp
doc/sample_downscale_device.htm
doc/subclass.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


2019-10-14 10:20:19 +0100
Chris Liddell <chris.liddell@artifex.com>
1937e14f17e5de54b57d0e911e828639d197a08c

Update docs on SAFER

to reflect that SAFER is now the default, and remove the comments about making
SAFER the default "in the future".

doc/Use.htm


2019-10-10 09:29:48 +0100
Ken Sharp <ken.sharp@artifex.com>
9c63f39ead4aab30addf213f0ab6843ac87b56cf

ps2write - restore missing %%PageTrailer comment

Bug #701659 "Missing %%PageTrailer commen"

An oversight in commit 96c381cce28c27eac182549441a6c5025b0dcdd6
caused the comment to be omitted.

devices/vector/gdevpdf.c


2019-10-07 18:41:10 +0100
Chris Liddell <chris.liddell@artifex.com>
1d89e1aa9cf65e5345a1f009b6d317db024719fe

Bug 701657: Allocate "memory" device in immovable gc memory

Devices are supposed to be allocated in memory that cannot relocate (i.e.
non-gc memory or an immovable allocation). The memory device accessible from
Postscript (makeimagedevice/makewordimagedevice) was being created in regular,
relocatable gc memory.

This caused an invalid memory access when cleaning up subclassed devices, as the
one device in the chain may have moved. So switch to using an immovable
allocation.

base/gsdevmem.c


2019-10-02 00:01:17 +0200
Sebastian Rasmussen <sebras@gmail.com>
458f715b0d59278f0788e0c89ee5eb04d48871ef

Update jbig2dec stuff for 0.17 release.

jbig2dec/CHANGES


2019-10-01 10:35:48 +0100
Chris Liddell <chris.liddell@artifex.com>
f8ba9e017cdfab836f62853629d75f484127342e

Fix memory corruption setting a halftone

When setting a new halftone in the graphics state, we try to re-use the data
from the existing device halftone.

The problem is that the device halftone can have higher component indices than
there are components in the new halftone we are creating. In this case, we can
end up writing off the end of the components array for the new halftone
structure.

Simply check that the new halftone has enough components before doing the
duplication.

base/gsht.c


2019-09-30 13:40:35 +0100
Ken Sharp <ken.sharp@artifex.com>
1681c7ebb5a338002d5f7dd8da9bffda675f0656

pdfwrite - don't honour /Producer key in DOCINFO pdfmark

Bug #701639 "pdfwrite should not honour the /Producer key in DOCINFO pdfmark"

The Producer in the document information dictionary (and XML Metadata)
is defined quite clearly as the application which produced the PDF file
from its native format.

Ghostscript uses the Producer key (if present in the pdfmark) to set
the Producer, but it should not do so. Adobe Acrobat Distiller (at
least the end user version) does not permit this value to be altered.

On reflection we can see why; in the case of a problem with a PDF file
its important to know which application created it, and we should not
let PostScript obscure that (we already do not pass the Producer
information on when the input is PDF).

The code did already attempt to overwrite any Producer string which
contained 'Distiller' (I have no idea why) and that code contained an
error which could lead to an invalid Document Information dictionary
being created.

This commit removes the ability for DOCINFO pdfmarks to alter the
Producer, which obviously fixes the bug.

However..... it is actually important for our commercial customers to
be able to set this value. A problem with a PDF file created by one of
our customer's products should be reported to that customer, not us, as
we will not be able to investigate the problem while our customer
should be able to. At the very least our customer will know how to
retrieve the configuration of Ghostscript being used.

So permit the commercial version of Ghostscript to set the /Producer
from a pdfmark.

devices/vector/gdevpdfm.c


2019-09-30 09:16:28 +0100
Chris Liddell <chris.liddell@artifex.com>
a27af00c8727ec4eaf0f4730963b8a81aab8590d

Small changelog tweak

doc/History9.htm


2019-09-27 13:26:01 +0100
Chris Liddell <chris.liddell@artifex.com>
b0574cdb5b427690ac8d95679930c9f6cc1bdffb

Bug 701634: Correctly handle file name of "\0"

Attempting to open a file with a filename string starting with a NULL
character should be treated the same as if the string was zero length.

Not doing so created a broken file object leading to several operations
resulting in a segfault.

Also, add cleanup in the event of such an error, freeing memory allocated in
preparing the gs stream object.

base/sfxcommon.c
psi/zfile.c


2019-09-26 10:47:01 +0100
Chris Liddell <chris.liddell@artifex.com>
cce67ebf4c209ae3cbcc671e944596c64a3d7fc9

Revised comment for 8992f00edfd1c39154c013489de2a01d2e9a92ee

Make it clearer why the revised behaviour is required.

base/gstiffio.c


2019-09-26 09:34:02 +0100
Chris Liddell <chris.liddell@artifex.com>
24c9f7f4a8d3e85e572094b4aedddbeeb02d5ef1

Bug 701313: Disable libtiff callbacks when libtiff is shared

It seems that libtiff uses global variables to store the error/warning callbacks
so if two callers in the exe are using the libtiff shared lib, very bad things
happen (usually a segfault).

So, if that's how we're linked, set the callbacks to NULL.

base/gstiffio.c


2019-09-24 15:48:54 +0100
Chris Liddell <chris.liddell@artifex.com>
c40963eb024265ab28f4f897401ad7a050ca9425

Cope with .setsafe(global) being called when already 'SAFER'

As we default to SAFER file controls now, we want to cope with .setsafe and
.setsafeglobal being called either when already SAFER, or called multiple times.

This means adding a .currentpathcontrolstate operator so we don't try to
influence the path control lists after control is activated.

Resource/Init/gs_init.ps
psi/zfile.c


2019-09-24 09:18:47 +0100
Chris Liddell <chris.liddell@artifex.com>
7d70bd4338291c99234dd0078b5cdc85178c0540

tiffsep(1): Cope with .tiff ending as well as .tif

devices/gdevtsep.c


2019-09-23 20:04:49 +0100
Robin Watts <Robin.Watts@artifex.com>
2f713b99e1a626ba4b7b1be8cc715043bb4e0f0a

Recast validate to use gs_file_name_check_separator.

Avoid using gp_file_name_directory_separator, as windows can
have 2 different directory separators.

base/gpmisc.c


2019-09-23 18:05:00 +0100
Chris Liddell <chris.liddell@artifex.com>
31df729a821d1683381493b96c2ecced9da1e5e2

Remove spurious call to gp_validate_path_len()...

...in gx_device_open_output_file()

There is no need to validate the path in gx_device_open_output_file() as it will
be done at a lower level (gp_fopen) for paths that require it (we only validate
*after* the Postscript style %device% paths have been expanded into 'real'
paths).

This also interacts badly with the revised handling of formatted string
file names, hence remove it.

base/gsdevice.c


2019-09-23 17:56:34 +0100
Chris Liddell <chris.liddell@artifex.com>
ca553d6d3ec0fa1455cf400629e08db90658aa85

Fix tiffsep(1) interaction with file permissions lists

The previous solution didn't quite work, when using formatted strings for
output file names (i.e. output-%d.tif).

This adds a dedicated gs_remove_outputfile_control_path() to mirror
gs_add_outputfile_control_path() and uses those for the dynamic adding and
removing of separation output file names.

base/gslibctx.c
base/gslibctx.h
devices/gdevtsep.c


2019-09-23 17:11:47 +0100
Robin Watts <Robin.Watts@artifex.com>
205e2f529e6da569ec764ebb4aeddc41c66a8860

Update path validation to accept multiple *'s as special case.

Previously we interpretted multiple *'s as meaning the same as
single *'s. Now we use them to mean "just those chars that
might be created by the use of a %...{d,x,u,i,o,X} format
specifier".

base/gpmisc.c
doc/Use.htm


2019-09-23 16:41:09 +0100
Robin Watts <Robin.Watts@artifex.com>
dd19ec5348723a5c70ff728911f856caa518166b

Improve OutputFile handling of %d etc.

Only accept %d (and friends) (as opposed to anything starting with %).
Only accept legal combinations of flags/widths/precision etc.
Generate a more conservative wildcard.

base/gslibctx.c


2019-09-20 12:38:02 -0700
Ray Johnston <ray.johnston@artifex.com>
da7486fc4b00eee956200d45fb340dc62c8e3bcb

Slight improvement to "permit-file-***" parameter documentation.

doc/Use.htm


2019-09-20 11:17:53 -0700
Ray Johnston <ray.johnston@artifex.com>
0222263e4fe03b29e9eb4141f7866fa8261d416a

Fix tiffsep and tiffsep1 with new file access control and SAFER mode

The tiffsep and tiffsep1 synthesize output file names with the outputfile
and the separation color name, but the 'open' of these filenames would
fail since they were not included on the permit_file_writing list.
Add the full filename before opening, and remove the names after closing.

devices/gdevtsep.c


2019-09-20 11:53:10 -0700
Robin Watts <Robin.Watts@artifex.com>
41d79063acee7244f5990d2a8e19c567e24051af

Squash stupid const warning.

base/gslibctx.c


2019-09-20 19:42:01 +0100
Robin Watts <Robin.Watts@artifex.com>
b58f45daa9007f482a49132cbfaa47c8b86ce7d5

Squash some "const" warnings.

pcl/pl/plmain.c


2019-09-20 17:49:57 +0100
Robin Watts <Robin.Watts@artifex.com>
0e7039d7a83a7e35b8b41d59d7fb9a8b4fda7fb0

Fix "permit-file-xxxx" handling.

Ray spotted that gs_add_explicit_control_path was adding 17
to arg before using it. 17 happens to be the right amount
to add for "--permit-file-read=", but the wrong amount for
write/control/all.

Update the code to call it with the correct arg pointer
to start with.

Also, update a couple of routines to cope with being called
with NULL strings.

Also use enum values in switch rather than 0, 1, 2.

base/gslibctx.c
pcl/pl/plmain.c
psi/imainarg.c


2019-09-19 11:02:48 +0100
Chris Liddell <chris.liddell@artifex.com>
18316aba11fafc57ee77dbd7774b2c88b964a9d9

Make missing jbig2 decoder fatal error.

If we have neither Luratech nor jbig2dec, have configure fail, unless
explicitly run with --without-jbig2dec

configure.ac


2019-09-18 09:24:25 +0100
Chris Liddell <chris.liddell@artifex.com>
0557d5d6628279fc526e9d87f05433800ce1b025

Dates etc for 9.28 rc3

base/gscdefs.h
base/version.mak
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Internal.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gs-vms.hlp
doc/sample_downscale_device.htm
doc/subclass.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


2019-09-17 11:42:13 +0100
Chris Liddell <chris.liddell@artifex.com>
2ff44c7c8a09dd1c6b7cd750323ee4087b5cebc5

Fix file permissions interaction with '@' command line

If an options file (prefixed '@' on the command line) followed something that
required initialising the Postscript interpreter (such as a '-c' option),
opening the file would potentially fail because file permissions had been
activated by the interpreter.

Add and remove the file from the permit reading list before attempting to open
it.

base/gsargs.c


2019-09-12 14:23:10 +0100
Chris Liddell <chris.liddell@artifex.com>
3695b7f576c607bd3627e6e28dc982fdf68b1b32

If set, add PCLFONTSOURCE value to permit_file_reading list

pcl/pl/pjparse.c


2019-09-11 13:07:02 +0100
Chris Liddell <chris.liddell@artifex.com>
4196e26a9cf3c8afd6c069a789ac649019ae096a

Bug 701561: 'reduce' paths before adding to permit lists

Before attempting to open files, we pre-process the requested file name to
remove surplus/unnecessary elements: i.e. './././file' would be reduced to just
'./file', or '../dir/../dir/../dir/file' would be reduced to '../dir/file'.

The 'reduced' path is what we try to open, hence it is also what we check
against the file permissions list before we allow files to be accessed.

That being so, we should also 'reduce' paths as we add them to the permissions
lists - thus the permissions list creation and checking are consistent.

base/gslibctx.c
base/lib.mak


2019-09-11 14:10:27 -0700
Ray Johnston <ray.johnston@artifex.com>
3d55799ea64088e08fc2783012957035c77a66ca

Fix Bug 696333. Allow large bitmaps in clist when writing tile cache.

When writing bits to update the tile cache, we don't need to restrict to
a single command buffer as with the copy_mono and copy_color commands.

Progressions on:
tests_private/comparefiles/Bug694385.pdf.psdcmyk.300.1..gs
tests_private/pdf/sumatra/2028_-_invisible_patterns.pdf.psdcmyk.300.1..gs
tests_private/ps/ps3cet/09-47B.PS.pdf.pkmraw.300.0..gs_pdf
tests_private/ps/ps3fts/176-01.ps.psdcmyk.300.1..gs

base/gxclbits.c
base/gxcldev.h
base/gxclrect.c


2019-09-12 10:37:42 -0700
Ray Johnston <ray.johnston@artifex.com>
1613502f83ddba352cc8e98e7dd3182c9d7732bc

Fix SEGV with flp device and PCL with clist mode and large BandHeight.

If the 'clist_init' fails initially (with rangecheck) due to the buffer
space too small for the BandHeight specified, we loop in the caller after
increasing the buffer size, but clist_init left "is_open" false when failing.
Add save_is_open in gdev_prn_setup_as_command_list so that we can restore it
if the clist_init eventually suceeds.

The SEGV was with image_data because re-opening the flp device reset the
"obsolete" procs to the default, so flp_image_data was replaced by the
gx_default_image_data, but no begin_image had been performed (flp_begin_image
skipped this since we were not yet at the FirstPage).

base/gdevprn.c
base/gxclist.c


2019-09-16 18:53:49 +0200
Sebastian Rasmussen <sebras@gmail.com>
f2d03f59e04a053c14285d8dbdd869bf9a4435e7

Update jbig2dec stuff for 0.17 release.

jbig2dec/CHANGES
jbig2dec/jbig2.h
jbig2dec/jbig2dec.1


2019-09-16 18:48:36 +0200
Sebastian Rasmussen <sebras@gmail.com>
8da8fbaeb6074161bc3a9b22e89265f5942db0d9

jbig2dec: Use the same contact information everywhere.

jbig2dec/README
jbig2dec/configure.ac.in
jbig2dec/jbig2dec.1


2019-09-16 16:12:32 +0100
Paul Vojta <vojta@math.berkely.edu>
6c6e19334062d12189612b84f53fe393a7808f74

Documentation - fix some typos

Bug #701589 "Minor documentation problems in 9.28-rc2"

Thanks to Paul Vojta for pointing these out. Unfortunately we cannot use the
supplied patch, as it includes alterations to History9.htm, which is auto-
generated from the commit logs. The remaining changes are applied here.

doc/Language.htm
doc/Use.htm


2019-09-11 12:18:51 +0100
Chris Liddell <chris.liddell@artifex.com>
90bdf83d696562e4136b8f565cac06cc32b161ae

Bug 701563: pdfwrite annotation pdfmark /Border key

Despite the spec saying the values for the /Border key are in user space
coordinates, Distiller appears to pass the values through to the output PDF
untouched (no rescaling - unlike the values for /Rect, also in user space,
according to the spec, which it does scale/translate). Ghostscript/pdfwrite
did scale the /Border values.

This just changes pdfwrite to write the values out unchanged.

devices/vector/gdevpdfm.c


2019-09-16 09:56:52 +0100
Ken Sharp <ken.sharp@artifex.com>
a9e997cb97a274bebfc028e8831a43d6f66be0f9

Documentation - add a note about SAFER for PDF/X ICC profiles

Bug #701553 "Examples of PDF/X and PDF/A conversion should be updated for Ghostscript 9.28"

ICC profiles required for PDF/X and PDF/A output need to be readable
in order to work when -dSAFER is true (the new default). This wasn't
clear from the documentation, so add a note about it.

As noted in the bug report, it is possible to embed the profile in the
PostScript code, but as Chris says this is probably beyond reasonable
expectations of the average user; they simply won't change the example
and will then complain that it isn't correct. Users capable of making
this work almost certainly have enough knowledge to realise they can
do this instead of making the profile readable.

doc/VectorDevices.htm


2019-09-12 19:41:47 +0100
Robin Watts <Robin.Watts@artifex.com>
cea41505580dfe55234bd4972fbb09af5e2e6bb8

Fix various printer devices to properly call spec ops.

Various printer devices (psd, psdcmykog, tiffsep, tiffscaled)
were passing the spec ops on to gx_default_dev_spec_op rather
than gdev_prn_dev_spec_op.

The most obvious implication of this was that we'd sometimes
get a warning about printer devices having a private spec op.

devices/gdevcmykog.c
devices/gdevpsd.c
devices/gdevtsep.c


2019-09-12 17:09:50 +0100
Robin Watts <Robin.Watts@artifex.com>
89f3d6001728678755aca8c5a02e57bba72a0813

Bug 701568 followup: Fix RLE compressor.

The previous fix to the RLE compressor reveals an additional
existing issue to do with us not checking whether we have
space in the buffer to write the EOD byte.

Fixed here.

base/srle.c


2019-09-12 09:35:01 +0100
Robin Watts <Robin.Watts@artifex.com>
f394c0722d3415ba03f57dc32dcd8484d3173b62

Bug 701568: Fix gdevpx.c RLE stream handling.

The current code in pclxl_write_image_data_RLE passes
lines of data to the RLE compression routine. It tells
each invocation of that routine that this is the "last"
block of data, when clearly it is not.

Accordingly, the compression routine inserts the "EOD" byte
into the stream, and returns EOFC.

Independently of the return value used, having multiple EOD
bytes in the data is clearly wrong. Update the caller to only
pass "last" in for the last block.

The code still returns EOFC at the end of the data, so update
this final call to accept (indeed, expect) that return value
there.

devices/vector/gdevpx.c


2019-09-10 09:04:46 -0700
Ray Johnston <ray.johnston@artifex.com>
6cd0b941d86fe54b7e818e563dc702a147bab95a

Fix bug 701550, problem with forall on strings.

Hard to believe, but this problem has existed since at least version 3.33.
The 'string_continue' function altered the size which was used to decide if
there were still characters to be processed BEFORE invoking the 'push(#)' macro.
If the 'push(1)' encountered a full stack segment, it would return stackoverflow
so that the operand stack could be extended. This meant that the decision to
stop enumerating the string would end early (depending on how many times the
stackoverflow occurred).

Usually the procedure of the forall would either consume the character (reducing
the stack), or add an element to the stack triggering the stack extension before
the next execution of string_continue, but -c "401 string { dup } forall count ="
results in only 800 stack elements (rather than 802 as expected).

psi/zgeneric.c


2019-08-15 15:54:04 +0100
Chris Liddell <chris.liddell@artifex.com>
e62f684be3d80bb5599a669ddca3ee1b544100d8

Doc updates, changelog, news etc

Update to note explicitly case sensitivity on Windsows

In News.htm and History9.htm

doc/History9.htm
doc/News.htm
doc/Use.htm


2019-09-05 09:09:38 +0100
Chris Liddell <chris.liddell@artifex.com>
cc86598152465c85dfca5ba265608931672f730f

Date for 9.28 rc2

base/gscdefs.h
base/version.mak
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Internal.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gs-vms.hlp
doc/sample_downscale_device.htm
doc/subclass.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


2018-10-31 20:22:11 +0100
Sebastian Rasmussen <sebras@gmail.com>
350a5cd8b7bddee3fa914c914dd40a685fed54e7

Bug 700088: Report error if all wanted J2K components are not decoded.

Ghostscript used to attempt to use even the undecoded components.
The source code for upstream's opj_decompress tool avoided this by
a workaround along with a comment indicating that this ought to be
done in the library (so all clients, e.g. Ghostscript will benefit
from it). With this commit the library will error out if not all
requested components are successfully decoded. Thus Ghostscript
will no longer crash.

Reported in https://github.com/uclouvain/openjpeg/issues/1158
sent upstream in https://github.com/uclouvain/openjpeg/pull/1164
and finally committed in e66125fe260deee49fdf6e9978d9bd29871dd5bb

openjpeg/src/bin/jp2/opj_decompress.c
openjpeg/src/lib/openjp2/j2k.c


2019-09-03 12:34:55 -0700
Michael Vrhel <michael.vrhel@artifex.com>
b944e875baed62e718eee8e7ad2b351cd4f4aa07

Undo commit 95f7befcec1b30fd5014c8ad616485d32901ce33 for release

Proper handling of the page group color space is going to require
a more complex solution whereby we ensure that we do the final
alpha blending in the page group color space and not the target
device color space.

base/gstrans.c


2019-09-03 08:52:16 -0700
Michael Vrhel <michael.vrhel@artifex.com>
ebfe16357f3484209e69d6788cc52b20dbdb81a0

Add -sBlendColorProfile into Use.htm

doc/Use.htm


2019-09-03 18:15:56 +0100
Robin Watts <Robin.Watts@artifex.com>
bbdfaa56b00f2ba556476f0265e65e4ad370f641

Avoid potential UMR with arg checking in arg sanitization code.

base/gslibctx.c


2019-09-02 17:16:45 +0100
Robin Watts <Robin.Watts@artifex.com>
00d4696ea2de6c48a57d5a4ce0c3bbfd99201e3a

Proper fix for deep color overprint.

The previous fix confused memset and memcpy. Properly write the
(native endian) 16 bit color values into the big endian buffer.

base/gsovrc.c


2019-09-02 12:59:33 +0100
Robin Watts <Robin.Watts@artifex.com>
c6d448b3fe616fdc2ba1e52766c9a4417e4e738f

Fix deep color mattes.

As seen with the content vanishing when rendering
tests_private/pdf/sumatra/uninitialized_value_with_JPX_images.pdf
to psdcmyk16. The Softmask on the image has a Matte of [1,1,1]
and the calculations in the current code overflow, meaning that
it comes out as completely white.

We resort to 64bit to avoid the overflow. Mattes are vanishingly
rare, so speed shouldn't be an issue. We can revisit if we ever
find a case that matters.

base/gdevp14.c


2019-08-31 12:45:47 +0100
Robin Watts <Robin.Watts@artifex.com>
4c1f255c2e825ab5e0a3d0f7bfa88538c7cbb912

Update overprint hl_color code to cope with 16bit devices too.

base/gsovrc.c


2019-08-31 12:16:40 +0100
Robin Watts <Robin.Watts@artifex.com>
373787ee145e906c8d19d5ccda84b4f267db2010

Fix deep color transparency overprint.

The component copy loop at the end of the blend could fail to copy
enough entries.

base/gxblend.c


2019-08-30 15:16:34 +0100
Robin Watts <Robin.Watts@artifex.com>
361c4dd1e18ca0675173c0ad0104ffb910e93bb4

Avoid overflow in deep color luminosity calculations.

Resort to 64bit as scale calculations are not constrained
to the usual 16bit range.

base/gxblend.c


2019-08-29 10:02:49 +0100
Chris Liddell <chris.liddell@artifex.com>
51d57fafbdc021c8c73475db505156f77e96ce39

Fix clearing of the drag and drop file list

Because we have to store the list of file names from drag and drop events, in
order to correctly add and remove them from the permit file read list, we also
want to clear the lists before we destroy the "text" window object.

The problem is, this happens after we shutdown Ghostscript and unload the dll.

This moves that clearing of the list into function that we call before we
shut down.

psi/dwmain.c
psi/dwtext.c
psi/dwtext.h


2019-08-28 10:14:52 +0100
Chris Liddell <chris.liddell@artifex.com>
ad0532e379a9eb6eb8a6fc0a6305679b25cd9ecb

Fix path permissions added from cidfmap.

From the cidfmap, we accumulate a list of unique directory paths a we process
cidfmap and then add them - when I did that code, I forgot that to allow access
to the directory, we need a trailing directory separator.

Add that before calling .addcontrolpath

Resource/Init/gs_cidfm.ps


2019-08-27 16:49:30 +0100
Chris Liddell <chris.liddell@artifex.com>
f0fedf1f77a9fe70627355b45fdb809e83df3568

Fix font file finding with -P

In trying to reproduce the issue that inspired commit dea69cd04964, I noticed
that font file searching wasn't working correctly with -P specified on the
command line.

Previously, it could just end up with us not finding a font we should have, but
with dea69cd04964 it would result in a typecheck error.

This ensures the stack is always how it should be after the findlibfile
call

Resource/Init/gs_fonts.ps


2019-08-22 16:10:03 +0100
Chris Liddell <chris.liddell@artifex.com>
5c28996d19d5e10cb177e72c47037ec0c7b3e4d5

Make it clear: file/path matching is always case sensitive

even on Windows.

doc/Use.htm


2019-08-29 19:50:08 +0100
Robin Watts <Robin.Watts@artifex.com>
24532ce9371fd1f69dd343cbd6ac8187a86c5c96

Fix overflow in 16bit blending calculations.

The blending code uses the following construction in
several places:

src_scale = ...; /* a value between 0 and 0x10000 */
tmp = (y-z) * src_scale + 0x8000;
foo = x + (tmp>>16);

Where x,y,z, are all expected to be in the 0...0xffff range.

Due to y-z having a sign bit, this can overflow a 32 bit tmp.

We therefore sacrifice a bit of accuracy in src_scale to get
correctness.

base/gxblend.c
base/gxblend1.c


2019-08-28 14:13:27 +0100
Robin Watts <Robin.Watts@artifex.com>
ca52028b90a09d056190548c41ae0b9a9fbadb4e

Remove outdated FIXME's.

base/gdevp14.c


2019-08-28 12:50:36 +0100
Robin Watts <Robin.Watts@artifex.com>
bd59dc145252282d8f586c36082e63a0eba95c15

Bug 701446: Avoid divide by zero in shading.

The previous commit for this bug was enough to solve the problem
for ppmraw, but not, it seems, for other devices. This addresses
the division by zero more directly.

base/gxshade6.c


2019-08-27 20:13:02 +0100
Robin Watts <Robin.Watts@artifex.com>
9a32a379933f4ba27ff1ad5734ec8c24c42eb513

Fix deep color transparency saturation blending.

Problem seen with:

tests_private/pdf/PDF_1.7_FTS/fts_25_2513.pdf.psdcmyk16.300.1

base/gxblend.c


2019-08-27 17:45:57 +0100
Robin Watts <Robin.Watts@artifex.com>
68af4dbc7ca2d6bfdbe938b840799cb8883c973e

Bug 701446: Avoid division by zero in gx_shade_trapezoid

Remove some incorrect clipping code.

base/gxshade6.c


2019-08-27 15:54:36 +0100
Robin Watts <Robin.Watts@artifex.com>
4be058791ae19131f19a8303364be53619abc280

Exit early from gx_shade_trapezoid in more cases.

A zero height trap isn't plotted, so we can bail out early in
that case.

base/gxshade6.c


2019-08-26 17:02:03 +0100
Robin Watts <Robin.Watts@artifex.com>
9423e84178071f16b83d18412b22b0b479b1938b

Fix deep colour transparency "uncompositing".

Uncompositing a group uses a scale factor that is greater in range
than we'd like; we need to resort to 64bit to do this to avoid
losing accuracy.

This solves problems seen in:

tests_private/comparefiles/Bug689918.pdf.psdcmyk16.300.1

base/gxblend.c


2019-08-27 14:26:41 +0100
Chris Liddell <chris.liddell@artifex.com>
131768114453972469296658b795406b79630538

Handle relative FONTPATH values

Prior to 9.21 (specifically: 8abd22010eb4db0fb1b10e430d5f5d83e015ef70), relative
paths for FONTPATH worked, but did so due to a logic fault with how we search
for "lib" files.

When attempting to open file names specified on the command line, we used a
flag set in the command line handling (starting_arg_file) to know whether the
lib file searching logic should try to open the file name directly (as well as
trying the file combined with each path in the search path).

In versions prior to commit 8abd22010eb4 that flag (starting_arg_file) could
remain set to true, even after the command line file(s) had been opened. This
represented a (minor) security risk. Commit 8abd22010eb4 ensured the flag was
properly (re)set, and that caused relative paths for FONTPATH stopped working.

Rather than reintroduce the security risk, update the code that checks whether
the font files exist so it explicitly tries the file name directly, rather than
assuming .libfile (or findlibfile, in this case) does that automatically.

Also remove an extraneous (but benign) dup of the font name.

Resource/Init/gs_fonts.ps


2019-08-27 15:27:05 +0100
Ken Sharp <ken.sharp@artifex.com>
98310063bdbe8c67bcfe84e2c648cfa286a05738

pdfwrite - fix corner case with Color Conversion

Bug #701456 "Ghostscript creates broken PDF file after color conversion"

The test file is, essentially weird. The image on page 3 is not a single
image, its a series of images, all of which are in a /Indexed /DeviceRGB
colour space.

In addition, these images are drawn on *top* of another set of images
(thereby completely obscuring them). These images are also drawn in
/Indexed /DeviceRGB. However, these images are in fact monochrome, the
Indexed space consists of 2 colours. This means that (highly unusually)
we have a DeviceRGB image with 1 Bit Per Component.

This caused problems for the pdfwrite compression filter chooser because
it chose (and configured) a compression scheme suitable for 1 BPC data
and then actually output 8 BPC data. This led to the compression filter
writing too little data.

Fix this here by setting the BPC to 8 if we are doing colour conversion,
and have the colour conversion setup code use the original value in the
image enumerator (the conversion code *does* need to know the input is
1 BPC).

devices/vector/gdevpdfi.c


2019-08-27 11:36:35 +0100
Ken Sharp <ken.sharp@artifex.com>
aee3b922087674ddd7c64444988018fafc3da127

PDF interpreter - more /Mask strangeness in Acrobat

Bug #701468 " More weirdness with images containing invalid /Mask values"

In order to render this file as per Acrobat, we need to ignore the /Mask
array. However, in order to render bug 689717 correctly we need to fix
the /Mask array.

Both cases are 1 BitsPerComponent DeviceGray images, the only difference
is the actual /Mask values. Bug 689717 has [255 255] while 701468 has
[243 255]. We can differentiate based on whether we have DeviceGray
1 BPC image, where the Mask values are not the same. In the case they
are different we use the existing technique of calculating the maximum
value and using that (for both, so there is no range). Where there is a
range (ie not a single colour) this is clearly unusable in a 2-colour
image, so ignore the /Mask altogether.

Resource/Init/pdf_draw.ps


2019-08-26 15:28:33 +0100
Robin Watts <Robin.Watts@artifex.com>
ad22dcaa078fd16f2ac395f65b6ad87ba24c8903

Fix deep colour knockout logic.

Problem seen with:

tests_private/pdf/PDF_1.7_FTS/fts_25_2507.pdf.psdcmyk16.72.0

base/gxblend.c


2019-08-26 14:34:46 +0100
Robin Watts <Robin.Watts@artifex.com>
4cda7bfc8cc8c5c4dcd36167191012aa379100ac

Squash a couple of warnings.

base/gdevmem.c
base/gdevp14.c


2019-08-26 14:01:39 +0100
Robin Watts <Robin.Watts@artifex.com>
7b5166b5c65703abb02c15a31c9f8341f54d1470

Fix SoftLight blending in deep color transparency.

As seen with:

gs -sDEVICE=psdcmyk16 -r72 -dMaxBitmap=80000000 -o out.psd
tests_private/pdf/PDF_1.7_FTS/fts_09_0919.pdf

base/gxblend.c


2019-08-26 11:28:40 +0100
Robin Watts <Robin.Watts@artifex.com>
5875be5edeb034787a11760c9330cac039f13044

Fix problems with pngalpha and deep color transparency filling.

The pngalpha device is created with a depth of 32, with 3 color
components; this was confusing pdf14 into thinking that more
than 8 bits per color were being used, and so deep color buffers
were required.

To fix this we update the logic to be smarter; in cases where we
don't have a clear determination based on bits alone, we look
at the max_color and max_gray values. Because this code is now
more complex than before, we pull it into a shared function.

base/gdevdflt.c
base/gdevmem.c
base/gdevp14.c
base/gdevprn.c
base/gsptype1.c
base/gstrans.c
base/gxclthrd.c
base/gxdevcli.h


2019-08-23 15:06:17 +0100
Robin Watts <Robin.Watts@artifex.com>
6e7283fa5bcea9ffbe4bb9da440dd8fa4820e4d6

Fix deep color transparency issue.

Fix overflow in art_pdf_composite_knockout_16, seen in:

tests_private/comparefiles/Bug690546.pdf.psdcmyk16.72.0

base/gdevp14.c
base/gxblend.c


2019-08-22 18:24:49 +0100
Robin Watts <Robin.Watts@artifex.com>
628c9741323ea69b0be8e4008a81b1db3d644ab8

Fix deep color transparent pattern problems.

Transparency buffers are held as native endian. Pattern cache
tiles are held as big endian. When we make pattern cache tiles
from transparency buffers we therefore need a conversion.

base/gdevp14.c
base/gxblend.c
base/gxp1fill.c
base/gxpcolor.h


2019-08-25 19:35:14 +0200
Till Kamppeter <till.kamppeter@gmail.com>
be4da9d67cbec784be740086681f96a63496ae48

"cups"/"pwgraster" output device: Do not output LUTs with CUPS_DEBUG set

This change lets complete LUTs in the debug output only be listed when
CUPS_DEBUG2 is set and not already with CUPS_DEBUG.

cups/gdevcups.c


2019-08-25 19:08:52 +0200
Till Kamppeter <till.kamppeter@gmail.com>
0e28c843e56d1be4638bf9d84a499794534ea0d9

"cups"/"pwgraster" output device: Prefer the page size requested by user

Without special scaling/cropping options ("fit-to-page", "fill",
"crop-to-fit΅, ...) PDF and PostScript files printed with CUPS will be
printed with the page sizes of the document's pages and not the size
requested by the user via the "PageSize" or "media" option. This
allows correct printing of jobs with differently sized pages on
printers which have the appropriate sizes loaded without need of
manual intervention. Therefore the CUPS output device is matching each
input page against the sizes listed in the PPD to generate a correct
page geometry for the printer for each page.

Problem is if there are several equally-sized page size entries in the
PPD. Without further guiding always the first match is used, making
access to special functions provided by the others (like
full-bleed/borderless printing) inaccessible.

This commit adds the functionality of the user-requested page size
(via "PageSize" or "media" option) being preferred under the matching
page sizes, so that if for example a user selects a full-bleed version
of the desired page size and sends a photo, the photo gets rendered
and printed with the page geometry which the PPD reports for the
full-bleed version.

Nothing changes if the size of the user-requested page size does not
match the size of the input page at all.

cups/gdevcups.c


2019-08-25 12:45:27 +0200
Till Kamppeter <till.kamppeter@gmail.com>
a5ccd009fd632e058b4f0bc2849cfc293b39d1f2

"cups"/"pwgraster" output device: Small fix on size matching improvements

This is a fix for one little oversight on the changes to support matching
the input page size against the imageable areas of the PPD's page sizes.

This completes the fix of bug 701438.

cups/gdevcups.c


2019-08-24 23:11:10 +0200
Till Kamppeter <till.kamppeter@gmail.com>
a0284b5ac8c59014eab90c5a5ec388cd1676b79d

"cups"/"pwgraster" output device: Improved page size matching with PPD

Applied the following improvements for finding the correct page size
of the PPD file for the input page:

- Do not try to match by page size name, the input files do not
contain page size names.

- Do not only match the input page size against the actual media sizes
reported by the PPD but also to the imageable areas. Media size match
is preferred but if there is no media size match, we accept also
a match of the imageable area. In case of a match of the imageable
area we position the input page in the imageable area of the output
page.

- More debug output.

- In case of a custom page size (no match with PPD sizes) the page
size name in the CUPS Raster output is a correct "Custom.XXXxYYY"
and not the default page size name.

This should fix bug #701438.

cups/gdevcups.c


2019-08-23 18:09:32 +0200
Till Kamppeter <till.kamppeter@gmail.com>
ee43ff891b51f0ccec3ba38d538d3e23441ed439

"cups"/"pwgraster" output device: Reduced page size comparison tolerances

Before each page gets rendered its size is compared to the page sizes
of the PPD file to select the actual page size for the output. Reduced
the tolerances from 7% for the long edge and 5% for the short edge to
1%, as before easily wrong sizes got picked (See also bug 701438).

cups/gdevcups.c


2019-08-23 10:11:05 +0100
Chris Liddell <chris.liddell@artifex.com>
0311b61d5df67cd98e2c2d23ef3cec1cc4faa800

Windows Installer: cope with COMPILE_INITS=0

We default to COMPILE_INITS=1, and that was the only case that the installer
handled - i.e. building the installer with COMPILE_INITS=0 would install an
executable that wouldn't work without extra action (-I.. or similar).

This changes the installer compiler invocation, and the installer creation
so it behaves as it does now with COMPILE_INITS=1, but with COMPILE_INITS=0 the
installer will write the path to Resource/Init into the GS_LIB registry
key.

psi/nsisinst.nsi
psi/winint.mak


2019-08-22 23:30:34 +0200
Till Kamppeter <till.kamppeter@gmail.com>
137a0bda39f861600488b5a11c63914854c454c8

"cups"/"pwgraster" output device: Produce more debug output

When building with CUPS_DEBUG now debug output for the process of
matching the page geometry with the PPD file's page sizes is
produced.

cups/gdevcups.c


2019-08-22 08:58:01 +0100
Chris Liddell <chris.liddell@artifex.com>
09b53ebdc674f9f6e7a9c445e92617312dd93ab3

Handle explicit '\' escaping in path matching

As well as having to cope with both '/' and '\' as directory separators on
Windows, it turns out we also need to cope with the backslash separator being
explicitly escaped ("\\") - the explicit is added by the Postcript path
templating code in gs_init.ps.

I don't want to change templating code because that would likely have
implications in a lot of other places.

base/gpmisc.c


2019-08-22 10:51:28 +0100
Robin Watts <Robin.Watts@artifex.com>
f1692a288f1a17930f0b71e540908398a17d5366

Better CMYK conversion for bmpcmp

toolbin/bmpcmp.c
toolbin/bmpcmptab.h


2019-08-21 17:49:32 +0100
Robin Watts <Robin.Watts@artifex.com>
c8aaf3b7bc4232997d434170827fffd6887fc88f

Update bmpcmp.c to read psdrgb rather than psdbgr.

toolbin/bmpcmp.c


2019-08-21 15:33:27 +0100
Chris Liddell <chris.liddell@artifex.com>
9ba1827e220cd49a6732c04fcf3e55a268014377

Fix commit ec0b35fed3de: "Handle directory separators..."

The logic in the above fix was wrong.

base/gpmisc.c


2019-08-21 14:28:20 +0100
Robin Watts <Robin.Watts@artifex.com>
7d0206d2b118b26f6d87ba8f09d077eba417e4c9

Bug 701451: Fix clist color_usage calculations for shadings.

Or rather, don't attempt to calculate them badly, and just
use the safe "all colors" value.

base/gxclrect.c


2019-08-21 10:10:51 +0100
Ken Sharp <ken.sharp@artifex.com>
320ec9672b987a765324f89450de08b70aafbcd3

PDF interpreter - review .forceput security

Bug #701450 "Safer Mode Bypass by .forceput Exposure in .pdfexectoken"

By abusing the error handler it was possible to get the PDFDEBUG portion
of .pdfexectoken, which uses .forceput left readable.

Add an executeonly appropriately to make sure that clause isn't readable
no mstter what.

Review all the uses of .forceput searching for similar cases, add
executeonly as required to secure those. All cases in the PostScript
support files seem to be covered already.

Resource/Init/pdf_base.ps
Resource/Init/pdf_draw.ps
Resource/Init/pdf_font.ps
Resource/Init/pdf_main.ps
Resource/Init/pdf_ops.ps


2019-08-21 10:56:02 +0100
Chris Liddell <chris.liddell@artifex.com>
e5660f15f5fd4615254acec7ed403b4a7984cb09

Handle directory separators in access control matching

On Windows, we end up dealing with a mishmash of "/" and "\" as directory
separators, so a simple equality check isn't sufficient.

Since there is already (platform specific) function for checking whether a
string (or part thereof) is a directory separation, use it.

base/gpmisc.c


2019-08-20 21:50:18 -0700
Michael Vrhel <michael.vrhel@artifex.com>
596e9baa1b24b0a9dac4d8bad1ea80cd23dcab79

Disable use of alternate tint transform ICC profile

A prior commit introduced the use of color management
if the DeviceN or Separation device had an ICC profile
associated with the colorants. While there is an argument
for doing this, it is not the standard behavior seen in
AR. Disabling for now and will likely turn this into a
command line option.

base/gxcmap.c


2019-08-20 18:48:49 +0100
Robin Watts <Robin.Watts@artifex.com>
7547a2fc593e3a0bb8ea72f661389cd908c382f7

Fix crashes in RAW_DUMP debug code.

Dump the buffer before freeing the device, or the pointer will no
longer be valid.

Also, don't access through ppatdev14 when we know it's NULL.

base/gdevp14.c


2019-08-20 18:47:09 +0100
Robin Watts <Robin.Watts@artifex.com>
421727ed068b3f41fdbd9657d759397610fe8821

Fix deep color transparency pattern copying problem.

The following test:

tests/pdf/pattrans_solid_nonrect.pdf.psdcmyk16.300.1..gs

among others, was showing problems, due to us treating the offset
as bytes rather than shorts.

base/gxp1fill.c


2019-08-20 14:29:33 +0100
Robin Watts <Robin.Watts@artifex.com>
f9052f1debff2168d5a2606fa35bcaaf6f6f2ec7

Avoid signed overflow in deep transparency calculations.

base/gxblend.c


2019-08-20 12:24:03 +0100
Robin Watts <Robin.Watts@artifex.com>
898c9e5f06bb44ec3fd262b47eeaa5028e18773f

Fix overflow in deep color blending.

Multiplying a 16bit unsigned value with a 16 bit signed value
in a 32bit int means we lose the sign bit. Sacrifice a bit of
accuracy to avoid that.

base/gxblend.c


2019-08-20 10:10:28 +0100
Ken Sharp <ken.sharp@artifex.com>
85c9d6de80ba57deeee289238aa1c0202f584c3c

make .forceput inaccessible

Bug #701343, #701344, #701345

More defensive programming. We don't want people to access .forecput
even though it is no longer sufficient to bypass SAFER. The exploit
in #701343 didn't work anyway because of earlier work to stop the error
handler being used, but nevertheless, prevent access to .forceput from
.setuserparams2.

Resource/Init/gs_lev2.ps
Resource/Init/gs_pdfwr.ps


2019-08-19 10:03:57 +0100
Chris Liddell <chris.liddell@artifex.com>
3ba6d871c70398cfbd15b619127bf13ddea13282

Handle drag'n'drop file name/paths

Because we now run by default with the file access permission active,
we need to do additional work for Windows drag and drop files, so they don't
throw an invalidaccess error (since we implement drag and drop by sending
characters to the gs console to do '(file) run').

The problem is, we cannot add the file to read list, send the characters to the
console, and remove the file from the read list because, although SendMessage()
blocks until the message is handles, WriteConsoleInput() does not block until
the console buffers are consumed (i.e. it is asynchronous). So, there is no
certainty when the final SendMessage() in WM_DROPFILES case is finished that
Ghostcript will actually have run the file.

So, we create a list of dropped file names, add them to the permit read list,
when the next WM_DROPFILES event happens, or a WM_DESTROY event, we drop
file names from the permit read list before, if necessary, adding the current
ones.

psi/dwimg.c
psi/dwmain.c
psi/dwmainc.c
psi/dwtext.c
psi/dwtext.h


2019-08-16 15:43:32 +0100
Robin Watts <Robin.Watts@artifex.com>
d2e36e8ef01546aaee0cd0531fbc0fa932b23b99

Squash warnings in claptrap.

Thanks to William Bader for highlighting these.

base/claptrap-planar.c


2019-08-16 15:28:49 +0100
Robin Watts <Robin.Watts@artifex.com>
e34d5606835fc587e222b80bf9cac1bc40c4790b

Squash warning in gdevpsd.c

Thanks to William Bader for spotting this.

devices/gdevpsd.c


2019-08-16 13:08:14 +0100
Robin Watts <Robin.Watts@artifex.com>
f416b415e8e3a25446b66bf1a6253f86be0366de

Squash some compiler warnings.

base/gslibctx.c
base/gslibctx.h
devices/gdevpdfimg.c
devices/vector/gdevpdfu.c
pcl/pl/plmain.c


2019-08-15 11:39:51 +0100
Chris Liddell <chris.liddell@artifex.com>
9ead927968ff8104e1a81df1590fced74927639d

Dates and versions for 9.28 RC 1

base/gscdefs.h
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Internal.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gs-vms.hlp
doc/sample_downscale_device.htm
doc/subclass.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


2019-08-15 11:35:56 +0100
Chris Liddell <chris.liddell@artifex.com>
ae7dea2b9bd068f61b6aef312a7f4cbc9860cac3

Revision date

base/version.mak


2019-08-15 17:06:02 +0100
Chris Liddell <chris.liddell@artifex.com>
2f8e2423c860e89b325675dc1311819179740c76

Add -dNOSAFER for Windows installer cidfmap creation

psi/nsisinst.nsi


2019-08-15 14:36:55 +0100
Ken Sharp <ken.sharp@artifex.com>
226fb24dbe4f844b8c7531be3eccc2bfae1a103d

ps2write - don't password encrypt PostScript output!

Noticed while testing the args commit; if we set -sOwnerPassword (to
create a password-protected PDF file), but select (e)ps2write as the
device, then the resulting PostScript file would have all the streams
(in a PDF sense) encrypted with PDF password encryption.

Unsurprisingly, this result in a completely unusable PostScript file.
Lets not permit that....

devices/vector/gdevpdfp.c


2019-08-13 14:43:51 +0100
Chris Liddell <chris.liddell@artifex.com>
fd14a8e3701a7f75d758a1e536bcafbddeb70289

Document the new SAFER/file access controls

The documentation for the old SAFER remains in place (noted as deprecated) until
we actually remove it. Document accessing the old SAFER functionality
(-dOLDSAFER).

Generally, tidy up the HTML/formatting of the parameter and operator lists
in Use.htm and Language.htm - mainly making indenting even and consistent.

List .setpdfwrite as deprecated

Include setting the target of the first parameter of gsapi_new_instance() to
NULL before calling it, and fix the examples in API.htm

doc/API.htm
doc/Language.htm
doc/Use.htm
doc/VectorDevices.htm
doc/style.css


2019-08-13 14:40:45 +0100
Chris Liddell <chris.liddell@artifex.com>
79a06b45e784e6839b2b2129cd2620ea606254e1

Enable new 'SAFER' protection by default.

We'll now run by default with file access controls enabled. SAFER (and
.setsafe) now *only* enables file access controls. The old SAFER functionality
is (temporarily) available by specifying "-dSAFER -dOLDSAFER" on the command
line, or "-dOLDSAFER" before the call to .setsafe.

Resource/Init/gs_init.ps


2019-08-13 08:28:06 +0100
Chris Liddell <chris.liddell@artifex.com>
9883f2a931407503778bb94948b47480eff858b2

Add null file to the permit writing list

base/gslibctx.c


2019-08-12 12:21:50 +0100
Chris Liddell <chris.liddell@artifex.com>
7abf720f46dd9ff6018b7f29141ba0573016d59d

Use enum values for shutting down the file access lists

base/gslibctx.c


2019-08-09 14:43:17 +0100
Chris Liddell <chris.liddell@artifex.com>
d86ecec686d77e69f7c4a10df9da8c4cd8336a03

Tweak to better handle undefined transparency ops

examples/transparency_example.ps


2019-08-08 10:46:39 +0100
Chris Liddell <chris.liddell@artifex.com>
7ca1bb5794997e0dba059a5be6f85a9eaefc915d

Fix gs_add_explicit_control_path()

it was always adding to the "read" list, rather than the list requested by the
parameter.

base/gslibctx.c


2019-08-08 10:33:18 +0100
Chris Liddell <chris.liddell@artifex.com>
34dac4d2a1b195536fcb9d796168cd1360c0e500

Don't bind and undefine .copytree

.copytree is a Postscript proc that calls itself recursively, hence we cannot
bind it nor undefine it.

Resource/Init/gs_setpd.ps


2019-08-06 09:32:32 +0100
Chris Liddell <chris.liddell@artifex.com>
4d53f6ee868205c76950027e76a27f0278513a39

Tweak the interaction of file permissions and -I

The new file permissions code differentiates between 'path', 'path/' and
'path/*', whilst the old -I code did not.

This slightly modifies how the -I stuff drives the file permissions stuff so it
works (more) like the previous -I behaviour.

The remaining difference is that the new code always treats '*' as a wildcard,
where the old code would permit '*' as a 'real' character in a path.

Resource/Init/gs_init.ps


2019-08-15 09:52:04 +0100
Ken Sharp <ken.sharp@artifex.com>
00af0eb11b82c4dfddbe91bcb70caed2e61a1cc8

pdfwrite/ps2write/pdfimage - record args used

Following on from commit 813d7e96c8733f85d59a62732171cf7cedfc087d this
adds functionality to the pdfwrite and pdfimage families of devices to
actually write the args that were used to generate the output file into
the final output file, as comments.

Output files are somewhat larger with this commit, but only very small
files are in any way significantly larger. We do have a number of such
files in our test suite which exhibit larger output ( > 5%increase).

devices/gdevpdfimg.c
devices/vector/gdevpdf.c
devices/vector/gdevpdfu.c
devices/vector/gdevpdfx.h


2019-08-12 16:30:46 +0100
Robin Watts <Robin.Watts@artifex.com>
813d7e96c8733f85d59a62732171cf7cedfc087d

Capture args to feed to pdfwrite.

To facilitate debugging, we want a way to pickle the gs invocation
used into device output (for devices that want it).

We therefore amend the argument processing logic to pass arguments
to gs_lib_ctx, where they will are 'sanitized' and stored in a list.
This list can then be accessed by a device.

We are careful to sanitize the args so as not to reveal paths or
secret passwords/code etc. Essentially we never store any filenames
or string values stored (except for certain whitelisted -s options).

It is likely that we'll want to expand the whitelisted values in
future.

base/gsargs.c
base/gsargs.h
base/gslibctx.c
base/gslibctx.h
pcl/pl/plmain.c
psi/imainarg.c


2019-08-14 16:47:36 +0100
Robin Watts <Robin.Watts@artifex.com>
8ba95fb06387572160fee5e4c1e51d972401566e

Fix gs_lib_ctx memory calls to use the correct memory pointer.

base/gslibctx.c


2019-08-14 08:03:45 -0700
Ray Johnston <ray.johnston@artifex.com>
ddddd71785d058b036775566d36d6848c9817f80

Fix -F____ and -f____ to actually run the file ____.

Commit 7ecbfda9 broke -F completely since it requires the file to run to
immediately follow the switch, and -f____ use to run the file, but since
gs_add_control_path returns 0 as long as there was no error, the code
never called argproc. Also, argproc already does the add_control_path
and remove_control_path, so simplify -f and -F code.

Also gs_add_outputfile_control_path was ignoring the return code when
adding the full pipe string as a path, so fix it.

Note that plmain ignores the return code from gs_remove_control_path,
but that should be OK.

base/gslibctx.c
psi/imainarg.c


2019-08-12 13:53:29 +0100
Robin Watts <Robin.Watts@artifex.com>
3eb2b1337260a17274588d377032e1f9953062fd

Squash double -> int warning message with explicit cast.

base/gxblend.c


2019-08-13 11:54:36 +0100
Robin Watts <Robin.Watts@artifex.com>
8b5af0e2db28be36d96de97eb1a145d5716ffea3

Tweak lcms to optimise the pipeline before consulting plugins.

This allows us to recognise identity transforms before selecting
one of our optimised lookup functions. Firstly, however optimised
our code is, we aren't going to beat the identity code. Secondly,
lcms doesn't calculate the tables for identity transforms, so
our code can fall in a heap here.

lcms2mt/src/cmsxform.c


2019-08-13 16:05:37 +0100
Ken Sharp <ken.sharp@artifex.com>
15d95340389f0f46bd214803ec19685c0a738a0e

Deprecate .setpdfwrite

The .setpdfwrite operator nowadays does nothing more than increase the
VM threshold, which is relatively pointless so we're going to remove it.

In this commit; add a warning message to the .setpdfwrite operator so
that anyone using it will be warned. Remove usage from the various
shell scripts we provide.

Resource/Init/gs_pdfwr.ps
lib/dvipdf
lib/ps2pdfwr
lib/ps2pdfxx.bat


2019-08-12 16:06:21 +0100
Ken Sharp <ken.sharp@artifex.com>
8cc13d54850af14a07e72f73cca20e96ed01fd03

PDF interpreter - ignore visibility of annotations for devices which support them

No bug for this, arose from a Stack Overflow question, but its a FAQ
as well.

It used to be the case that the PDF interpreter would (and should)
render files containing annotations with the Print and NoView flags
differently, depending on whether the destination was to be rendered
or sent to a high level device. This is controlled with the -dPrinted
flag to determine whether annotations should be treated as for a Print
device or a View device.

This doesn't make a lot of sense for pdfwrite though. We really want to
keep the Annotation 'as is' and let the viewer or printer of the output
PDF file deal with it.

In the past we've moved the annotation handling for pdfwrite and,
technically, for any device which directly supports annotations from
'drawannot' to 'preserveannot'. Now that we've done that, it makes some
sense to have the 'preserveannot' code no longer check the annotation's
visibility, but simply preserve it as you would expect. NOTE we do check
the visibility state of annotations that we don't know how to handle.
These will not be preserved as annotations, but will be drawn into the
page contents, so we don't want to render any which should be invisible.
Such annotations are still affected by -dPritned.

Resource/Init/pdf_draw.ps


2019-08-09 15:57:54 +0100
Ken Sharp <ken.sharp@artifex.com>
368bc91bf0bba66f31204e1ee57da7c9b70b32bb

pdfwrite - fix a minor error

I don't think this causes any actual problems, but the correct return
should be 0, not an error, when we can't find a Pattern resource.

devices/vector/gdevpdfi.c


2019-08-09 15:56:45 +0100
Ken Sharp <ken.sharp@artifex.com>
9a871de445eaed295748a3b489e138e87b9e0b65

Transparency compositor - forward unhandled special_ops to target device

Noticed while doing earlier work. The pdf14 device only passed on a few
specific gxdso_ special_op types to the target device, the remainder
were sent to the default handler. This seems wrong and caused problems
for my new gxdso at the time. Instead of it going through the pdf14
device and ending up at pdfwrite (or the default handler for other
devices) it was always going to the default handler and never making
it to pdfwrite when rendering transparency.

The pdf14 device should instead handle any gxdso_ special_ops that vary
depending on rendering. For instance the JPEG passthrough should *not*
be passed to the target device, the pdf14 device needs to have the
uncompressed image data to render it to the compositor buffer.

This commit adds handlers for such gxdso_ special ops, and passes all
the remaining unhandled ones to the target device for processing.

For some reason this causes diffs in halftones, I have no idea why. but
they don't seem like problems.

base/gdevp14.c
base/gxdevsop.h


2019-08-09 17:14:42 +0100
Chris Liddell <chris.liddell@artifex.com>
1ca2c331684ca2912c431771d1aac8bc5cb42e76

Fix line endings (file had some '\r' line endings).

Resource/Init/pdf_draw.ps


2019-08-08 09:07:09 +0100
Ken Sharp <ken.sharp@artifex.com>
e9e253e1dbc87d6ef772936130076e1ba3b81867

pdfwrite - don't permit fallback font substitution with PDF/A

Bug #701373 "PDFA fails to validate by Preflight"

The inptu is a PDF file which is missing two fonts, Helvetica and
Calibri. For both fonts we use /Helvetica as a substitute. For the
missing Helvetica font this is correct, but for the missing Calibri font
this leads to problem when creating PDF/A otuput files.

Firstly, we now have two different fonts, with differing /Widths which
are potentially attempting to reference the same glyphs from a single
font. Secondly, no matter what we do, the /Widths from the Calibri font
are not going to match the actual glyph metrics from Helvetica.

Since there is no possible way to deal with the second problem, because
either the metrics won't match the /Widths, or the text will be misplaced
if we use Widths that are not those from Calibri, there is no point in
trying to tackle the first problem.

So here we introduce a new special_op 'EventInfo' which passes a single
name to the device. The name is the name of the event which occurred. For
now this can only be 'SubstitutedFont'. The only device which handles
this event is pdfwrite, all other devices simply ignore it. The pdfwrite
device checks to see if it is creating a PDF/A otuptu file, and if it is
then it emits a warnign and aborts the production of PDF/A.

Resource/Init/pdf_font.ps
base/gdevdflt.c
base/gdevp14.c
base/gxdevsop.h
devices/vector/gdevpdfi.c
psi/zdevice.c


2019-06-14 16:52:28 -0700
Michael Vrhel <michael.vrhel@artifex.com>
009d44b855dcda9d0d9ecf5ca20944504648eebe

CompatibleOverprint Mode

Ray did the interpreter work on this and Michael did the graphics
library portion.

For the interpreter:
When OP is set, change to CompatibleOverprint mode, but don't push a
transparency group or change opacityalpha when the current blendmode
is Normal or Compatible. This was determined based on the note on page
568 of the PDF 1.7 spec (section 7.6.3 in the area titled "Compatibility
with Opaque Printing"). It states:

Note: It is not necessary to create such an implicit transparency
group if the current blend mode is Normal; simply substituting
the CompatibleOverprint blend mode while painting the object
produces equivalent results. There are some additional cases in
which the implicit transparency group can be optimized out.

After painting, if the group was pushed, pop the group, and restore the
opacityalpha and shapealpha,then restore the blendmode (if it was
CompatibleOverprint).

NB, we don't attempt to optimize any other groups hinted at in
Adobe's comment.

In addition, if we are going to an output device that handles transparency
compositor actions do not do any of the above stuff.

For the graphics library:
When doing blending in non-isolated groups with compatible overprint
the non-drawn colors must be corrected during the fill rectangles to
ensure that the proper amount is maintained with the changing group
alpha values. This is poorly documented in the specification.
In addition, the spec is poorly written in terms of how the blend
computation is performed for overprint compatible.

The spec claims the following:

If the overprint mode is 1 (nonzero overprint mode) and the
current color space and group color space are both DeviceCMYK,
then only process color components with nonzero values replace
the corresponding component values of the backdrop. All other
component values leave the existing backdrop value unchanged.
That is, the value of the blend function B(Cb,Cs) is the source
component cs for any process (DeviceCMYK) color component whose
(subtractive) color value is nonzero; otherwise it is the
backdrop component cb. For spot color components, the value is
always cb.

The equation for compositing is

ar*Cr = (1-as)*Cb + as*[(1-ab)*Cs+ab*B(Cb,Cs)]

Now if I simply set B(cb,cs) to cb for the case when the
DevieCMYK value (with opm true) is zero I get

ar*Cr = (1-as)*Cb + as*[(1-ab)*Cs+ab*Cb]

But what I am seeing with AR is
ar*Cr = (1-as)*Cb + as*[(1-ab)*Cb+ab*Cb] = (1-as)*Cb + as*Cb = Cb
which is what I think we want.

The description in the spec is confusing as it says
"then only process color components with nonzero values replace
the corresponding component values of the backdrop. All other
component values leave the existing backdrop value unchanged"

which makes sense for overprinting,

vs.

"That is, the value of the blend function B(Cb,Cs) is the source
component cs for any process (DeviceCMYK) color component whose
(subtractive) color value is nonzero; otherwise it is the
backdrop component cb."

Which is NOT the same thing as leaving the backdrop unchanged
with the compositing equation
ar*Cr = (1-as)*Cb + as*[(1-ab)*Cs+ab*B(Cb,Cs)]

For this to work, we need to carry out the operation during
the mixing of the source with the blend result. Essentially
replacing that mixing with the color we have here.

Resource/Init/pdf_draw.ps
Resource/Init/pdf_main.ps
Resource/Init/pdf_ops.ps
base/gdevp14.c
base/gdevp14.h
base/gstrans.h
base/gxblend.c
base/gxclpath.c


2019-08-07 10:24:49 -0700
Ray Johnston <ray.johnston@artifex.com>
d8f05309d5e54b6e75c2b78af9c0bcf5f62b493c

Bug 701308: Fix clip transpose logic that resulted in garbled output.

This seems like it should have showed up earlier, but when the clip
rectangle list was transposed, the _t1 and _s1 clip_fill_rectangle_
functions were confused about the coordinates being sent to the target
device fill_rectangle.

Also during debug, I found that if the clip list consisted of more than
a single rectangle, clip_get_clipping_box was only using the first rect,
rather than accumulating the outer_box for the entire list.

base/gxclip.c


2019-08-06 12:44:49 +0100
Ken Sharp <ken.sharp@artifex.com>
ff856d0c44ce7d3f4d204f4a405857a6a6672a80

pdfwrite - handle nested Patterns inside a transparency Group

Bug #701181 "Incorrect output after ghostscript processing of a PDF file"

The PDF file is constructed in a somewhat sub-optimal fashion. Each
background square 'grid' is a Form, each Form draws the content by
filling the area with a solid colour, and then drawing white lines
across it. The white lines (actually rectangles) are drawn using a
Pattern.

So far so good, however the Pattern simply executes a Form, that Form
then fills another rectangle, with another Pattern, its this final
pattern which does the drawing.

This is two levels of indirection more than required.

Normally this isn't a problem because we don't attempt to preserve
Forms from PDF files (and this is one example of why we don't). But....
If the file involves transparency Groups, then we must use a Form
XObject for the Group.

In this case the CTM of the first pattern is the CTM of the 'enclosing
context', ie the Form, but the CTM of the second pattern is also the
CTM of the 'enclosing context', but now that means the first pattern,
not the Group.

To cater for this we track the number of patterns defined since the last
Form definition. If its 0 (ie this is the first pattern since a Form
definition) then we just use the CTM. If its greatre than 0, however,
then we 'undo' the scaling applied by pdfwrite, in order to get back to
the CTM of the enclosing pattern.

Its possible that more extreme examples (patterns inside patterns
inside groups inside patterns inside groups) might still not be entirely
correct, but we have no examples of this (Patterns inside patterns are
relatively rare). If we find any we can revisit this.

devices/vector/gdevpdfb.h
devices/vector/gdevpdfi.c
devices/vector/gdevpdft.c
devices/vector/gdevpdfv.c
devices/vector/gdevpdfx.h


2019-08-05 17:50:04 +0100
Ken Sharp <ken.sharp@artifex.com>
f69b63a3dc3bb7671df956587fe2520f8badab88

PDF interpreter - cope with strangely constructed Pages trees

Bug #700953 "Error: /execstackoverflow in --.systemvar--"

The pre-interpretation scan of the Pages tree looking for loops in the
tree structure uses recursion; if a Pages tree is badly constructed it
is possible to recurse enough times to cause an overflow of the exec
stack.

We can cope with this by aborting the scan and continuing to interpret
and render the PDF file, because the regular processing of PDF file
doesn't use recursion.

Of course, this does mean that we lose the check for loops in the Pages
tree (at least, loops beyond the point where we overflow the exec stack)
but both conditions are rare, so I think its worth doing.

We do still raise a warning.

Resource/Init/pdf_main.ps


2019-08-05 10:05:58 +0100
Ken Sharp <ken.sharp@artifex.com>
fd915a81c605a52f58855bd233c19aaa373b2f69

pdfwrite - improve CIDFont generation

Bug 701010 "Low Printer VM and gswinc32.exe crashing on postscript file with Korean text"

The problem in this case is that the PostScript uses a CIDFont with two
descendant fonts. PDF only permits a single descendant font in a CIDFont
so pdfwrite can't simply copy the font 'as is'.

Instead we create a type 0 font (CIDFont) for each descendant and switch
between them as required.

The problem here is that the code for retrieving an existing Type 0
CIDFont for a given descendant in the PostScript assumed that the name
of the CIDFont would be of the form /FontName-CMapName, and the font
we have here does not match that.

In fact, I'm not at all sure that this is *ever* the case, certainly
none of our test files seem to exercise this (bearing in mind that its
the Type 0 CIDFont generated by pdfwrite that we are checking against
and I can see no code that created a name of that form).

So what was happening was that every time the PostScript CIDFont
switched descendants, we generated a new Yype 0 font, along with all the
attendant structures, such as a ToUnicode CMap (256kB on its own). In
fact the first line of text in the file switches descendants 26 times,
leading to us creating something like 21 MB of extra font information.

We now extend the check so that if the name is not FontName-CMapName we
check the FontName and the CMap Name (which we do also store) separately
and if they match we reuse the existing Type 0 font.

The supplied test file now runs to completion, all 217 pages, with a
peak memory usage of ~22.8MB whereas it previously exhausted memory,
using ~2GB, at page 111. In addition the resulting PDF file is around
95% smaller and the performance is noticeably improved on this file.

devices/vector/gdevpdtt.c


2019-08-02 15:18:26 +0100
Chris Liddell <chris.liddell@artifex.com>
5b85ddd19a8420a1bd2d5529325be35d78e94234

Bug 701394: protect use of .forceput with executeonly

Resource/Init/gs_type1.ps


2019-07-31 13:34:06 +0100
Chris Liddell <chris.liddell@artifex.com>
3ed82a40fd4b49728c79955319b6d67d1e092006

Add a way to record the selected cmap

(for the pdfi branch)

base/fapi_ft.c
base/gxfapi.h
pcl/pl/plfapi.c
psi/zfapi.c
xps/xpsfapi.c


2019-08-01 08:55:31 +0100
Chris Liddell <chris.liddell@artifex.com>
1eb609f130c397144702097f4d987f3b956770f9

Add 'post' table name lookup to TTF in graphics lib

Make Mac Roman glyph ordering available to 'clients'

(in support of the pdfi branch)

base/gstype42.c
base/gxfont42.h


2019-07-31 15:04:37 +0100
Ken Sharp <ken.sharp@artifex.com>
788958decad94b7b3f7a478cfb57724323041bf5

Fix Separation and DeviceN Alternate colour space generation

Bug #701369 "PB with Pantone color in pdfwrite"

When converting to a specified colour space, if we encounter a DeviceN
or Separation space, we leave the spot inks in place but change the
alternate space to the defined colour conversion space, and generate a
new tint transform which approximates the original colours.

However there was a logical error in the code, which only became
apparent if TransferFunctionInfo was set to something other than 'Apply'

Normally this doesn't happen, but commit
2e68cc460dbe349f68b81082ff7344db48eb4820 changed the behvaiour when
we are doing colour conversion to prevent us trying to apply a transfer
function to a SMask, which we can't do.

This then exposed the fact that we were not copying the concretized
samples to the client_colour structure, but we were reading them *back*
from the client_colour structure to set the low and high values in the
generated tint transform function.

The solution is to copy the components from the concretized colour
outside the if clause testing the TransferFunctionInfo.

This fix continues to work properly with the file from bug #700052

devices/vector/gdevpdfg.c


2019-07-24 12:36:35 -0700
Ray Johnston <ray.johnston@artifex.com>
4367024d102c6363ba7536227790564466ec9ddc

Fix debug PDF14_OPCODE_NAMES -- PDF14_BEGIN_TRANS_PAGE_GROUP was missing.

base/gstrans.h


2019-07-23 14:48:32 +0100
Robin Watts <Robin.Watts@artifex.com>
9a8e9c6f7bd45531a1b01eb0d697a6dc48cde2b0

Add arm option to clusterpush.pl

toolbin/localcluster/clusterpush.pl


2019-07-22 12:18:52 -0600
Henry Stiles <henry.stiles@artifex.com>
4de965abeddf859b91937314bc7e86de25acb729

Bug #701339, fixes total pattern length of 0.

Fallback to the default path code if the total pattern length is 0.
This can happen because PCL XL represents pattern length elements as
integers not floats.

devices/vector/gdevpx.c


2019-07-22 19:33:44 +0100
Robin Watts <Robin.Watts@artifex.com>
a628e509caf40ddec3d016dd9ff6379f12be7cc1

Ensure pdf14_put_image linebuf is long enough to avoid overrun.

The assumption is that we can write in 32byte lumps, so we may
overrun the actual amount we need by 28 bytes. Allow for this.

base/gdevp14.c


2019-07-21 16:26:28 +0100
Robin Watts <Robin.Watts@artifex.com>
4d8b6c57ef7272d41fb389a4dc9546f078ba3b2d

Rework CAL cflags.

Cope with building for machines that have SSE4.2, but not AVX2,
that crash on SSE4.2 code compiled with the -mavx2 flag.

Makefile.in
base/cal.mak
configure.ac


2019-07-22 13:07:59 +0100
Ken Sharp <ken.sharp@artifex.com>
909a87a15b5f8fede1f6bfeac2005327a7ca1601

Permit extra widths on space glyphs (PDF Tw value) even for xyshow

For the benefit of the pdfi interpreter. With the PDF in PostScript
current interpreter, we apply Widths using a cshow procedure. The pdfi
interpreter instead uses the x_widths and y_widths arrays, intended for
use with the PostScript xyshow operator instead.

However, the existing code doesn't add the extra width to space glyphs
if we have TEXT_REPLACE_WIDTHS set (ie an xyshow).

Here we move the code for the additional width out of the 'else'
clause in show_move() so that we always have the value available. We
then apply the dx and/or dy values in both cases.

We also need to relax the 'invalid' checking which is performed at a
higher level in the code (gx_device_text_begin) because this combination
is explicitly barred there and returns an error.

base/gstext.h
base/gxchar.c


2019-07-20 11:34:46 -0700
Robin Watts <Robin.Watts@artifex.com>
239d9035a011c212b015951bb2d75114ba11bee0

Add cal operation to clusterpush.pl

toolbin/localcluster/clusterpush.pl


2019-07-20 19:34:00 +0100
Robin Watts <Robin.Watts@artifex.com>
0d4dcb839b679a01f38aac2156c2bb87a819b0d4

Squash warnings in CAL build.

base/gxblend.c
base/gximono.c


2019-07-18 15:47:54 +0100
Robin Watts <Robin.Watts@artifex.com>
e5faf407dcb7c9679537313cebd55a747098f6f8

Bug 701296: Fix Interpolation in Indexed spaces with UseFastColor

The get_color_handler logic was being called with pcs = Indexed, and
so doing pcs = pcs->base_space. Then it was checking that pcs == the
concrete space, seeing that it was, and deciding it could then use
the device colors direct. The problem is that pcs->base_space is a
greyscale space, so when running to (say) an rgb output, we have the
wrong color data.

We now check for the number of components being as we expect, and
for the space being one of our 'default' ones before choosing to
take the 'fast' route.

base/gsicc_manage.c
base/gsicc_manage.h
base/gxiscale.c


2019-07-17 10:25:45 -0700
Michael Vrhel <michael.vrhel@artifex.com>
c0e588f679fca92d92045049fd60846b57da899c

Fix crash when RAW_PATTERN_DUMP is enabled

RAW_PATTERN_DUMP is used to help debug pattern issues.
Crash introduced when changes were made to file i/o.
Easy to overlook since this is rarely enabled.

base/gxpcmap.c


2018-07-26 14:35:48 -0700
Michael Vrhel <michael.vrhel@artifex.com>
c7499c426c0307880e9a34a577492d99a976c15b

Introduce CAL based transparency accelerations.

Authored by Michael Vrhel.

base/cal.mak
base/gdevp14.c
base/gdevp14.h
base/gstrans.c
base/gxblend.c
base/gxblend.h
base/gxblend1.c
base/lib.mak


2018-07-03 11:36:07 -0700
Michael Vrhel <michael.vrhel@artifex.com>
2533344c1bad749e81c3cef91e770ba4ea5a1a1d

Introduce CAL based SSE4.2 and AVX2 optimisations.

Authored by Michael Vrhel.

base/cal.mak
base/gsicc_lcms2mt.c
base/gxicolor.c
base/lib.mak
psi/msvc.mak


2019-07-17 07:14:21 -0700
Robin Watts <Robin.Watts@artifex.com>
2682485aefb808e5dca7191b980aa83880821dcc

Update configure for CAL to spot AVX2 as well.

configure.ac


2019-07-16 12:04:04 +0100
Robin Watts <Robin.Watts@artifex.com>
58d1db5850d470856f8c83af9a573b9c5c18e519

Move cal_context into gs_lib_ctx core.

This avoids us having to repeatedly init/fin the CAL lib.

base/gdevdrop.c
base/gslibctx.c
base/gslibctx.h
base/gxicolor.c
base/gxidata.c
base/gximage.h
base/gximono.c
base/lib.mak
base/siscale_cal.c


2019-07-17 10:19:47 +0100
Robin Watts <Robin.Watts@artifex.com>
47cd6503f34921c840df7c96faa9d957603521e7

Bug 701323: Skip oversize TIFF checks in BigTIFF mode.

If we have -dUseBigTIFF, then we don't need to check that
we don't exceed 4Gig.

This appears to work, but I don't have any code that will
actually load and show me a >4Gig TIFF!

devices/gdevtsep.c


2019-07-15 18:43:04 +0100
Robin Watts <Robin.Watts@artifex.com>
efce71ac4d500231296d1c84f62077666e0966a1

Fix SEGV seen in saved-pages-test run.

The following job:

membin/gs -Ilib -sOutputFile=out.%04d.psd --saved-pages-test
-dMaxBitmap=10000 -sDEVICE=psdrgb -r300 -Z: -sDEFAULTPAPERSIZE=letter
-dNOPAUSE -dBATCH -K2000000 -dClusterJob -dJOBSERVER
/home/regression/cluster/tests_private/comparefiles/Bug691425.pdf

SEGVs due to a buffer overrun.

We are attempting to copy a list of up to GX_DEVICE_MAX_SEPARATIONS
spot colors for the page into a list that's only GX_SOFT_MAX_SPOTS
long.

We just extend the storage here to cope.

base/gxclist.h


2019-07-15 11:50:27 +0100
Robin Watts <Robin.Watts@artifex.com>
105891fadfa649a7b0e3196cc6b0a9865fbf3cac

Fix SEGV seen in -dUseCIEColor testing.

The following test fails with a SEGV in overnight testing:

tests_private/ps/ps3cet/30-07.PS.psdcmyk.300.1

I can reproduce the problem with this call:

membin/gs -Ilib -sOutputFile=out.%d.psd -dUseCIEColor -dMaxBitmap=10000
-sDEVICE=psdcmyk -r300 -Z: -sDEFAULTPAPERSIZE=letter -dNOPAUSE -dBATCH
-K2000000 -dClusterJob -dJOBSERVER -dCETMODE %rom%Resource/Init/gs_cet.ps
tests_private/ps/ps3cet/30-07.PS

(with a hacked version of Memento so that blocks aren't all put into
their own chunk).

The problem is that when a shading is built it contains a set of
params, one of which is a reference to the cie_joint_caches
structure. This structure is held in a chunk of memory allocated
from pgs->memory. This entire chunk of memory goes away when an
l2restore happens. The built shading, however, is referenced by
a PS object that can (and does) outlive this.

When a gc happens, it follows the pointer as part of the enumeration
and crashes due to it having been freed already.

The fix implemented here, is to add a new graphics lib entrypoint
that returns a reference to a copy of the current caches, allocated
in a given memory space; we use that to get a reference to the
caches in the same memory space (and hence with the same lifespan
as) the shading.

base/gscie.c
base/gscie.h
psi/zshade.c


2019-07-12 16:53:58 +0100
Robin Watts <Robin.Watts@artifex.com>
7e9df44328a8a6796a83331a4ab5f9b31091a02c

Fix SEGV with psdcmykog device and files with > 7 spots.

Example invocation:

membin/gs -Ilib -sOutputFile=out.%d.psd -dMaxBitmap=10000
-sDEVICE=psdcmykog -r600 -Z: -sDEFAULTPAPERSIZE=letter
-dNOPAUSE -dBATCH -K2000000 -dClusterJob -dJOBSERVER
./tests_private/comparefiles/Bug693541.pdf

The PDF14 buffers are set up to have dev->color_info.num_components
planes. When these buffers are written into, components 0 to num_spots-1
inclusive are written. If num_spots > num_components, we overwrite
data.

Devices such as psdcmyk expand num_components to accomodate the
number of spots found on the page. Devices such as psdcmykog
do not; they stick with the number of spots they know about to
start with (i.e. 2).

Accordingly, if we run a file through with (say) 11 spots on the
page, with a psdcmykog device, the pdf14 device is setup with
num_comps = 7 (6+alpha), but the number of spots is taken as
the number of spots on the page (11), and thus we have memory
overwrites.

The fix attempted here is to set the number of spots to be
num_comps - number_of_standard_comps.

base/gdevp14.c
base/gdevp14.h


2019-07-03 20:24:24 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
6b0aab1de02cfc44515ff05f70be066bcac7f504

Bug 697545 : Prevent memory leaks in transfer_raster_row.

Prevent several memory leaks in transfer_raster_row by releasing graphic state.

Error created using :-
MEMENTO_FAILAT=15010 ./membin/gpcl6 -sDEVICE=pbmraw -o /dev/null ./tests_private/pcl/pcl5cfts/fts.0670

pcl/pcl/rtraster.c


2019-07-10 14:19:23 +0100
Robin Watts <Robin.Watts@artifex.com>
3bce47c5094c4e200d2200ebd1b081a4dd943215

Fix CAL halftoning crash due to unaligned data buffer.

base/gdevp14.c


2019-07-09 14:00:36 +0100
Robin Watts <Robin.Watts@artifex.com>
0c6f6eb9bd630d594aae0ef7b58aa75253bf52ed

Reference count image colorspaces in XPS.

This avoids leaks.

xps/xpsanalyze.c
xps/xpscolor.c
xps/xpsglyphs.c
xps/xpsgradient.c
xps/xpsimage.c
xps/xpsjpeg.c
xps/xpsjxr.c
xps/xpspath.c
xps/xpspng.c
xps/xpstiff.c
xps/xpstop.c


2019-07-08 19:40:28 +0100
Robin Watts <Robin.Watts@artifex.com>
ab4cea734dca75cde0ad5d39ad2964c9343e8c91

XPS: Avoid leaking scanline buffer on jpeg decompression.

xps/xpsjpeg.c


2019-07-08 11:33:55 +0100
Chris Liddell <chris.liddell@artifex.com>
5c1311ed4dbfb159c9b2304c26b9311834a72bd4

Remove a couple of macros

base/gxchar.c


2019-07-08 19:20:18 +0100
Robin Watts <Robin.Watts@artifex.com>
a116672f813da107719df28057b624ce434e163c

Fix leak of buffer from scaler.

This was being hidden by gc, but shows up in xps.

base/siscale.c


2019-07-08 17:30:01 +0100
Robin Watts <Robin.Watts@artifex.com>
23f28069c8b342cc03de65d8b90029a4b3548010

Really fix CAL makeflags for NEON and SSE.

Makefile.in
base/cal.mak


2019-07-08 17:29:40 +0100
Robin Watts <Robin.Watts@artifex.com>
c0d136b659b6e54017f57877068206bee62e1fa1

Fix typo in PRI definitions.

base/stdint_.h


2019-07-08 16:49:17 +0100
Ken Sharp <ken.sharp@artifex.com>
f0c043ead481dd780c916ddd088baf7abe2a2665

pdfwrite - fix a memory leak

pcs is a local variable and when it goes out of scope if it still holds
a reference to the colour space, it will leak.

devices/vector/gdevpdfb.c


2019-07-08 16:38:09 +0100
Robin Watts <Robin.Watts@artifex.com>
a77d1aef180a2dce12cefc039f7fc3dffd69af98

Fix CAL NEON detection.

configure.ac


2019-07-08 15:46:55 +0100
Robin Watts <Robin.Watts@artifex.com>
c454bf4c1e6eb6d64508234dbdd6f29ceea184c3

Bug 701284: Fix more path leakages, this time in pdf14.

base/gdevp14.c


2019-07-08 14:58:36 +0100
Robin Watts <Robin.Watts@artifex.com>
0ca58b97aa19d25ede275cc6447dc32815205263

Bug 701284: Fix clipping path memory leaks

base/gxclrast.c
base/gxcpath.c


2019-07-06 18:34:47 +0100
Robin Watts <Robin.Watts@artifex.com>
9d410dc41277401d48f4dd94dd50391c4a4c79b0

Fix CAL builds to pass appropriate compiler flags

Makefile.in
configure.ac


2019-07-05 19:36:34 +0100
Robin Watts <Robin.Watts@artifex.com>
c734f19d7780cac16b89ced9924ad18bf1c1b380

Fix memory leak in pdf14_tile_pattern_fill in non-GC languages.

base/gdevp14.c


2019-07-05 19:35:58 +0100
Robin Watts <Robin.Watts@artifex.com>
d181151975f0ee13162cc03865c0cc5f58931823

Fix memory leaks seen in XPS; pattern cache and start_part.

xps/xpstop.c


2019-07-05 19:35:28 +0100
Robin Watts <Robin.Watts@artifex.com>
f19453e0f1ced6eb0273f4eabc4e618553c49925

xps_free_font wasn't freeing font->data causing leaks.

xps/xpsfont.c


2019-07-05 19:34:56 +0100
Robin Watts <Robin.Watts@artifex.com>
e05305f8d8e6222250f18daf9b437b7faee8ebee

Destructors should cope with NULL.

base/gxpcmap.c


2019-07-04 18:52:08 +0100
Robin Watts <Robin.Watts@artifex.com>
dd2bd7b4ca1886a4f3c58afbdacbb93831c57e1b

Bug 701284: Fix leak of pdf14device in xps.

The pdf14device is created and then "retained". This is required
for gs, because postscript can call "currentdevice" and get a
non reference counted pointer to a device. It is cleared up
correctly because of gc.

Other languages have no gc, and so leak. The fix is to enable
those languages to get the pdf14device "unretained". We add an
graphics lib call to allow this to happen.

Transparent Patterns also create pdf14devices, which are again
retained, despite not needing to be. In gs this causes no problems
as they are cleared by the restore, but in other languages they
leak. We make them unretained here, with no ill effects.

base/gstrans.c
base/gstrans.h
base/gxpcmap.c
psi/zpcolor.c
psi/ztrans.c
xps/xpspage.c


2019-07-04 08:47:15 +0100
Chris Liddell <chris.liddell@artifex.com>
47a4fab32690cd2f0aba92f37fc7f03b4069460a

Bug 701288: Handle SEAC ligature glyph metrics correctly.

As originally intended, a Type 1 SEAC charstring would be used for an accented
glyph (like an a-caron, or u-umlaut) where the advance with of the SEAC glyph
is the same as that of the 'base' glyph ('a' or 'u').

It this case, it is not uncommon for the SEAC to skip using an (H)SBW op code
and rely on the one from the base glyph.

But out of spec fonts also use SEAC glyphs ligature glyphs (like 'oe' or 'fi'),
and in those cases the overall advance width is greater than that of the 'base'
glyph.

In this case, we have to allow for the SEAC glyph having included an (H)SBW and
if it has, retain those values, rather than those from the base glyph.

freetype/src/psaux/psintrp.c


2019-07-02 17:15:12 +0100
Robin Watts <Robin.Watts@artifex.com>
491a1637f11c84ad47d83d35eba510ac6d0c47f0

Move to size_t in allocations.

base/gsalloc.c
base/gsalloc.h
base/gsmalloc.c
base/gsmalloc.h
base/gsmchunk.c
base/gsmdebug.h
base/gsmemory.c
base/gsmemory.h
base/gsmemret.c
base/gsnogc.c
base/gsstype.h
base/gxalloc.h
base/gxobj.h
base/mkromfs.c
psi/ilocate.c


2019-07-03 18:16:25 +0100
Robin Watts <Robin.Watts@artifex.com>
25fbeb3e1f4ba5ca7ecafd7a24b7be4079113e7c

Squash warning in compile time assert.

psi/iapi.c


2019-07-03 18:01:01 +0100
Robin Watts <Robin.Watts@artifex.com>
7dfee126567be1859f4ca1637c256b4179a571b8

Fix missing const with fs_file_open_printer.

base/gslibctx.c


2019-07-03 18:00:28 +0100
Robin Watts <Robin.Watts@artifex.com>
378fd9840e957c3a160665483cc537d6f6e860bf

Squash some build warnings with debug prints.

base/gsicc_cache.c
base/gsicc_profilecache.c


2019-07-03 15:39:15 +0100
Robin Watts <Robin.Watts@artifex.com>
e3dd119d53361d09fa30ca13cce4a97869ba0f8d

Add printf format specifier macros for size_t.

Sadly, it is not enough to have definitions that match
the sizes; gcc will give a warning if the types don't match.

base/stdint_.h


2019-07-03 15:23:46 +0100
Robin Watts <Robin.Watts@artifex.com>
761a8b513a28a9c4f4f1e83150556e7407f0d74a

Add size_t definitions to genarch.

arch/windows-arm-msvc.h
arch/windows-x64-msvc.h
arch/windows-x86-msvc.h
base/genarch.c


2019-06-27 16:48:06 +0100
Robin Watts <Robin.Watts@artifex.com>
d306e93d487a6539804c6343986bcbca2ecc37a8

Rework ROP transparency

Rework ROP behaviour with transparency based upon the results
from roptest.pxl seen on an HP printer.

The old style ROP transparency code used to treat white pixels
as special. The new style code does everything in boolean logic
by modifying the ROP that is used when S or T pixels are set to
be transparent.

This enables us to rip out several cases from the ROP
processing loops, as we never need to check for transparent
pixel values anymore.

base/gdevdrop.c
base/gdevmpla.c
base/gdevmr1.c
base/gdevmr2n.c
base/gdevmr8n.c
base/gdevmrop.h
base/gdevplnx.c
base/gsroprun.c
base/gsroprun24.h
base/gsroprun8.h
base/gsropt.h
base/gxdcolor.c
base/gxipixel.c
devices/vector/gdevpdfi.c
devices/vector/gdevpx.c


2019-06-26 18:51:31 +0100
Robin Watts <Robin.Watts@artifex.com>
054f4df9b5f8bb09c252841f0c3256b9adc60f0a

Add another couple of SSE ROP cases.

base/gsroprun.c
base/gsroprun8.h
base/gsropt.h


2018-01-11 17:57:29 +0000
Robin Watts <robin.watts@artifex.com>
82e2843149b32e61cfde7861ac67a51014538f4f

ROP optimisation: Fold 24bpp ROPs down to 8 bit where possible.

This increases line length.

base/gsroprun.c
base/gsroprun8.h
base/gsropt.h


2019-07-02 17:29:54 +0100
Robin Watts <Robin.Watts@artifex.com>
470897e484fb0bfaa8553e0ccd5b9db91eda008b

Avoid warning due to casting int to double.

Use size_t properly, and no call to abs is required.

devices/vector/gdevpdfe.c


2019-07-02 17:14:33 +0100
Robin Watts <Robin.Watts@artifex.com>
6c986cd9f93008992344d2cd5be224af13e1c980

Squish an annoying implicit cast warning.

Do it explicitly.

base/gsicc_cache.c


2019-07-02 17:13:48 +0100
Robin Watts <Robin.Watts@artifex.com>
45e765e59a45b46dcb05e8c729689a7c0574a48c

Fix some warnings caused by the gs FS api commit.

base/gp.h
base/gp_dvx.c
base/gp_msprn.c
base/gp_mswin.c
base/gp_os2.c
base/gp_os2.h
base/gp_os9.c
base/gp_unix.c
base/gp_winfs2.c
base/gslibctx.h


2019-07-01 21:31:03 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
f209fb3a0f50cd0a9974d8627a4ac7f358f60c8a

Bug 697545 : Prevent SEGV in check_pattern_rendering.

Prevent SEGV by checking for check_pattern_rendering being called with NULL pattern.

Error created using :-
MEMENTO_FAILAT=16764 ./membin/gpcl6 -sDEVICE=pbmraw -o /dev/null ./tests_private/pcl/pcl5cfts/fts.0825

pcl/pcl/pcpatrn.c


2019-07-01 21:08:30 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
e6c50c878d622974e7bb2438327e5363b9419875

Bug 697545 : Prevent SEGV due to double freeing.

On error pl_dict_put now consumes the new value so these extra calls
to free memory are no longer needed.

Error created using :-
MEMENTO_FAILAT=1987 ./membin/gpcl6 -sDEVICE=pbmraw -o /dev/null ./tests_private/pcl/pcl5cfts/fts.0825

pcl/pcl/pcsymbol.c
pcl/pl/pllfont.c


2019-07-02 15:36:07 +0100
Chris Liddell <chris.liddell@artifex.com>
5ef3a531d00715c2b8bcfd38401515d4f60bfec5

Rejig order of operations from commit 47b1b7f971a76

I'd forgotten that setcolorspace would blow away the current color, so we need
to get two sets of current color values, before setting the fill and stroke
color spaces, and then setting the file and stroke colors.

Resource/Init/pdf_ops.ps


2019-06-24 13:23:34 +0100
Robin Watts <Robin.Watts@artifex.com>
93fc44b3426cd771ee0a9358da805cd2ac93a649

Fix gsapi exposure through the DLL.

Lots of functions that should have been exposed, weren't.

psi/dpmain.c
psi/dwdll.c
psi/dwdll.h
psi/gsdll32.def
psi/gsdll32metro.def
psi/gsdll64.def
psi/gsdll64metro.def
psi/gsdllARM32metro.def


2019-06-19 18:43:33 +0100
Robin Watts <Robin.Watts@artifex.com>
e6966d10ec319a25ad91e4aa53a783edede7b62b

Add gsapi call to introduce new 'Filing Systems' to gs.

Still to do - Example?

base/gdevpipe.c
base/gp.h
base/gp_mshdl.c
base/gp_msprn.c
base/gp_os2pr.c
base/gpmisc.c
base/gsdevice.c
base/gslibctx.c
base/gslibctx.h
base/stdpre.h
doc/API.htm
pcl/pl/plapi.c
pcl/pl/plapi.h
psi/iapi.c
psi/iapi.h


2019-07-02 11:12:04 +0100
Chris Liddell <chris.liddell@artifex.com>
e585a31732e966f1508b64f04cacbaf8ede65c68

Fix an out-of-date comment about devices in gstates

base/gsstate.c


2019-07-02 11:06:03 +0100
Chris Liddell <chris.liddell@artifex.com>
47b1b7f971a760ff311bf3c3d8a02e2a2d53ac7d

PDF interp: use initgraphics for initial color(space)

Previously, the PDF interpreter explicitly set the initial color and color space
for each page ('0 g 0 G') despite initgraphics being called, and also setting
the color(space)s correctly.

Unfortunately, removing that completely causes problems with pdfwrite's
transparency handling, so we reuse the already installed values in place
of explicitly setting absolute values.

This should allow for preview-latex's (slightly hacky) method of custom coloring
'special' PDFs for previewing.

Resource/Init/pdf_ops.ps


2019-06-25 10:43:30 +0100
Chris Liddell <chris.liddell@artifex.com>
94cc50cf64e0899c5d415e6ac1e6ea725fc13502

Fix DELAYBIND

We now undefine a *lot* of non-standard/internal operators (and other things) as
we go, and often we rely on bind to ensure that the names are replaced with the
operator objects rather than names.

This falls over when DELAYBIND is in force, and the call to .bindnow happens
*after* the undefining occurs.

To solve this, all the undefining happens through a procedure: .addtoundeflist.

Under normal operation, that simply undefines as we go, and things work the same
as always.

Under DELAYBIND .addtoundeflist accumulates a list of names to undefine, and the
dictionaries from where they should be removed, and on the .bindnow call, then
.applyundeflist is called which rattles through the lists removing the names
from the dictionaries.

Resource/Init/gs_btokn.ps
Resource/Init/gs_cet.ps
Resource/Init/gs_cidfn.ps
Resource/Init/gs_dps2.ps
Resource/Init/gs_epsf.ps
Resource/Init/gs_fapi.ps
Resource/Init/gs_fonts.ps
Resource/Init/gs_img.ps
Resource/Init/gs_init.ps
Resource/Init/gs_lev2.ps
Resource/Init/gs_ll3.ps
Resource/Init/gs_res.ps
Resource/Init/gs_resmp.ps
Resource/Init/gs_setpd.ps
Resource/Init/gs_ttf.ps
Resource/Init/pdf_main.ps


2019-07-02 10:36:18 +0100
Chris Liddell <chris.liddell@artifex.com>
871b8d8d5a26205a7a3c05ea9abf060a272fd6fb

Tweak path access control logic

Correctly handle the difference between permitted paths of the forms:
'path', 'path/' and 'path/*'.

The previous code effectively treated 'path/' and 'path/*' the same.

base/gpmisc.c


2019-06-20 12:24:04 +0100
Chris Liddell <chris.liddell@artifex.com>
1b83ee86dc775a9d7972d94041e226893983b264

File access control: handle non-null terminated paths

Add an access control checking API call that can take a non-null terminated
string (i.e. takes a string and length).

The reason being the strings returned from gp_enumerate_files* are not null
terminated, and we need to filter them by permissions.

base/gp.h
base/gpmisc.c


2019-07-01 15:27:05 +0100
Ken Sharp <ken.sharp@artifex.com>
56158b2c2d8fb9bd5e5bbb9be645fb88231c4898

Fix buffer overrun in mswinpr2 device

Bug #701281 "ACTIONABLE_HEAP_CORRUPTION when try print with -sOutputFile"

The mswinprs2 device uses the very old 16-bit GetProfileStringW() API
call to get the 'Devices' in order to look for a specified printer.

The code however assumes that the buffer length passed is in bytes, and
in fact it should be in wchar_. This means that a sufficiently large
Devices section could overrun the buffer, as it thinks there are more
wchar_t available than there are.

in addition, if the section is very large we could run out of space in
the string altogether, and then would be unable to find the designated
printer.

This commit alters the code so that the length passed to GetProfileStringW
is in wchar_t and also examines the returned length. If the returned
length indicates possible truncation of the return, then we free the
buffer, increase its size by 4Kb and try again. Repeatedly until we
either exhaust memory or get a large enough buffer.

devices/gdevwpr2.c


2019-06-18 21:21:10 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
90ae60d1669ebf01228d05cdb58c248a2f971d07

Bug 697545 : Prevent memory leaks in pcl_define_symbol_set.

Cleanup symbol set for all error returns.

Error created using :-
MEMENTO_FAILAT=15206 ./membin/gpcl6 -sDEVICE=pbmraw -o /dev/null ./tests_private/pcl/pcl5cfts/fts.0460

pcl/pcl/pcsymbol.c
pcl/pl/pldict.c


2019-06-25 15:28:48 +0100
Ken Sharp <ken.sharp@artifex.com>
12ffa0f40b6849d97c1e4dc49287bca56f513f7f

pdfwrite - fix an error path

This turned up while working on the PDF interpreter in C. Previously we
had no examples which exercised this error pathway, because it was only
used by PCL and none of our PCL examples threw an error here.

If we've started accumulating a CharProc, then we have started a pdf
substream. If we get an error, then we need to terminate that substream
before returning (the caller can't know that the substream was begun).

devices/vector/gdevpdtt.c


2019-06-11 19:04:21 +0100
Robin Watts <Robin.Watts@artifex.com>
4f59b4dc4f512839fd73718de535da99c6085da3

First steps for using SSE for ROPs.

base/gsroprun.c
base/gsroprun8.h
base/gsropt.h


2018-04-19 12:45:14 +0100
Robin Watts <robin.watts@artifex.com>
140a9359f3cc6739c7caf0796430bc3112cb3cd5

Initial import of CAL.

Makefile.in
base/cal.mak
base/gdevdrop.c
base/gs.mak
base/gxicolor.c
base/gxidata.c
base/gximage.h
base/gximono.c
base/gxiscale.c
base/lib.mak
base/siscale_cal.c
base/sisparam.h
base/unix-gcc.mak
base/winlib.mak
configure.ac
psi/msvc.mak
windows/ghostscript.vcproj


2019-06-24 16:35:31 +0100
Ken Sharp <ken.sharp@artifex.com>
dd75f619d0ae98e21e30ad89d2e7d2cd4277cc2e

Preparatory work for the PDF interpreter in C

Currently the pdfwrite device assumes that a font with FontType 3
(ft_user_defined) *will* require an exit to the interpreter. The
CharProc capture is set up so that this happens in a complicated dance.

When we have the PDF interpreted in C we do not need to exit to the
interpreter, and so we need to capture the CharProc in the same way we
do for PCL 'user defined' fonts (eg the HPGL stick font and PCL bitmap
fonts).

Obviously to be able to do this we need to be able to differentiate
between a PostScript type 3 font (or a type 3 font built by the PostScript
PDF interpreter) and a type 3 font built by the C PDF interpreter. So
the first thing we do is add a new ft_PDF_user_defined font tyep.

Then update the graphics library so that it treats the PDF type 3 font
in exactly the same way as it does a PostScript type 3 font.

In the pdfwrite device, in general we want to treat a PDF type 3 font
as being the same as a PS type 3.

Finally, in pdf_text_process() the bulk of the real work. If we have a
ft_PDF_user_defined font, then set 'early_accumulator' which means we
push the accumulator early, because we won't need to exit to the
interpreter. This means that in the 'early_accumulator' branch we need
to account for the possibility that the text operation won't be a
'TEXT_FROM_CHARS' (it always is for PCL, which is why this didn't need
to be handled before). There was also some bad error handling in here,
we do a gs_gsave() which is undone by a gs_grestore() in comp[ete_charproc()
but if we had an error before that we would not undo the gs_gsave whhich
could lead to ridiculous levels of nested gsaves.

base/gstext.c
base/gxchar.c
base/gxftype.h
base/gxpaint.c
devices/vector/gdevpdtc.c
devices/vector/gdevpdtd.c
devices/vector/gdevpdte.c
devices/vector/gdevpdtf.c
devices/vector/gdevpdti.c
devices/vector/gdevpdts.c
devices/vector/gdevpdtt.c


2019-06-22 10:49:31 +0100
Ken Sharp <ken.sharp@artifex.com>
9055511a9ca3600ee8680ea2b35b2f31f708bd40

Improve -dFILTERIMAGE

Previously if we were supplied too much image data, we could read off
the end of the supplied data and consume input that should have been
interpreted.

This limits the consumption of data so that we don't read more than we
expected.

NB! We still don't support type 3 images, as that requires us to process
2 images at once.

base/gdevoflt.c


2019-06-19 19:11:43 +0100
Robin Watts <Robin.Watts@artifex.com>
4f3f5aeb40be1562f05864705b0a04fbccae6fec

Remove unused gsapi functions.

gsapi_get_device_memory and gsapi_set_device aren't used, so
do away with them.

psi/dwdll.h
psi/dwnodll.c
psi/gsdll2.def
psi/gsdll32.def
psi/gsdll32metro.def
psi/gsdll64.def
psi/gsdll64metro.def
psi/gsdllARM32metro.def
psi/iapi.c
psi/iapi.h


2019-06-19 18:43:09 +0100
Robin Watts <Robin.Watts@artifex.com>
c1500bb8ed62224e8b372fca76ed8e411cc447d1

More gp_file vs FILE fixes.

base/gp_vms.c
contrib/pcl3/src/pcl3opts.c
contrib/pscolor/test.c


2019-06-20 19:22:24 +0100
Ken Sharp <ken.sharp@artifex.com>
ae73b49631e657b5ed5c3bf7936febf64a3f8b3c

Fix Indexed 'install' procedure

The Install procedure for Indexed spaces was calling the 'install'
procedure for its base space. This is incorrect. Colour spaces are
supposed to be set from the lowest (most 'base') to the highest. So the
Indexed space's base space should already be set, and installed. Trying
to set it again is a bad thing and can cause Seg Faults.

However, the PCL interpreter relies on the Indexed space doing this,
contrary to the expected behaviour it does not set the base space before
setting the Indexed space, and relies on the Indexed space to 'install'
the base space.

Setting the base space caused unexpected (and inexplicable) differences
in halftoned output. I 'suspect' that this is because it sets the three
initial components of pgs->color[0].ccolor, whereas the previous code
only resulted in setting the initial value.

So instead, call the base space's 'install' procedure directly, this
doesn't set the colour values (which gs_setcolorspace does) and results
in no differences.

For me this resolves the crashes that were being seen in the 32-bit
builds of Ghostscript and shows no differences.

base/gscolor2.c
pcl/pcl/pcindxed.c


2019-06-19 15:14:46 +0100
Robin Watts <Robin.Watts@artifex.com>
108dd018b746d33ad06a7ee863fae56cbeb1fd80

"Fix" contrib and test uses of gp_fopen.

Here we fix a lot of contrib devices that had been broken by the
changes to gp_file. I believe they all should work OK now.

One of the routines was calling lib_fopen in an unsupported way; this
can't easily be fixed, so we just call gp_fopen instead now.

We also "fix" some test code that was calling gp_fopen and then doing
things that we can't easily do with a gp_file *. This code has reverted
to using FILE *'s and fopen - this might cause issues on compilation as
this code is untested, but it's better than compiling to give code that
crashes.

base/gp_vms.c
contrib/japanese/dviprlib.c
contrib/japanese/dviprlib.h
contrib/japanese/gdevdmpr.c
contrib/pscolor/test.c
devices/vector/gdevtxtw.c
psi/gserver.c


2019-06-19 12:51:38 +0100
Robin Watts <Robin.Watts@artifex.com>
2c6484de7376ce4e24d87f1eb4c6f76360c9b928

Fix debug code to call gp_fopen correctly.

These were missed during the conversion to gp_file.

base/gdevp14.c
base/gsicc_create.c
base/gsicc_lcms2.c
base/gsicc_lcms2mt.c
base/gsicc_manage.c
base/gsicc_manage.h
base/gsroprun.c
base/gxblend.c
base/gxblend.h
base/gxblend1.c
base/gxpcmap.c


2019-06-19 09:42:10 +0100
Chris Liddell <chris.liddell@artifex.com>
b38aad870c573f7cafe99a95c3b931c1dc6cd132

Remove some debug code

Resource/Init/gs_init.ps


2019-06-18 10:54:47 +0100
Chris Liddell <chris.liddell@artifex.com>
d4d7d6948e41c2573b47645191dbb7e3877f0597

Fix up some coverity issues, and other warnings

CIDs: 341120, 341119, 341118, 341117, 341116, 341115, 341114, 341113, 341112,
341111, 341110, 341109, 341108, 341107, 341106, 341105, 341104, 341103, 341102,
341101.

Mostly examples of gp_fseek and sscanf ignoring return values.

base/gp_unifs.c
base/mkromfs.c
contrib/pcl3/eprn/pagecount.c
contrib/pcl3/src/gdevpcl3.c
contrib/pcl3/src/pclgen.c
contrib/pcl3/src/pclgen.h
devices/gdevdfax.c
devices/gdevpsd.c
devices/vector/gdevpdf.c
devices/vector/gdevxps.c
pcl/pl/pjparse.c
pcl/pl/plmain.c
psi/imainarg.c
psi/iutil.c
xps/xpszip.c


2019-06-14 09:10:45 +0100
Chris Liddell <chris.liddell@artifex.com>
29da5d218dac7e0975c03a81982fdc33b5eba20d

Make sure font Decoding is in the correct VM mode

Resource/Init/gs_fntem.ps


2019-06-14 09:10:04 +0100
Chris Liddell <chris.liddell@artifex.com>
35b8b94e3ac3cced1b415c92b091c6959240755e

Remove stray exec and some pointless immediate evaluations

Resource/Init/gs_fapi.ps


2019-06-14 09:16:53 +0100
Ken Sharp <ken.sharp@artifex.com>
adc94490502a360c3bdf8843888f784d57066c0e

PDF interpreter - improve repair of broken PDF files

If a file had a startxref token which was not followed by any further
actual tokens (eg nothing but % comment lines) then the repair code
failed to account for this, and ended up trying to pop non-existent
objects from the stack.

This is because the code did not test the result of the 'token' operator
to ensure that a token had been read, it assumed one would be. In this
commit we check the result and, if its 'false' (no token read) we don't
attempt to pop the non-existent token from the stack, but instead follow
the existing error path and resort to scanning the PDF file for the
trailer dictionary.

In addition to fixing the customer reported file, this also fixes the
existing test suite file

tests_private/pdf/sumatra/repairing_leaks_object.pdf

Resource/Init/pdf_rbld.ps


2019-06-12 15:35:11 +0100
Chris Liddell <chris.liddell@artifex.com>
8522db03fde6b1b514beed9d66faa839f24ebdc4

Make .pdfexectoken not an operator

In a previously round of security fixes, I made .pdfexectoken an operator. That
turns out to cause problems because we (normally) attempt to recover from errors
in PDF files, so we don't want .pdfexectoken to cleanup the stacks in the event
of an error.

In addition, the original problem this solved is solved in a more robust way
(executeonly on the transient procedures).

Resource/Init/pdf_base.ps


2019-06-11 20:29:53 +0200
Sebastian Rasmussen <sebras@gmail.com>
094b9caade51b718a20b8d326fff9e0f93166cd4

Bug 698777: jbig2dec: Update information in README.

jbig2dec/README


2019-06-10 17:22:04 +0100
Robin Watts <Robin.Watts@artifex.com>
20a6ddad3cd42796c913ab94583fc0f0e5870281

Fix gpdl SAFER operation.

-sOutputFile=foo was having the pass set as "=foo" due to
me forgetting to increment the pointer. This resulted in
many thousands of errors in the weekly SAFER test.

pcl/pl/plmain.c


2019-06-10 16:24:41 +0100
Ken Sharp <ken.sharp@artifex.com>
ee8ab38bab473ff1457e7f966b2733f0c829bcb1

PDF interpreter - don't execute newpath when ending text blocks

Bug 701178 - "PDF missing two bounding boxes on process"

The missing rectangles are defind in the content stream between a
number of BT/ET text blocks, and only finally stroked after all the
text has been emitted.

Because we execute a newpath when ending a text block (to avoid dangling
path elements from text), and prior path elements are lost.

This commit only executes a newpath when the text rendering mode is one
of the 'clip' modes, as that is handled differently, and we need the
newpath.

Its a pretty poor way to output the paths, and I suspect that it would
likely run into trouble with the text clipping modes, but since those
aren't used here its hard to tell.

Resource/Init/pdf_ops.ps


2019-06-07 13:58:25 +0100
Ken Sharp <ken.sharp@artifex.com>
8eaa0856399c9b621db17e96c8f7be1e0241ab8b

Fix AES-256 decryption when using owner key

The code for computing the decryption key for AES-256 encrypted PDF
files was incorrect. When computing the validation check we correctly
used the owner key if it was supplied, but for computing the actual
decryption key we always treated the supplied password as the user
password.

psi/zpdf_r6.c


2019-06-05 09:55:46 +0100
Ken Sharp <ken.sharp@artifex.com>
b31fb3c0cd7ab223d870fa1e0fb231d911b19984

Modify the new gp_file API so that gp_fread etc match fread

The new gp_fread() and gp_fwrite() have a parameter list which (more or
less) matches the list for the C run-time functions fread() and fwrite()

However, the return values do not match the returned values from the
C runtime functions. This is because, internally, the gp_file structure
has function pointers which only take 3 parameters instead of 4. This
is handled by multiplying the size of the record by the number of records
to be read/written, and then reading that many bytes.

Since the underlying functions are (at this time) the C runtime functions
this means that th returned value becomes the number of bytes read
(or written) instead of the number of *records* read/written.

This commit modifies that internal API so that the gp_file member
functions take 4 parameters (thus matching both gp_fread and fread)
and pass them to the underlying functions. The return value is then
the number of records, as expected.

Should we ever encounter an implementation which doesn't match the
C runtime fread() we could implement it by multiplying the size by the
count (as was done prior to this commit) and then, assuming the return
value was the number of bytes read, dividing the return value by the
size, in order to retrieve the number of records read.

base/gp.h
base/gpmisc.c


2019-06-07 12:11:57 +0100
Michael Vrhel <michael.vrhel@artifex.com>
ee8864ae09ff0017e5503bde1f5b52538759babc

Ensure that separation CMYK source colors managed

This is the separation version of the DeviceN commit

http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=0b9c45fa86f7736e7fec170a135efa83636283ba

base/gdevp14.c
base/gscsepr.c
base/gsequivc.c
base/gxcmap.c
base/gxcmap.h


2019-06-01 11:09:05 +0100
Ken Sharp <ken.sharp@artifex.com>
d5e123d42718370c144a62ba10a7b715cc88b81a

Graphics library - match gsaves with grestores

Auditing as part of the pdfi work, when the graphics library executes
a gs_gsave() it should match it with a gs_grestore(), even in the case
of an error.

In addition, if gs_setcolorspace failed in image_PaintProc() it would
leak the pattern enumerator. Because this is only called from PCL
the memory is not garbage collected.

base/gsptype1.c
base/gxchar.c


2019-06-03 18:28:18 +0100
Robin Watts <Robin.Watts@artifex.com>
c9a832653a91ddcdd1220fe9fbbc58839eade4aa

Fix leak in gs_lib_ctx_fin.

When freeing gs_lib_ctx, don't remove the mem->gs_lib_ctx pointers
until after we have finished using them. This avoids a leak.

base/gslibctx.c


2019-06-03 14:19:54 +0100
Robin Watts <Robin.Watts@artifex.com>
7b052ff372bbd325676d2e1a57dfd71c33c9f677

Update gpdl with new file access permissions.

This basically involves duplicating the changes from Chris'
gs commit. Part of this promotes a couple of static functions
to being global ones so both implementations can call them.

base/gslibctx.c
base/gslibctx.h
pcl/pl/plmain.c
psi/imainarg.c


2019-05-29 15:56:20 -0700
Ray Johnston <ray.johnston@artifex.com>
650c49424529fca922519ee9cdf2086eee5cfb70

Fix broken DEBUG build. Add standalone gs_log_error to mkromfs.c

This function is invoked for DEBUG builds by gs_note_error. We define
an equivalent local version so we don't have to include gsmisc.obj
(as for other utility functions such as outprintf).

base/mkromfs.c


2019-05-29 13:20:39 +0100
Chris Liddell <chris.liddell@artifex.com>
f5c0159d993418a8900a84e5fd946e83bdaeec73

Fix dfaxhigh/low device with new gp_file API.

Arose in the "all devices" cluster test

devices/gdevdfax.c


2019-05-07 11:30:15 +0100
Chris Liddell <chris.liddell@artifex.com>
7ecbfda92b4c8dbf6f6c2bf8fc82020a29219eff

Add use of new file access permissions to PS interp

(this is a squash of several commits from filesec branch)

Use errno to indicate invalidfileaccess

Integrate fontconfig with file access controls

fontconfig API has a call to retrieve all the directories about which fontconfig
knows, so we can get those, and add them to the paths from which we're permitted
to read.

Add (most of) the Postscript "managed" paths....

...to the access controls.

GenericResourceDir, ICCProfilesDir (reading) and temporary file directories for
read/write/control.

Add paths/files from C to the file access controls

The -I paths, environment variables and build time paths.

The command line specified output file, permit writing.

Lastly, the command line specified input file is added to the readable list,
interpreted, and then removed from the list.

Add the FONTPATH path list to permit read access control list.

I opted to do this in Postscript because the list is (normally) a colon
separated list of paths, which we split into an array of paths (in Postscript) -
it seems sensible to do this only once, both for storage and permissions.

Add a non-standard string 'reverse search" operator

The search operator searches for the first occurrence of a character code in a
string (i.e. searches forwards from the start of the string), 'rsearch' finds
the last instance of a character code (i.e. search backwards from the end of
the string).

Fix gp_open_scratch_file_rm for access permissions

i.e. the same as gp_open_scratch_file

Handle clist file 'rewind' failures

'Rewinding' clist files may involved closing and recreating the temporary files,
which conceivably can fail, but the clist procs rewind method was a void
function, so couldn't return an error.

It now can, and does return an error, and we handle the error.

Add file permissions support for piped output.

Paths from Fontmap to PermitReading list

cidfmap paths, add to PermitReading list

Add command line options for path access control addition

--permit-file-read
--permit-file-write
--permit-file-control
--permit-file-all

They all take a separated list of paths (the usual platform specific ':' or ';'
separator), and to the respective access control lists - the final 'all' option
adds the paths to all the control lists.

Add file access control to the 'gp_stat' method.

This is complicated by the need to add the memory allocator context to the
gp_stat parameters. To facilitate this, I've added a gs_memory_t pointer to the
gx_io_device structure, which is set during the io device initialisation at
startup.

mkromfs: Add dummy gp_stat_impl for Windows - saves quite a bit of pointless
build upheaval

Add file access protection to file enumeration.

The low level implementation of Postscript's filenameforall (*_enumerate_files)
needs to also honour file access protection.

This is has been complicated by requiring a gs_memory_t to be available where
it wasn't previously (in order to access the gs_lib_ctx and the file permissions
lists therein).

Temp

Resource/Init/gs_cidfm.ps
Resource/Init/gs_fonts.ps
Resource/Init/gs_init.ps
base/gdevpipe.c
base/gp.h
base/gp_dosfe.c
base/gp_mshdl.c
base/gp_msprn.c
base/gp_mswin.c
base/gp_ntfs.c
base/gp_os2fs.c
base/gp_os2pr.c
base/gp_unifs.c
base/gp_unix.c
base/gp_vms.c
base/gpmisc.c
base/gsiodev.c
base/gsiodevs.c
base/gsiodisk.c
base/gsioram.c
base/gsiorom.c
base/gxclfile.c
base/gxclio.h
base/gxclist.c
base/gxclmem.c
base/gxclread.c
base/gxiodev.h
base/gxp1fill.c
base/lib.mak
base/mkromfs.c
base/stat_.h
pcl/pl/pjparse.c
pcl/pl/pllfont.c
psi/imain.c
psi/imainarg.c
psi/zdevcal.c
psi/zfile.c
psi/ziodev.c
psi/ziodev2.c
psi/ziodevsc.c
psi/zstring.c


2019-03-07 18:03:00 +0000
Robin Watts <Robin.Watts@artifex.com>
9de16a6637b73e35f79d2d622de403b24e6502f2

Move FILE * operations behind new gp_file * API.

(squash of commits from filesec branch)

Most of this commit is donkeywork conversions of calls from
FILE * -> gp_file *, fwrite -> gp_fwrite etc. Pretty much every
device is touched, along with the clist and parsing code.

The more interesting changes are within gp.h (where the actual
new API is defined), gpmisc.c (where the basic implementations
live), and the platform specific levels (gp_mswin.c, gp_unifs.c
etc where the platform specific implementations have been
tweaked/renamed).

File opening path validation

All file opening routines now call a central routine for
path validation.

This then consults new entries in gs_lib_ctx to see if validation
is enabled or not. If so, it validates the paths by seeing if
they match.

Simple C level functions for adding/removing/clearing paths, exposed
through the gsapi level.

Add 2 postscript operators for path control.

<name> <string> .addcontrolpath -

Add the given <string> (path) to the list of paths for
controlset <name>, where <name> can be:
/PermitFileReading
/PermitFileWriting
/PermitFileControl
(Anything else -> rangecheck)

- .activatepathcontrol -

Enable path control. At this point PS cannot make any
more changes, and all file access is checked.

base/gdebug.h
base/gdevdevn.c
base/gdevp14.c
base/gdevpccm.c
base/gdevpccm.h
base/gdevpipe.c
base/gdevprn.c
base/gdevprn.h
base/gdevvec.c
base/gdevvec.h
base/gp.h
base/gp_dosfs.c
base/gp_dvx.c
base/gp_mshdl.c
base/gp_msprn.c
base/gp_mswin.c
base/gp_ntfs.c
base/gp_os2.c
base/gp_os2fs.c
base/gp_os2pr.c
base/gp_os9.c
base/gp_unifs.c
base/gp_unix.c
base/gp_vms.c
base/gp_win32.c
base/gp_winfs.c
base/gp_winfs2.c
base/gpmisc.c
base/gpmisc.h
base/gsargs.c
base/gsargs.h
base/gsdevice.c
base/gsicc_create.c
base/gsicc_lcms2.c
base/gsicc_lcms2mt.c
base/gsicc_manage.c
base/gsinit.c
base/gsiodev.c
base/gsiodevs.c
base/gsiodisk.c
base/gsioram.c
base/gsiorom.c
base/gslib.h
base/gslibctx.c
base/gslibctx.h
base/gsmemory.h
base/gsmisc.c
base/gsroprun.c
base/gstiffio.c
base/gstiffio.h
base/gxblend.c
base/gxblend1.c
base/gxclfile.c
base/gxdevice.h
base/gxiodev.h
base/gxpcmap.c
base/lib.mak
base/msvctail.mak
base/sfxcommon.c
base/sfxfd.c
base/sfxstdio.c
base/stdpre.h
base/stream.h
base/tiff.mak
base/winlib.mak
contrib/contrib.mak
contrib/eplaser/gdevescv.c
contrib/gdevbjc_.c
contrib/gdevbjc_.h
contrib/gdevbjca.c
contrib/gdevcd8.c
contrib/gdevdj9.c
contrib/gdevgdi.c
contrib/gdevhl12.c
contrib/gdevln03.c
contrib/gdevlx32.c
contrib/gdevlx7.c
contrib/gdevmd2k.c
contrib/gdevop4w.c
contrib/gdevxes.c
contrib/japanese/dviprlib.c
contrib/japanese/gdev10v.c
contrib/japanese/gdevalps.c
contrib/japanese/gdevdmpr.c
contrib/japanese/gdevespg.c
contrib/japanese/gdevfmlbp.c
contrib/japanese/gdevfmpr.c
contrib/japanese/gdevj100.c
contrib/japanese/gdevlbp3.c
contrib/japanese/gdevmjc.c
contrib/japanese/gdevml6.c
contrib/japanese/gdevnpdl.c
contrib/japanese/gdevp201.c
contrib/japanese/gdevrpdl.c
contrib/lips4/gdevl4r.c
contrib/lips4/gdevl4v.c
contrib/lips4/gdevlprn.c
contrib/lips4/gdevlprn.h
contrib/opvp/gdevopvp.c
contrib/pcl3/eprn/eprnparm.c
contrib/pcl3/eprn/gdeveprn.c
contrib/pcl3/eprn/pagecount.c
contrib/pcl3/eprn/pagecount.h
contrib/pcl3/src/gdevpcl3.c
contrib/pcl3/src/pcl3opts.c
contrib/pcl3/src/pclgen.c
contrib/pcl3/src/pclgen.h
contrib/pcl3/src/pclscan.c
cups/gdevcups.c
devices/contrib.mak
devices/devs.mak
devices/gdev3852.c
devices/gdev4081.c
devices/gdev4693.c
devices/gdev8510.c
devices/gdevatx.c
devices/gdevbit.c
devices/gdevbj10.c
devices/gdevbmp.c
devices/gdevbmp.h
devices/gdevbmpc.c
devices/gdevccr.c
devices/gdevcdj.c
devices/gdevcfax.c
devices/gdevchameleon.c
devices/gdevcif.c
devices/gdevclj.c
devices/gdevcljc.c
devices/gdevcmykog.c
devices/gdevcslw.c
devices/gdevdfax.c
devices/gdevdjet.c
devices/gdevdjtc.c
devices/gdevdljm.c
devices/gdevdljm.h
devices/gdevdm24.c
devices/gdevepsc.c
devices/gdevepsn.c
devices/gdevescp.c
devices/gdevfax.c
devices/gdevfax.h
devices/gdevfpng.c
devices/gdevgprf.c
devices/gdevhl7x.c
devices/gdevicov.c
devices/gdevifno.c
devices/gdevijs.c
devices/gdevimgn.c
devices/gdevjbig2.c
devices/gdevjpeg.c
devices/gdevjpx.c
devices/gdevl31s.c
devices/gdevlbp8.c
devices/gdevlj56.c
devices/gdevlp8k.c
devices/gdevlxm.c
devices/gdevmgr.c
devices/gdevmiff.c
devices/gdevn533.c
devices/gdevo182.c
devices/gdevokii.c
devices/gdevpbm.c
devices/gdevpcx.c
devices/gdevpdfimg.c
devices/gdevperm.c
devices/gdevphex.c
devices/gdevpjet.c
devices/gdevplan.c
devices/gdevplib.c
devices/gdevpng.c
devices/gdevpsd.c
devices/gdevpsd.h
devices/gdevpsim.c
devices/gdevpxut.c
devices/gdevpxut.h
devices/gdevrinkj.c
devices/gdevsj48.c
devices/gdevstc.c
devices/gdevtfax.c
devices/gdevtfax.h
devices/gdevtfnx.c
devices/gdevtifs.c
devices/gdevtifs.h
devices/gdevtknk.c
devices/gdevtsep.c
devices/gdevupd.c
devices/gdevwpr2.c
devices/gdevxcf.c
devices/rinkj/rinkj-byte-stream.c
devices/rinkj/rinkj-byte-stream.h
devices/vector/gdevpdf.c
devices/vector/gdevpdfo.c
devices/vector/gdevpdfp.c
devices/vector/gdevpdfu.c
devices/vector/gdevpdfx.h
devices/vector/gdevpsu.c
devices/vector/gdevpsu.h
devices/vector/gdevpx.c
devices/vector/gdevtxtw.c
devices/vector/gdevxps.c
pcl/pl/pjparse.c
pcl/pl/pl.mak
pcl/pl/plapi.c
pcl/pl/plapi.h
pcl/pl/plmain.c
pcl/pl/plmain.h
pcl/pl/plparams.c
pcl/pl/pltop.h
psi/files.h
psi/iapi.c
psi/iapi.h
psi/imain.c
psi/imain.h
psi/imainarg.c
psi/imainarg.h
psi/iminst.h
psi/int.mak
psi/psapi.c
psi/zfile.c
windows/ghostscript.vcproj
xps/ghostxps.h
xps/xpsjxr.c
xps/xpstop.c
xps/xpszip.c


2019-05-28 16:08:26 +0100
Chris Lidell <chris.liddell@artifex.com>
808021913baf763e07cc9eabc3716bfa507380ff

Bug 701083(2): Write the new key/value to DecodeParms

There was a lengthy block of code that handled PDFs with buggy DCTDecode
dictionaries with a missing, or incorrect Height entry. Since we now have a
second key/value needing added to the DecodeParms and in two places, I've
split that into a more general procedure, so we can add multiple new keys in
one step.

This is used to add/patch the Height key, and add the new ErrsAsEOD key
(telling the CCITT fax decode filter to treat an error as a EOD).

Resource/Init/pdf_draw.ps


2019-05-27 19:00:06 +0100
Robin Watts <Robin.Watts@artifex.com>
1a344ed8506e46e77a0c58aed57de69ce8f54a20

Bug 701083: Add key to treat errors as end of data when decoding images.

This specifically only applies to the CCITT decode filter at the
moment, but the key will be in place for all image decoders to look
at if required.

A following commit will cause the PDF interpreter to set this key
in the DecodeParms.

base/scfd.c
base/scfparam.c
base/scfx.h


2019-05-27 15:33:27 +0100
Chris Liddell <chris.liddell@artifex.com>
c1739dcc6a8ceda1a5091c1b7dc8bb4870c6c76b

Fix a couple more compiler warnings.

psi/imain.c


2019-05-24 14:32:59 +0100
Chris Liddell <chris.liddell@artifex.com>
e2e83fb18feeae8786c16c0c309f9c1efdea2614

Bug 700956: don't free text enumerator in error condition

Some errors mean the graphics library will decrement the reference count,
potentially freeing, the text enumerator. So, on return to the interpreter
don't try to free it.

In these cases we can safely rely on the garbager to clean up the memory if the
graphics library didn't.

psi/zchar.c


2019-05-24 09:50:49 +0100
Chris Liddell <chris.liddell@artifex.com>
f8b9b5d02f2ba59256c92f6015eda02cb5d16c9e

Fix a trivial (probably benign) compiler warning

psi/imain.c


2019-05-23 11:09:50 +0100
Chris Liddell <chris.liddell@artifex.com>
c1844f1adbd7e1b215dde46d6211a84af5cea8a4

Fix FONTPATH font file enumeration

As part of improving security, we had replaced the reference using the name
.scanfontheaders to find the array of headers for file types to scan with
the immediatetly evaluated //.scanfontheaders in gs_fonts.ps

That doesn't work correctly because the array is redefined multiple times
as we add support for various font types during initialisation.

Fix it by replacing the immediate evaluation with explicitly using the name key
/.scanfontheaders to pull the array from systemdict.

Resource/Init/gs_cff.ps
Resource/Init/gs_fonts.ps
Resource/Init/gs_ttf.ps


2019-05-23 11:18:06 +0100
Chris Liddell <chris.liddell@artifex.com>
e42161d209e220aa84615b0af7efc7507f0f5397

Fix crash when the default font can't be found.

Making .loadfontloop into an operator messes up the error condition recovery
when we've had to fall back to the default font, and even that is not
available (i.e. when GenericResourceDir is set to somewhere that isn't actually
a viable resource directory).

Resource/Init/gs_fonts.ps


2019-05-22 19:07:07 -0600
Henry Stiles <henry.stiles@artifex.com>
c2d78d6fd563bb3137991ce9f74ec2379e0de9aa

Remove unnecessary but harmless conditional from the last commit.

pcl/pcl/pctop.c


2019-05-22 13:36:31 -0600
Henry Stiles <henry.stiles@artifex.com>
690adf6efb53e61e965e6f37cd78b060b2fdb233

Fix bug 701045 - infinite loop in pcl parser.

The recent work to remove the specialized PL cursor code and replace
it with streams removed end of data detection PCL depended on. End of
data is now detected by the PCL parser by requiring a minimum number
of bytes on the next call to the parser. If the required number of
bytes are not provided the parser signals end of data by advancing the
read pointer to the end of the buffer.

The change precipitated some reorganization in how RTL is initialized,
as well.

pcl/pcl/pcl.mak
pcl/pcl/pcmacros.c
pcl/pcl/pcparse.c
pcl/pcl/pcparse.h
pcl/pcl/pcsfont.c
pcl/pcl/pctop.c
pcl/pxl/pxpthr.c


2019-03-28 17:21:02 -0600
Henry Stiles <henry.stiles@artifex.com>
1058e51507f4dfb483c104dd83e77375e62181b4

Fix bug #700844, crash with very long font path.

A long font path, specified by setting the environment variable
PCLFONTSOURCE, resulted in buffer overflows in both PJL and PCL. Also,
simplify the logic to load fonts in PCL because it is not
necessary to parse a path list, a single path has been already been
parsed in PJL.

Related coverity id's addressed with this change are: 102193, 102206,
102208, and 102210.

pcl/pl/pjparse.c
pcl/pl/pllfont.c


2019-03-11 11:18:23 -0600
Henry Stiles <henry.stiles@artifex.com>
7a5637d2248501998ca9bb16bc51c93dd15a2d0d

Remove unnecessary include file left from a test.

pcl/pl/plfont.c


2019-05-22 18:04:52 +0100
Robin Watts <Robin.Watts@artifex.com>
3a9bb467fa9ff18ca398081c32edddc6732ce75e

Add gpdl to default products for clusterpush.pl

toolbin/localcluster/clusterpush.pl


2019-05-22 17:58:25 +0100
Robin Watts <Robin.Watts@artifex.com>
979f09479916c799d5df30df85c6caa30f86bffc

Add nopdfwrite to clusterpush.pl

toolbin/localcluster/clusterpush.pl


2019-05-21 07:39:49 -0700
Nancy Durgin <nancy.durgin@artifex.com>
dd4be3eb2b28ff67dc3ee6e636bf7024bf9d1003

Add check for gs_error_handled for pattern handling

Some clients (specifically gpdfi) can now return gs_error_handled if
they already took care of everything in the PaintProc call. In this
case, just do all the cleanup as for any other error, but it's not
really an error, so return error code 0.

This wll be needed for pdfi when merged in, should have no affect on current
code.

base/gxpcmap.c


2019-05-20 12:32:13 +0100
Robin Watts <Robin.Watts@artifex.com>
2b925a84a9cbbeabba391d50f08b7064688298c2

Add gsapi_set_param to iapi.h as well.

This keeps the gs and gpdl implementations of gsapi in sync.

psi/iapi.c
psi/iapi.h


2019-05-20 13:07:13 +0100
Robin Watts <Robin.Watts@artifex.com>
8aa6f8ce98e19ddc1a30b924169abf091748c1a9

Fix warnings in pjparse.c

pcl/pl/pjparse.c
pcl/pl/pl.mak


2019-05-17 18:51:13 +0100
Robin Watts <Robin.Watts@artifex.com>
b932ec31114e4e7a7ace0089cb87ddb70dc7732f

Add gsapi_set_param to gpdl gsapi.

This takes an enumerated type and values, to allow programmatic
setting equivalent to -d and -s on the command line.

These should only be called between jobs, and then with care.

Values are set in the device parameters and then passed to each
language implementation in turn.

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


2019-05-16 19:59:58 +0100
Robin Watts <Robin.Watts@artifex.com>
dc9c23ed944f653e384fd12fbaf6328e8bab8a33

PJL GSSET and GSSETSTRING

Add GSSET and GSSETSTRING PCL commands for setting device
parameters/language parameters from PJL.

pcl/pl/pjparse.c
pcl/pl/plmain.c
pcl/pl/plmain.h


2019-05-18 13:52:25 +0100
Ken Sharp <ken.sharp@artifex.com>
85c99aa093d4e26b9f40c0a4eb686a7f5b2b2d64

pdfwrite - fix ColorConversionStrategy

No bug number, this arose from a question asked on Stack Overflow.

At some point I removed the enumerated value ccs_UseDeviceDependentColor
but I failed to remove the name "UseDeviceDependentColor" from the
list of strategy names. This meant that setting ColorConversionStrategy
to anything except LeaveColorUnchanged was 'out by 1' in the enumerated
data type.

This led (for example) to Gray being treated as RGB for the purposes
of the output colour space.

devices/vector/gdevpsdf.h


2019-05-08 08:19:55 -0700
Michael Vrhel <michael.vrhel@artifex.com>
95f7befcec1b30fd5014c8ad616485d32901ce33

Make sure transparency page group is isolated

Per the spec, the page group should be treated as an isolated
group. This allows the page group to specify a blending color space.
This resulted in over 90 pages of bmpcmp diffs. I went over all
of them. They are progressions. Most are very minor color differences
as we end up doing the blending and drawings in different color spaces
compared to prior to the commit

base/gstrans.c


2019-05-17 14:37:30 -0700
Michael Vrhel <michael.vrhel@artifex.com>
ebe7cd2b5a7a000c5ebf0bfa061f872faaf098e3

Handle trans group knockouts properly if page group is isolated

Page groups by definition have to be isolated. A fix for this to
ensure that the proper group color space is used for the page group
revealed a problem when the source PDF actually indicated the page
group was isolated. This led to an incorrect selection of subsequent
backdrops for any knockout groups contained.

base/gdevp14.c
base/gdevp14.h


2019-05-17 11:20:45 +0100
Ken Sharp <ken.sharp@artifex.com>
ee8a1c574198351d3ec1b181428d3d0159b4f80a

PDF interpreter - ignore errors in some faulty FreeText annotations

Bug #701058 "Can not convert pdf to tiff"

The PDF file has a FreeText annotation with no appearance stream and
faults in the Annotation dictionary.

Firstly (not perhaps strictly a fault) the /Contents key has a string
value with nothing in it. This isn't exactly an error, but it makes the
annotation pointless.

More seriously the /DA key contains:

(//Helvetica 12 Tf 0 g)

The double // on the font name means we end up with an empty name
on the stack, which causes errors.

In this commit:

Execute the DA processing in a stopped context, so that if it fails we
don't throw an error.

Surround the DA processing with a mark so that we can clear the stack if
it leaves anything behind.

Surround all of that with a 'gstate...setgstate' or 'gstate...pop'. If
we get an error this allows us to restore the graphics state to the
point before we did the DA processing. If we didn't get an error then
we can just discard the saved gstate.

Finally, check the length of the Contents string. If its 0, don't even
try to draw it. If its more than 0, but less than 4, then don't attempt
to check for UTF16 (2 byte BOM + 2 bytes for character means a minimum
of 4 bytes).

This results in slightly different output from pdfwrite with one file,
tests_private/pdf/sumatra/1331_-_prints_garbled.pdf, which results in
very small (single pixel) differences at 72 dpi.

Resource/Init/pdf_draw.ps


2019-05-17 09:15:48 +0100
Chris Liddell <chris.liddell@artifex.com>
2b4f54e13d9a5346e1c4c0a3a577d27065e67313

Remove the redundant -E and -A command line params

The functionality for both are now (and have been for a *long* time!) accessed
via -Z# and -Z@ respectively.

This solves a clash for -E with the other language implementations.

doc/Use.htm
psi/imainarg.c


2019-05-11 09:24:38 +0100
Ken Sharp <ken.sharp@artifex.com>
29fc52982904f7b24349f7fe369f614b3081ce90

DeviceN - handle out of memory errors

When altering the DeviceN colour space handling in the PostScript
interpreter to use C strings instead of name indices, I neglected to
consider the possibility of a failure to allocate memory for the string.

This commit just catches the fault and returns a VM error to the
interpreter.

psi/zcolor.c


2019-05-10 14:49:29 +0100
i3v <i3v@mail.ru>
55d04ff91a70a2cba1a1c15407c94f936c5f91f4

Documentation - fix various typos in VectorDevices.htm

Bug #701021 "Typos in VectorDevices.htm"

Fixes supplied by 'i3v'.

doc/VectorDevices.htm


2019-05-10 09:32:26 +0100
Chris Liddell <chris.liddell@artifex.com>
3db10c55b3ef621770bf6e93dfc1605e766adef2

Improve test for PS resources in romfs

Previously, although we always built a romfs, building gs with COMPILE_INITS=0
meant we included a romfs which was devoid of content, and an attempt to find
the status of the device would return 'gs_error_unregistered'. We used this
to determine whether to automatically add '%rom%Resource/Init' to the default
search path.

In the gpdl case (for the sake of PCL and XPS), we always have a usable romfs
(even with COMPILE_INITS=0) for the ICC profiles, so the above test gave a
false positive: gs would add the romfs to the search path, despite there being
no usable Postscript resources in it.

So, revise the test to explicitly check for Resource/Init/gs_init.ps on the
romfs. If the romfs is, indeed, empty, it will still return
'gs_error_unregistered', but in the gpdl case, it will return
'gs_error_undefinedfilename', and we correctly skip adding the romfs path to
the search paths for Postscript resources

psi/imain.c


2019-05-08 13:23:26 +0100
Chris Liddell <chris.liddell@artifex.com>
d2809b15153eedbbe1bfb43fc259bf674e353f42

Add an (interim) --enable-gpdl configure option

This adds gpdl to the default target list for make.

Mainly to get the .so build usable without having edit the makefiles.

This will be deprecated when gpdl is always in the default target list.

Makefile.in
configure.ac


2019-05-09 09:49:56 +0100
Ken Sharp <ken.sharp@artifex.com>
d0d7b8d3866aecafac3601ebd9b4b5d83f4fbe91

Fix some compiler warnings

and remove some #if directives accidentally included in a commit

base/gscdevn.c
devices/vector/gdevpdfc.c
psi/zcolor.c


2019-05-08 14:28:41 +0100
Ken Sharp <ken.sharp@artifex.com>
86a81b823950c712ac03e0139449045a81672d01

pdfwrite - extend DeviceN attributes dictionary generation

Now that we cater for the /Process dictionary in a DeviceN attributes
dictionary (and the Subtype) we need to emit those from pdfwrite too.

devices/vector/gdevpdfc.c


2019-05-08 14:27:23 +0100
Ken Sharp <ken.sharp@artifex.com>
2019db2e552653bd0c27377d500de1041c9fd0bc

PostScript colour space handling

We were not catering for a /Subtype in a DeviceN attributes dictionary
having a value which is a string type not a name type. I can't quite
see how we are ending up with a string type here, since the PDF file
has it as a name, but it does. Dealing with both resolves many errors.

The second change is more far-reaching; when processing an attributes
dictionary for a DeviceN colour space we may need to create colour
spaces for the Process dictionary /ColorSpace and for any of the entries
in the Colorants dictionary. We were doing that by calling
zsetcolorspace() which mostly works well, however there is one
optimisation which can cause a problem; if the target space is the same
as the current *interpreter* colour space, then zsetcolorspace()
simply returns.

The problem is that if we are halfway through processing a DeviceN
space then we haven't set the interpreter space to the new colour space
array yet which can mean that we incorrectly detect one of the target
spaces as being the same as the current space. This leads to us trying
to use the current space in the graphics state (the DeviceN space) as
the target space, with unfortunate consequences.

So create a new version of zsetcolorspace which doesn't do that
optimisation and use that when processing the various target spaces in
the DeviceN attributes dictionary.

psi/zcolor.c


2019-05-07 12:52:25 +0100
Ken Sharp <ken.sharp@artifex.com>
0d75869134c69963406500b536fb1bb1c97c8621

Separation - change ink name to be a C string instead of name index

As indicated in previous commits, change the stored ink name in the
colour space structure params.separation from a numeric value
(gs_separation_name) into a C string.

We never have to pass these back to the interpreter, so we allocate the
storage using the non-GC allocater.

base/gscdevn.c
base/gscsepr.c
base/gscspace.h
base/gsequivc.c
base/gsicc_cache.c
base/gxcmap.c
devices/vector/gdevpdfc.c
devices/vector/gdevpdfg.c
psi/zcolor.c


2019-05-06 16:51:26 +0100
Ken Sharp <ken.sharp@artifex.com>
97253bf54a701d5e433378df953e066d009afde0

DeviceN - change ink names to be C strings instead of name indices

As indicated in previous commits, change the stored ink names in the
colour space structure params.device_n from numeric values
(gs_separation_name) into C strings.

We never have to pass these back to the interpreter, so we allocate the
storage using the non-GC allocater, which simplifies things for the
array which used to store the indices and now stores the pointers to the
C strings.

base/gscdevn.c
base/gscspace.h
base/gsequivc.c
base/gsicc_cache.c
base/gsicc_manage.c
base/gxcmap.c
devices/vector/gdevpdfc.c
devices/vector/gdevpdfg.c
psi/zcolor.c


2019-04-07 19:54:57 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
880a700f691f444c483053f48b3c0b0f3a920883

Bug 697545 : Prevent SEGV caused by double freeing.

Prevent running finalize for devices with a custom finalize.

Error created using :-
MEMENTO_FAILAT=1767 ./membin/gpcl6 -sDEVICE=pbmraw -o /dev/null ./tests_private/pcl/pcl5cfts/fts.0270

base/gdevdflt.c
base/gspaint.c


2019-05-02 08:00:46 -0700
Michael Vrhel <michael.vrhel@artifex.com>
284ba1a6491088ab8ea9985f5df882c43bd3ca12

Use deviceN attributes process color color space

If the DeviceN color space includes an attributes entry and
it has a process color space, and the color space is of the proper
type use that as the source color for the process components. If
instead the alternate tint transform color space is the correct type
use that as a hint. If neither work then set to the defined default_cmyk
source color space. If all fail due to issues with ICC profiles then
the CMYK source process colorants will pass through to the output device.

base/gdevp14.c
base/gscdevn.c
base/gsequivc.c
base/gsicc.c
base/gxcmap.c
base/gxcmap.h


2019-05-06 13:46:42 +0100
Ken Sharp <ken.sharp@artifex.com>
754b4eb77d24ff0273b530aa748bbf925b715d9c

Ensure correct memory allocation of Colorant strings

I'm not happy with using ref_to_string() as it doesn't seem to behave
entirely as I would expect, so modify the code to explicitly allocate
the memory used to store the Colorant name.

Also fix a compiler warning.

psi/zcolor.c


2019-05-06 09:10:22 +0100
Ken Sharp <ken.sharp@artifex.com>
76022c9c27a0f4031553cf3a5eb2c009b26b19be

DeviceN - store C strings for Colorant names, not name indices

For DeviceN spaces with an attributes dictionary containing a
Colorants dictionary we were storing the Colorant names as a name index
(index into the interpreter name table). Additionally we store a
procedure callback to recover the C string from the name index.

This is problematic for several reasons; firstly it requires all the
interpreters to either have a name table or some close equivalent so
that a C string can be recovered from a numeric value.

Secondly the lifetime of the string is divorced from the lifetime of the
C structure using it. Because there's no easy way for the interpreter to
know when the graphics library has freed the colour space structure
the interpreter is forced to retain the relationship between the name
index and the C string until the job is completed.

Both of these will be problems for the new PDF interpreter, so this is
step 1 in altering this. After this we will still need to change the
storage of the DeviceN and Separation ink names, which are handled the
same way.

base/gscdevn.c
base/gscdevn.h
base/gxcdevn.h
devices/vector/gdevpdfc.c
devices/vector/gdevpdfg.c
psi/zcolor.c


2019-05-03 17:35:49 +0100
Ken Sharp <ken.sharp@artifex.com>
8b407511d2fad0108a76c6b46dc54a1770ea3ade

fix commit c2d50885614481ebf542578e69ce4bcbbfea6532

don't retest code, and fix some compiler warnings

base/gscdevn.h
psi/zcolor.c


2019-05-03 13:27:22 +0100
Ken Sharp <ken.sharp@artifex.com>
c2d50885614481ebf542578e69ce4bcbbfea6532

DeviceN - handle attributes Subtype and cleaning up

Previously we were ignoring the /Subtype in the attributes dictionary
of a DeviceN colour space (if attributes were present). We may need to
be able to tell the difference (now that we handle /Process) because
the values associated with the process components must be stored in
their natural form (eg subtractive for CMYK, additive for RGB) when
the Subtype is NChannel.

The remainder of the commit tidies up naming; previously we had a
structure called gs_devicen_attributes, which was used to store the
Colorants entry form an attributes dictionary. Since we now handle
other aspects of the attributes dictionary as well, this was misleading
so the structure has been renamed throughout as gs_devicen_colorant
(since each structure defines only one colorant, the plural name was
also misleading). Apparently pdfwrite is the only client for this
currently anyway.

Finally, moved the 'devn_process_space' from the general graphics
state colour space structure into the DeviceN params structure, as its
only relevant to DeviceN (and indeed only a DeviceN with an attributes
dictionary which contains a /Process entry)

base/gscdevn.c
base/gscdevn.h
base/gscspace.c
base/gscspace.h
base/gxcdevn.h
devices/vector/gdevpdfc.c
devices/vector/gdevpdfg.c
psi/zcolor.c


2019-05-02 16:40:18 +0100
Ken Sharp <ken.sharp@artifex.com>
22d88ad48409a130007976ae26536cc9d99c16d9

Fix an oversight in DeviceN attributes processing

If we have no Colorants entry we still want to check for a Process
entry, but to do so we need to signal to setcolorspace_cont(), the
routine which calls this one, that we do want to keep processing the
colour space.

psi/zcolor.c


2019-05-02 13:12:28 +0100
Ken Sharp <ken.sharp@artifex.com>
7c70031f8be95585bcf439d12e552d386e4e2125

Capture the /Components from a DeviceN /Process dictionary

Following on from commit 5e84879db91fdc8569a85a394def391695152720 and
Michael's commit c6ac30d231946062b41c56df375b240583e75b35 this adds
code to check for the existence of a /Process dictionary in the
attributes dictionary (if present) of a DeviceN colour space.

Also fixed/added a few comments to the existing code and did some
tidying up of error return handling.

psi/zcolor.c


2019-05-01 10:06:41 -0700
Michael Vrhel <michael.vrhel@artifex.com>
c6ac30d231946062b41c56df375b240583e75b35

Add holder for process color names in DeviceN color space parameters

As part of the work to use the DeviceN attributes process dictionary
we need to have a place to store the colorant names. They will
be stored as an array of C strings in the pcs->params.device_n structure.
This commit adds them to the structure and frees them during the color
space finalization.

base/gscdevn.c
base/gscspace.h


2019-05-01 17:49:03 +0100
Ken Sharp <ken.sharp@artifex.com>
5e84879db91fdc8569a85a394def391695152720

Process DeviceN attributes dictionary, /Process dictionary, /ColorSpace

PostScript PDF interpreter changes; retrieve the Process dictionary
from the DeviceN attributes dictionary (if present). Extract the
ColorSpace, resolve the ColorSpace (turns any references into actual
objects), and store the result back in the Process dictionary. Finally
store the Process dictionary in the attributes dictionary which we
pass to setcolorspace.

PostScript interpreter, C changes; add a new 'stage' for DeviceN
colour space handling. In stage 3, check for the existence of an
attributes dictionary, then a /Process dictionary, and a /ColorSpace
entry. Retrieve the entry. Set up a new continuation procedure
'devicenprocess_cont'. The continuation procedure calls zsetcolorspace()
to set the /ColorSpace as the current space. On returning, retrieve
the current color space, attach it to the DeviceN graphics state colour
space and finish.

Still to do; process /Components, add the equivalent code to pdfi,
check pdfwrite to see if we can handle this. Tidy up comments.
Committing now so Michael can carry on with the CMS work.

Resource/Init/pdf_draw.ps
psi/zcolor.c


2019-05-01 13:17:25 +0100
Robin Watts <Robin.Watts@artifex.com>
6742ad7d26dc7bb8cc33aef9f96f86d892d4a424

Valgrind: image_render_interpolate_landscape_icc.

Don't color convert the unprocessed margins of the buffer.
These areas are never inited, so a warning is given. No
harm is done as they are never actually rendered, but it's
faster and cleaner to skip them too.

base/gxiscale.c


2019-04-30 15:13:25 -0700
Michael Vrhel <michael.vrhel@artifex.com>
04db6ace1fb97dcef79d9bdbb01a1c8a63c55d88

Add a devn_process_space to color gs_color_space_s

This is in preparation for having the process color
space as defined in the DeviceN (NChannel) Process
dictionary.

base/gscspace.c
base/gscspace.h


2019-04-30 11:49:07 -0700
Michael Vrhel <michael.vrhel@artifex.com>
e1f9edfcafc3f73f43b85afacb8d788f7e573cf6

Add methods to detect pure process colors in Sep and DeviceN color spaces

When the colors in the separation or Devicen color space consist all of
one particular process color model, we would like to consider the use
of the alternate tint transform color space as an indication of the intent
for these color spaces (assuming the attributes information was not there).
For example, if we had a DeviceN color space
of [Cyan Magenta] and the alternate tint transform color space was a
CMYK ICC color space, that would be a hint that we should treat the color
as being in that space. This commit provides us with the information as
to the colorants all being in one particular process space which is
a requirement.

base/gscdevn.c
base/gscsepr.c
base/gscspace.h


2019-04-30 15:26:11 +0100
Robin Watts <Robin.Watts@artifex.com>
b380b655b64a37a77b98dab881ff0aad0c62586e

Nobble pdfwrite genrated /ID entries in cluster tests.

Avoid having the /ID values depend on the output filename
in cluster testing. This should allow us to compare the
results of pdfwriting between gs and gpdl. It also removes
one more thing to get right when trying to manually reproduce
cluster results.

devices/vector/gdevpdf.c


2019-04-30 10:40:20 +0100
Robin Watts <Robin.Watts@artifex.com>
fd5758e4d55c510fa4ad0047c10b13cf928cfb74

Make pdfwrite fileID calculations consistent on cluster.

Nobble the timing calculations under CLUSTER builds, so
we get consistent results.

Also, move to using realtime, rather than usertime (as the goal
is to have something different each time).

devices/gdevpdfimg.c
devices/vector/gdevpdf.c


2019-04-29 17:58:42 -0700
Michael Vrhel <michael.vrhel@artifex.com>
35c40cdaa2f79432f01733d3f69f95947db5d60b

Change implementation of gsicc_support_named_color

gsicc_support_named_color now will have available all the names
in the DeviceN color space. If there are no spot names
in the list, it will return false ensuring that the process colors
will be color managed.

base/gscdevn.c
base/gscsepr.c
base/gsicc_cache.c
base/gsicc_cache.h


2019-04-29 18:39:23 +0100
Robin Watts <Robin.Watts@artifex.com>
8026e11e50306a51dc3bb6f2bdc57f34986acd62

Fix undefined behaviour in rops.

We were indexing off the end of a static table. Annyoingly,
valgrind has failed to pick this up for years.

base/gsroprun.c


2019-04-29 11:14:06 +0100
Ken Sharp <ken.sharp@artifex.com>
0bafbd9c1273fab0dc79fd20db0ffc4443683f96

PDF interpreter - Decode ToUnicode entries of the form /Identity-H/V

Bug #701003 "Text searchability broken due to omission of /ToUnicode /Identity-H"

The PDF references from 1.2 too 2.0 all state that the value associated
with a ToUnicode key in a FontDescriptor must be a stream object. However
this file (and one case seen previously, bug 687351) have FontDescriptor
dictionaries where the value associated with a /ToUnicode key is a
name object, in both cases /Identity-H.

Although this is clearly not legal, Acrobat not only tolerates it, it
actually uses it for search/copy/paste (see bug 701003 for details).
Without the key Acrobat is unable to successfully search the output file.

We can't simply preserve the name object as a ToUnicode value; when
handling ToUnicode we actually decode the CMap and build a
GlyphNames2Unicode map (an internal representation of the G2U data
produced by the Microsoft PostScript printer driver). When writing the
output file we use that information to get a Unicode value for each
character we write, and build a new ToUnicode CMap using that.

This commit tackles the problem by pre-scanning for a name object and
then checking to see if its Identity-H or Identity-V (although we have
not seen an Identity-V, there seems no reason why it wouldn't be
equally valid). If we find either of these then we construct a
GlyphNames2Unicode table for all possible values (0 - 65535) and store
that with the font as normal. When we write the output file we only
write the required entries for the subset font, so we write a now
completely legal ToUnicode CMap, and Acrobat is equally happy with that
as the original name.

If the ToUnicode value isn't a name object, or isn't one of the
identities then we proceed as before. This means we will print a
warning for non conforming ToUnicode entries and ignore them.

Resource/Init/pdf_font.ps


2019-04-28 19:59:12 -0700
Michael Vrhel <michael.vrhel@artifex.com>
0b9c45fa86f7736e7fec170a135efa83636283ba

Have CMYK colors in DeviceN color spaces color managed when going to CMYK devices

The current code was only doing color management of DeviceN CMYK when going to
the separation device (e.g. tiffsep and psdcmyk). It should also be doing this
for pure CMYK devices like tiff32nc etc. With RGB devices we will be going through
the alternate tint transform. The would only pertain to DeviceN color spaces composed
of only process colors (e.g. [Cyan Magenta]). If a spot color was included we would
be going through the alternate tint transform for a device like tiff32nc.

So with this commit if you have a command line like

-sDEVICE=tiff32nc -sDefaultCMYKProfile=src_cmyk.icc -o output.tif -f input.pdf

it will treat the CMYK values in the DeviceN color space the same as a DeviceCMYK
source color and make use of the src_cmyk.icc profile to handle those. As mentioned
this worked with psdcmyk and tiffsep but not standard CMYK devices.

base/gxcmap.c


2019-04-01 20:30:23 +0100
Robin Watts <Robin.Watts@artifex.com>
68511243fb4817e8170023d1d6922956325a139d

Move transfer functions to 16 bits.

This means that in 'deep' modes, we sample them in 257 places
(0000,0100,....ff00,ffff) rather than 256 (00,01,...ff), and
in 16 bits rather than 8. We also interpolate them on reading.

This in turn increases the size of the data put into the clist.

base/gdevp14.c
base/gstparam.h
base/gstrans.c
base/gstrans.h
base/gxblend.c


2019-04-26 21:24:28 -0700
Michael Vrhel <michael.vrhel@artifex.com>
e2507c443fcd1456ff65695901339fc96f4bbf73

Fix improper logic in named color support

base/gscdevn.c


2019-04-26 16:47:29 -0700
Michael Vrhel <michael.vrhel@artifex.com>
fb9f948ec79d18c2574a9a0bdaf9ab1aeee21e58

And one more fix to the named color blending.

Fixing issues introduced in previous commit.

base/gsicc_cache.c


2019-04-26 11:25:19 -0700
Michael Vrhel <michael.vrhel@artifex.com>
e1a534e843743230019de57a36a04129347a505e

Fix named color blending

Named color blending was not working the way intended. This was clearly visible
when pushing a gradient through. This now does a reasonable result blending
the first colorant with white and then subsequent colorants with the current
colorant.

base/gsicc_cache.c


2019-04-26 14:40:22 +0100
Chris Liddell <chris.liddell@artifex.com>
6fcd76043a6fe69ca2b8ecac498f9ca79829931f

Bug 700973: CIDFont substitution: avoid multiply applying metrics

findCIDFont: we make various efforts to produce a synthetic font style
(bold, light, italic etc) if the actual type face style is not available.

In these cases, we have to avoid reusing an existing CIDFont substitute because
the CDevProc will have been 'hooked' to apply the width metrics drawn from the
PDF file. We want to, if at all possible, use the CIDFont as originally loaded.

Resource/Init/pdf_font.ps


2019-04-25 17:20:12 +0100
Ken Sharp <ken.sharp@artifex.com>
cb1414723d95c6813e8e44a8c0529f0063998378

pdfwrite - handle user-defined PCL fonts with character codes > 256

Bug #700996 "PCL Files Processing failure"

The problem is that we cannot handle a character code in excess of 256
in a PDF Font (we would have to create a CIDFont, which is too much
work). This was causing us to fail to attach a PDF font to the current
(user-defined PCL) font. When we later tried to retrieve the font
that caused a seg fault.

If we simply return an error when there is no attached font then the
fallback machinery will take us through generating an image instead.

This, however, caused the original file not to work properly, text was
going missing. Forcing 'early accumulator' to be 0 so that we created a
new font resolved the problem. Its better, however to remove that entire
section of code, since it now has no purpose.

This commit results in a PDF file with the correct appearance. A number
of out test suite files exhibit small differences, particularly at
low (75 dpi) resolution, but nothing is actually incorrect.

devices/vector/gdevpdti.c
devices/vector/gdevpdtt.c


2019-04-24 12:27:16 -0700
Michael Vrhel <michael.vrhel@artifex.com>
7b1d3a9fcc40d0dd2dc779830abe21da83183c11

Fix two issues in replace color management.

Always do replacement for this demo implementation and
use get_color_mapping_procs_subclass to get the device
color mapping procs. The old method had an issue with
overprint compositor and psdcmyk device.

base/gsicc_replacecm.c


2019-04-24 11:20:57 -0700
Michael Vrhel <michael.vrhel@artifex.com>
29d227c79fa8554e65eb1e081a81cbcb13b76b8a

Avoid double free in replace color management code

base/gsicc_replacecm.c


2019-04-24 10:27:25 -0700
Michael Vrhel <michael.vrhel@artifex.com>
2f947ad5c32968cb113cb3ba4958e239dcf730a5

Use space in calls to gs_strtok

base/gsicc_manage.c


2019-04-23 21:32:00 -0700
Michael Vrhel <michael.vrhel@artifex.com>
8881a51d55df7df70f4e0083be8569e09213dfba

Fix several warnings and issues from last commit.

base/gscsepr.c
base/gsicc_cache.c
base/gxcmap.c


2019-04-24 10:48:07 +0100
Robin Watts <Robin.Watts@artifex.com>
7f34ef8c946be47d5a5dcc412b3da608a0066c44

Fix typo in 16bit code in gxblend.c

src_shape needs to be 16bits, not a byte now.

base/gxblend.c


2019-04-23 20:11:24 -0700
Michael Vrhel <michael.vrhel@artifex.com>
fea343608ce813156ae8ffc2ea6d42fc5f198e64

Add support for named color when going to separation devicen_icc_cmyk

When going through named color processing with the target device either
tiffsep or psdcmyk, cmap_devicen_direct and cmap_devicen_halftoned were
doing an additional cmyk icc mapping. This mapping was needed to ensure
that CMYK values matched DeviceN mapping values of CMYK+Spot where the Spot
value was 0 percent. With the use of named color mapping, we want to avoid this
icc mapping. Fixing this issue involved adding a boolean value to the DeviceN and Separation
color space params to indicate if the spot colorant(s) are supported by the
named color profile. This determination is made during the install of the
device so that it need only be done once. To do that, we needed to add a
method, gsicc_support_named_color, in gsicc_cache.c, which goes with
gsicc_transform_named_color, to indicate if the spot colorant is defined in
the data that we are using. Tested with tiff24, tiff32 and psdcmyk to ensure
named color mapping is occurring and that no additional mapping occurs after
that.

base/gscdevn.c
base/gscsepr.c
base/gscspace.h
base/gsicc_cache.c
base/gsicc_cache.h
base/gxcmap.c


2019-02-19 16:38:26 +0000
Robin Watts <Robin.Watts@artifex.com>
f0f2fa2a084758bcf99409ce19c2c1f93dc04d32

Deep color transparency

Previously, all transparency blending has been done using the
pdf14 compisitor working in 8 bits. Here, we extend it to be
capable of working in 16 bits.

When the compositor is created, it looks at the underlying device;
if that device uses more than 8 bits per component (plus 8 bits
for tags, if tags are in use), then we use 'deep' (i.e. 16 bit
per component) pdf14 buffers.

base/gdevdflt.c
base/gdevmem.c
base/gdevp14.c
base/gdevp14.h
base/gdevprn.c
base/gsptype1.c
base/gstrans.h
base/gxblend.c
base/gxblend.h
base/gxblend1.c
base/gxclrect.c
base/gxclthrd.c
base/gxcolor2.h
base/gxp1fill.c
base/gxpcolor.h


2019-04-22 15:33:02 +0100
Robin Watts <Robin.Watts@artifex.com>
ba8ff34e302ec3e65bd47b14796dcfaef157527f

Hack bmpcmp to accept 16bpc PSD files.

We ignore the bottom bytes of the pixel data.

toolbin/bmpcmp.c


2019-04-19 08:16:57 +0100
Chris Liddell <chris.liddell@artifex.com>
d8db95fb00af2fb543439242d3ac122aead88c94

Fix some structure element name confusion in base/sjbig2_luratech.c

A previous commit slightly modified some of memory management for jbig2 global
data. In mirroring those changes to the Luratech version of the code, a couple
of places were left with the structure element names from the jbig2dec version.

base/sjbig2_luratech.c


2019-04-16 19:30:02 +0100
Robin Watts <Robin.Watts@artifex.com>
b399f849ce1aa391da1abeb23fd32e376b56e522

Bug 700624: Fix "full" pattern fills with gaps between cells.

GS has an optimisation in it, whereby if an uncolored pattern fill
is completely full (the mask is full of 1's), it doesn't bother to
store the mask. When such a pattern is filled, the code knows just
to fill the whole thing.

Sadly, this optimisation breaks down when the cells have an X or Y
step that means there should be gaps between the instances. GS
currently fills the whole thing, gaps and all.

To fix this, we either need to fix all the different fill routines
to cope with this case, or (as I have done here), disable the
optimisation in the case when the X and Y step is larger than the
'size' of the pattern cell.

base/gxpcmap.c


2019-04-18 16:58:41 +0100
Chris Liddell <chris.liddell@artifex.com>
d86210973df93ccca0befd56afba2132da925ebc

Bug 700986: Remove the crazy md5 file copying nonsense

To preserve building as a standalone test exe, we avoided using Ghostscript
includes in the md5 source and header files, but dynamically add them to
copies of the files during the build. Since we no longer need/care for the
stand alone exe, remove the build complication, and just include the header
file normally.

base/gsmd5.h
base/lib.mak
base/md5main.c
doc/Develop.htm
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2019-04-18 14:24:04 +0100
Alexander Grahn <a.grahn@fzd.de>
a3be0c9d86981313d8724f6c29f2feaa07152976

Bug #700984 "BMC pdfmark: BMC keyword missing from content stream (patch included)"

Not sure how this has gone unnoticed for so long. The 'BMC' keyword was
missing from the emission of the content of the pdfmark. The EMC and
BDC pdfmarks seem to be OK.

Thanks to Alexander Grahn for identifying the problem and supplying a
patch to resolve it.

devices/vector/gdevpdfm.c


2019-04-18 11:18:35 +0100
Ken Sharp <ken.sharp@artifex.com>
a7cccaac16e6fc252496ab630f7423262e05756d

Fix commit d89bae568d5015144e5d68fea8221543111e119e

Commit d89bae568d5015144e5d68fea8221543111e119e contained an oversight
which unfortunately was missed due to the testing cluster being in a
state of flux.

Its possible for fonts to have a Subtype of Type1C as well as the
noted CIDFontType0C and CIDFontType1C, and we need to cater for that
as well.

This mostly affected some of the Ghent Working Group test files, and
not much else, so I've chosen just to push an addditional commit.

Resource/Init/pdf_font.ps


2019-04-17 15:53:14 +0100
Ken Sharp <ken.sharp@artifex.com>
d89bae568d5015144e5d68fea8221543111e119e

PDF interpreter - change detection of CFF CIDFont types

Bug #700982 "Error: unrecognized font file starts with <01000D02>"

The code in pdf_font.ps to detect font types, and call an appropriate
font loader works (in part) by reading the first 4 bytes from the font
stream, and then using that as the key for a dictionary where the
values are the font loading procedures.

Most font types have a 'magic number' or similar at the start of the
font data, but CFF fonts do not. In fact the header of a CFF font is
highly variable, the only thing we can rely on being the font version
byte (0x01), the remaining 3 bytes are variable.

We've tackled this previously by simply adding more different varieties
of string values, but this seems nonsensical. There are too many
possible values for this to work reliably.

Ideally I'd recode this to use the CIDFont Subtype to select the
correct font loader, but that would mean recoding all of this, which is
more work than I want to tackle in this code. Instead I've chosen to
only have one single 'tag' in the dictionary, and I've extended the code
handling the case where we don't find a tag in the dictionary.

Previously this checked to see if the first two bytes of the string
were <8001> and otherwise failed. I've modified this so that if the
bytes are not <8001> then we check the dictionary /Subtype key. If its
not present or isn't either CIDFontType0C or 1C then we still throw
an error. Otherwise we discard the string we read, replace it with the
one and only string we have stored in the font_tag_dict dictionary and
proceed.

If there is ever a version 2 of the CFF specification this will fail,
but we can add a check for the version number if that ever happens
(seems highly unlikely).

Resource/Init/pdf_font.ps


2019-04-16 09:20:44 +0100
Ken Sharp <ken.sharp@artifex.com>
cf58dd08435d89e5f205127c518595c0d7441535

Documentation - describe the ink_cov device

Following up from a question on Stack Overflow, the ink_cov device isn't
actually described anywhere. Add a description of the device and how its
output differs from the inkcov device.

At the same time, add the inkcov device(s) to the table of contents in
devices.htm and also add the bit and bbox devices which were not listed
in the TOC.

doc/Devices.htm


2019-04-15 08:25:08 +0100
Ken Sharp <ken.sharp@artifex.com>
5fa1928af0eb110115d34eb4c43bb529dda6f697

PDF interpreter - synthesise appearance for text Widget comb fields

Bug #700967 "Warning Combed form fields are not yet implemented"

Comb fields draw a string into a series of 'combs' or boxes, one
character per box. As usual there are no guidelines in the specification
as to how to draw the individual characters.

I've chosen to centre each character in the box it is draw in, because
drawing it from the origin of the box tends to cause collisions with the
vertical/horizontal lines delineating the box itself (in the one example
file I have). This may cause slightly odd appearance if a field uses
mixed upper/lower case, as the text will jump up and down vertically.

The example file supplied has a fault, one of the comb fields has a
value (/V) string which is longer than the /MaxLen value for the field.
This indicates to me a fault with the form filling application which
should not permit this. Acrobat truncates the string, I've chosen to
not render the string at all, and emit a warning on the back channel.

None of our test suite files show any differences at all; either we
don't have an examples of this kind of field already, or they all have
appearance streams.

Resource/Init/pdf_ops.ps


2019-04-12 09:53:44 +0100
Chris Liddell <chris.liddell@artifex.com>
6d8e1957175ec98443a6bc0d8c3cda6bfdced801

Bug 700968: Fix TTF Format 4 (segmented) cmap parsing

The format 4 parsing was incorrect, but in a manner only exposed by reading
an out of spec cmap.

The spec implies that the character codes in the cmap segments should be non-
overlapping, and the segments should be in order of lowest-to-highest codes.

We were imposing (*not* enforcing) that condition, but forcing the start code
of the current segment to be greater than size of the range of codes we've
already read. This, basically, has no effect on fonts that adhere correctly
to the spec.

The fonts embedded in the files for Bug 700968 do not conform to the spec. For
example, the 'Z_C00002.tmp' font has the first 92 segments in the cmap with
start code and end code both set to 33. The above imposing of the no-overlap
and order of segments meant that when we got past those first 92 segments, we
were forcibly using character codes 92 and upwards.

Removing the code imposing those conditions causes these files to render
correctly, and shows no regressions in our existing test suite.

Resource/Init/gs_ttf.ps


2019-04-11 12:16:57 -0700
Nancy Durgin <nancy.durgin@artifex.com>
adc75668cc254ead4929748fdb5ca988353f91eb

Change s_jbig2decode_release() to free the global context in some cases

Basically, if state->global_struct is NULL, it means the library should
free the global_ctx when it's done with it. This is the case when used in
gpdf (C implementation of PDF).

If the state->global_struct is non-NULL, then it is a memory-managed
value that the interpreter will eventually clean up. This is the case
when used in gs (PS implementation of PDF).

base/sjbig2.c
base/sjbig2_luratech.c


2019-04-11 08:49:14 -0700
Nancy Durgin <nancy.durgin@artifex.com>
fd3730fa8429f1ea58b2f5a5bfc1eecd3f835247

Change s_jbig2decode_set_global_data to take a separate pointer for global_ctx

This is so gpdf can pass NULL for the 'gd' pointer, since it doesn't care
about garbage collection.

base/sjbig2.c
base/sjbig2.h
base/sjbig2_luratech.c
base/sjbig2_luratech.h
psi/zfjbig2.c


2019-04-10 14:23:39 +0100
Chris Liddell <chris.liddell@artifex.com>
06c920713e11bce9bd541bbf9bf294b2ba16aee8

Bug 700952: re-introduce over/underflow workaround

Commit 355434f4b1bbe8c4f98cafad5a6868aa2f0eaae1 reverted a workaround that
compensated for over/underflow in Freetype's TTF hinting (related to freedom
and projection vector calculations). That problem no longer exists in recent
Freetype releases, and the workaround actually caused other issues to occur
with hinting.

What wasn't obvious was that the workaround also protected over/underflow
issues relating to the unitsPerEm value.

So this re-instates the workaround, but bases the decision on how the final
scale is distributing between the Freetype "size" and the Freetype matrix on
the unitsPerEm value (this is relevant for all font types as, for non-TTF,
font types, Freetype derives the unitsPerEm from the FontMatrix (for PS type
fonts).

Also fixes Bug 700875

base/fapi_ft.c


2019-04-10 14:51:12 +0100
Chris Liddell <chris.liddell@artifex.com>
35d9fc4d2a9dd85fc8497cb68389ec6eded73fcb

Update the copyright string.

base/gscdefs.h


2019-04-10 13:54:57 +0800
Sebastian Rasmussen <sebras@gmail.com>
08b91a2141df36d2f733e1822601ad06941674f2

Detect system jbig2dec library using pkg-config if available.

Otherwise fall back to traditional presence checking.

configure.ac


2019-04-10 20:06:04 +0800
Sebastian Rasmussen <sebras@gmail.com>
9f111ddc1cdb3cee329fb71e6ce4fd31c150f039

jbig2dec: Improve jbig2dec-specific gitignore.

jbig2dec/.gitignore


2019-04-10 13:48:05 +0800
Sebastian Rasmussen <sebras@gmail.com>
d72c6cdcd686a7dd0836f8a3afc4e23b5bb45144

jbig2dec: Add pkg-config file and allow for it to be installed.

jbig2dec/Makefile.am
jbig2dec/configure.ac.in
jbig2dec/jbig2dec.pc.in


2019-04-10 18:23:26 +0800
Sebastian Rasmussen <sebras@gmail.com>
300dd807b47d48b7b8368ca7b6db3db0312fa19b

jbig2dec: Check that header version matches library version.

jbig2dec/jbig2.c
jbig2dec/jbig2.h


2019-04-10 18:00:35 +0800
Sebastian Rasmussen <sebras@gmail.com>
a2f646ac8a07e7d019ddcb9e0ca2bdff1f5c740f

jbig2dec: Expose version number in header.

Since the version number should only be specified in one location,
the public jbig2dec header, autogen.sh will not regenrate the
autoconf input file configure.ac.

jbig2dec/autogen.sh
jbig2dec/config_win32.h
jbig2dec/configure.ac.in
jbig2dec/jbig2.h
jbig2dec/jbig2dec.c


2019-04-10 13:44:23 +0800
Sebastian Rasmussen <sebras@gmail.com>
90e56e3d9195f1aa19977629f2d3d3b4ec4d72cf

jbig2dec: Add empty m4 directory to silence libtool warning.

jbig2dec/Makefile.am


2019-04-10 13:40:08 +0800
Sebastian Rasmussen <sebras@gmail.com>
cb4d8dee4974e85b8c54f553520bded6fabd7b74

jbig2dec: Silence automake warning about setting CFLAGS directly.

Setting AM_CFLAGS is added to CFLAGS, adding the wanted XCFLAGS.

jbig2dec/Makefile.am


2019-04-10 13:39:05 +0800
Sebastian Rasmussen <sebras@gmail.com>
f25171c4fc2a5e7cd6bd9ab0b96a5133c038425d

jbig2dec: Silence automake warning about ar use.

jbig2dec/configure.ac


2019-03-05 18:09:20 +0800
Sebastian Rasmussen <sebras@gmail.com>
9f1959fb44a4da0506c8ef7a8cbb0ccbef4cceea

jbig2dec: Fix bug where realloc returns NULL.

jbig2dec/jbig2_image.c


2019-04-10 05:11:16 +0800
Sebastian Rasmussen <sebras@gmail.com>
67c9175c4a601a447b22e84251ec8c33ac827277

jbig2: Avoid integer overflow in custom allocator.

base/sjbig2.c


2019-04-10 05:10:29 +0800
Sebastian Rasmussen <sebras@gmail.com>
a69dd377c6f07e08ea4f895eabb974c92adccab4

jbig2: Print messages from jbig2dec, do not just count them.

base/sjbig2.c


2019-04-03 11:01:18 -0700
Ray Johnston <ray.johnston@artifex.com>
1fb3a69df53754f6a000152606f52b2f4a658b97

Fix crash reported by customer #531 with multi-threaded rendering.

This was a race condition where threads were continuing to be started
while we were tearing threads down. This doesn't occur with most usages
because we render the entire page, but with the customer's device, it
stops reading before the last line, but the multi-threading rendering
logic tried to keep starting threads (up to NumRenderingThreads) to
have later bands available.

The solution is to wait for all threads to be in the "THREAD_DONE"
state before freeing the threads.

Also, since the color_usage_array of the main thread is shared by the
rendering threads, wait until the threads are shut down before freeing
that.

base/gxclist.c
base/gxclthrd.c


2019-03-19 13:49:49 +0000
Chris Liddell <chris.liddell@artifex.com>
d9055d0a350ca7681fb8f4854ed4f1c3bf7ed570

Bring master up to date with 9.27 release branch

Product string, dates etc for 9.27 release candidate

News and changelog for 9.27 release candidate

Update product string, dates etc for 9.27 release

News/History9.htm revisions also.

base/version.mak
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Internal.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gs-vms.hlp
doc/sample_downscale_device.htm
doc/subclass.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


2019-04-04 10:44:50 +0100
Chris Liddell <chris.liddell@artifex.com>
12e31a72ffe1d2da30bf2c1976795b72ccd320b2

Update jbig2dec stuff for 0.16 release

jbig2dec/CHANGES
jbig2dec/config_win32.h
jbig2dec/configure.ac
jbig2dec/jbig2dec.1


2019-04-03 03:28:01 -0700
Robin Watts <Robin.Watts@artifex.com>
76c6de5428936c8fdb7269d7fcc31d4bdc83d745

Fix problems with "typedef struct foo_s foo;" redefinitions.

In the header revamp, I'd left various places where we
use the above formulation in more than one location. This
is fine with all the C compilers I tested it on, but seems
to update gcc 4.1.2.

This effect can be seen on later gcc's by using
"-std=gnu89 -pedantic".

This commit tweaks the code to avoid redefinitions of this
kind.

base/gsfont.h
base/gsgdata.h
base/gspath.h
base/gspenum.h
base/gxchar.h
base/gxdevcli.h
base/gxfont.h
base/gxiodev.h
base/gxpath.h
base/gxtext.h
base/lib.mak
psi/imemory.h


2019-04-03 08:37:41 +0100
Ken Sharp <ken.sharp@artifex.com>
7146b7292e27acc54d23b48472f6851ae9b51d8c

Fix PDFX_def.ps

Bug #700942

For some reason Git did a merge with this file when I made the change,
and it messed it up. Since we don't test these files, it didn't get
noticed.

lib/PDFX_def.ps


2019-04-02 10:55:27 +0100
Ken Sharp <ken.sharp@artifex.com>
2c97be9f328babb7b544ab3610e6fce05e30cdc8

pdfwrite - change the example PDF/A and PDF/X scripts

From Bug #700930 "Typo in example command for PDF/X-3 in VectorDevices.htm"

The reporter claimed that the (mis-spelled) command didn't work, which
was not surprising, since it contained a typo. After fixing the
documentation the reporter claimed that the command didn't work. This
is true and was missed because of the misleading title.

The PDFX_def.ps file was mistakenly pulling the ProcessColorModel from
systemdict, which would only be set if this was set on the command line.
The real problem is the fact that our setpagedevice/currentpagedevice
code doesn't truly reflect the device setup, so changes to the
ProcessColorModel caused by setting ColorConversionStrategy are not
reflected in the values returned by currentpagedevice.

This commit updates PDFX_def.ps to chaeck the ColorConversionStrategy
instead, which is more reliable, and then use the ProcessColorModel
from the currentpagedevice as a fallback if ColorConversionStrategy
is not set. (actually this should not be possible)

Update PDFA_def.ps similarly; although it was using the currentpagedvice
this is not a reliable method.

Finally; reformat the files, add some extra comments describing what the
code is doing, make it clearer that these files *should* be customised
and add additional some basic instruction on customising them.

lib/PDFA_def.ps
lib/PDFX_def.ps


2019-04-02 08:26:09 +0100
Ken Sharp <ken.sharp@artifex.com>
978b03b453245c2a48abaee5addea3b7e025a2ed

Fix another typo.

HTML is annoyingly impossible to spell-check :-(

doc/VectorDevices.htm


2019-04-01 16:15:21 +0100
Ken Sharp <ken.sharp@artifex.com>
2983be3f871e480b6567f5ce5c16206a026851fe

PS interpreter - prevent user code overriding some commad line switches

Bug #700935 "defining BATCH causes typecheck in ifelse"

A (surprisingly large) number of command line switches are checked at
various points in gs_init.ps, but use the 'current' definition of the
key, rather than explicitly checking systemdict, which is where the
command line controls are stored.

This meant that user code could (deliberately or accidentally) override
the system definition and cause errors or unexpected behaviour.

Resource/Init/gs_init.ps


2019-04-01 16:12:33 +0100
Ken Sharp <ken.sharp@artifex.com>
34a94a5d72f8a339cad4c2e2140519c33b58de79

tiffsep devices - add TIFFDateTime to get_params

We need to add this parameter to both put_params and get_params, or it
will not work properly.

devices/gdevtsep.c


2019-04-01 13:30:57 +0100
Ken Sharp <ken.sharp@artifex.com>
87e4b35c9fc15434d710f86aa265501cad61c34f

Tiff devices - Honour the TIFFDateTime parameter

The TIFFDateTime switch can be used to disable writing the date and
time into the tags of TIFF files. However, the tiffg3, tiffg4, tiffsep
and tiffsep1 devices weren't honouring the parameter.

I believe this also affected the tiff32 and tiff8 devices, all the
tiffscaled devices and teh tiffcrle device.

Although gdevtfax.c read the parameter, it didn't transfer it to the
devcie structure. The tiffsep and tiffsep1 devices didn't even read it.

I can't help thinking that having our tiff support spread over 19
different devices and 3 source files

devices/gdevtfax.c
devices/gdevtsep.c


2019-04-01 10:58:11 +0100
Ken Sharp <ken.sharp@artifex.com>
b987c511229ba0b70e6a7691366d530fa8db7444

pdfwrite - completely remove the old colour management

Also remove all references (I hope) from the documentation.

While we're changing the docs, remove references to ps2pdf where we are
really referring to pdfwrite, rewrite the information on LZW Encoding,
update the 'Opitimize' distiller param note, add some covering words
about the faxt that pdfwrite doesn't permit the full range of options
in the LCMS2 implementation that rendering devices do, note that the
example PDFX_def.ps needs to be modified (cribbed from PDF/A).

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


2019-04-01 08:20:52 +0100
Ken Sharp <ken.sharp@artifex.com>
f5bd9757cffeb8b173cdde161b39abd381e325c3

Documentation changes

Bug #700930 "Ghostscript - Typo in example command for PDF/X-3 in VectorDevices.htm"

doc/VectorDevices.htm
lib/PDFX_def.ps


2019-03-29 15:43:14 +0000
Robin Watts <Robin.Watts@artifex.com>
086390943b223cd726d7f63ad076b48e57ceae0f

Fix Downscaler ETS brokenness.

We are only supposed to use ETS if requested. We pass in a flag to
say whether to use it - probably best, on balance, not to ignore it.

base/gxdownscale.c


2019-03-28 10:36:53 +0000
Chris Liddell <chris.liddell@artifex.com>
3929dbaed570ba58cccbf600ba58158ab4fafd8a

Revise gs.c to use the gsapi API.

It's probably better if our own code reflects the way we recommend others to
code.

psi/gs.c


2019-03-28 09:21:37 +0000
Chris Liddell <chris.liddell@artifex.com>
a87c116174ef574465ab12493ef6d0c575bda60d

Fix sefault with 'so' build.

The loaders were passing an unitialise pointer into gsapi_new_instance()
meaning we might try to dereference the pointer to get to the shared portion
of the library context.

Initialise the pointer to NULL.

Apply the same fix to everywhere that uses gsapi_new_instance.

pcl/pl/plwmainc.c
pcl/pl/realmain.c
psi/apitest.c
psi/dmmain.c
psi/dpmain.c
psi/dwmain.c
psi/dwmainc.c
psi/dxmain.c
psi/dxmainc.c
toolbin/halftone/gen_stochastic/gen_stochastic.c


2019-03-27 14:41:13 +0000
Chris Liddell <chris.liddell@artifex.com>
9723b898561c3cd7b9f207c9976994671940df56

Update thirdparty.htm: Freetype and jbig2dec versions

doc/thirdparty.htm


2019-03-27 08:08:04 +0000
Chris Liddell <chris.liddell@artifex.com>
a21912a4c7c2a0cbc79c1a86df77b63bcae850fb

Add license file for cups/libcups

cups/LICENSE.txt


2019-03-26 16:26:11 +0000
Ken Sharp <ken.sharp@artifex.com>
cdd481e5406b8fd07f0cc9b771adfd6877028d96

Fix valgrind error with PXL patterns and high level devices

Bug #700573 " Uninitialised colors used in path plotting"

When the current colour space is a pattern, and the saved high level
colour space is also a pattern, we were checking every possible
component of ccolor.paint.values in both spaces against each other.

The problem is that in gx_hld_save_color we set almost all the values to
0, but then copy a single uninitialised value into the 0th index.

This leads to a valgrind error. Henry points out that the PostScript
interpreter has a hack specifically to work around this in zcolor.c,
zsetcolor() at around line 313.

This is wasteful, its far better (IMO) to rearrange the logic in
gx_hld_saved_color_equal(), we already bail out early if the colour
spaces are not equal. If the spaces are patterns, then there's no point
in comparing the device components, instead compare the pattern IDs
*before* we compare the device components, if they are the same then
return true, if they are different return false.

This avoids us having to check 2 sets of 64 values, and also avoids us
having to set 64 values every time we create a pattern.

base/gxhldevc.c
psi/zcolor.c


2019-03-26 15:14:49 +0000
Chris Liddell <chris.liddell@artifex.com>
519326a98c1d2172da280305fef0a3a52ddc65bc

Tweak the pcl/LICENSE to make a little more sense

It hadn't been revised really for the "new" directory structure.

It will probably benefit from a more substantial revisit, but for now, this
makes it less confusing.

pcl/LICENSE


2019-03-26 09:23:56 +0000
Chris Liddell <chris.liddell@artifex.com>
db96dc02a83e45d2997315e52e77cb4c283c09ce

Reword the 'greeting' to reflect the open source license.

Resource/Init/gs_init.ps


2019-03-26 09:13:42 +0000
Chris Liddell <chris.liddell@artifex.com>
0371b3cef0e28fa603437faf983c7be8f2160214

Fix 'greeting' and include COPYING in install

The greeting message still referenced the obsolete 'PUBLIC' file. And
doc/COPYING was missing from the list of files for install.

Resource/Init/gs_init.ps
base/unixinst.mak


2019-03-26 10:51:36 +0000
Chris Liddell <chris.liddell@artifex.com>
686204e73479a5fde722ca00a851cfb7f0d4186a

Bug 700897: fix validation of -M and -N parameters.

psi/imainarg.c


2019-03-25 19:35:07 -0700
Michael Vrhel <michael.vrhel@artifex.com>
81d801a07450227eee573aac5fc9259862b4a568

Fix tiffsep_cmyk_cs_to_cm in tiffsep device

When we were doing just a single or a couple spot colorants using something like
-c "<< /SeparationColorNames [(Pantone 137 CVU)] /SeparationOrder [(Pantone 137 CVU)]>>
setpagedevice" the colorants mappings were not getting properly cleared by
tiffsep_cmyk_cs_to_cm causing fillpage to not clear out the page.

devices/gdevtsep.c


2019-03-25 09:01:51 +0000
Ken Sharp <ken.sharp@artifex.com>
c70dc7911aaf559eeec0ced48f8504e24ba39b8a

Coverity ID 337243 - remove dead code

devices/vector/gdevpdfp.c


2019-03-23 10:29:59 +0000
Ken Sharp <ken.sharp@artifex.com>
4dc1cb5197292f3fa7548353c4208f507ca3b310

Another trailing white space fix

base/gdevp14.c


2019-03-23 10:26:29 +0000
Ken Sharp <ken.sharp@artifex.com>
8946e4418257a99ea029283405bc23b75a02e0a5

PDF Interpreter - fix leading and trailing white spaces in pdf_draw.ps

Commit 09c656e066777bd69bbd1902e6163fe3a8a39406 included some
leading and trailing white spaces.

Resource/Init/pdf_draw.ps


2019-03-20 13:55:54 +0000
Chris Liddell <chris.liddell@artifex.com>
f1fccd62b5d1010ecec2817b1b67f3b74b145d02

tiffscaled: correctly select the downscaler when using ETS

When tiffscaled uses ETS for the halftoning, and it's downscaling, we have to
select the downscaling "core" based on the factor.

base/gxdownscale.c


2019-03-19 17:49:14 +0100
Knut Petersen <knut_petersen@t-online.de>
eec855c9baeaa73c0208ed439fbbf1a0d48a447e

Fix e005c87e09f67f37ce4ae2f80f24cf9182e86d8d

Signed-off-by: Knut Petersen <knut_petersen@t-online.de>

Resource/Init/pdf_font.ps


2019-03-19 10:06:38 -0700
Michael Vrhel <michael.vrhel@artifex.com>
2d67148ab19d5e278ec4dbe9929839a37f9961b7

Bug 700744 Documentation typo.

doc/GS9_Color_Management.pdf
doc/GS9_Color_Management.tex


2019-03-19 08:32:46 -0700
Michael Vrhel <michael.vrhel@artifex.com>
09c656e066777bd69bbd1902e6163fe3a8a39406

Bug 700686 Matte premultiplied images

The undoing of the matte pre-blend must occur in the image color space. As such
the group that the interpreter pushes must be that color space and we must make sure
that we undo the pre-blend before any conversions for the group color space.

Resource/Init/pdf_draw.ps
base/gdevp14.c
base/gxblend.c
base/gxblend.h


2019-03-19 09:25:48 -0700
Ray Johnston <ray.johnston@artifex.com>
db24f253409d5d085c2760c814c3e1d3fa2dac59

Fix lib/pdf2dsc.ps to use documented Ghostscript pdf procedures.

We eliminated GS_PDF_ProcSet and pdfdict, but runpdfbegin, dopdfpages,
and runpdfend are still available.

lib/pdf2dsc.ps


2019-03-19 08:34:05 -0700
Ray Johnston <ray.johnston@artifex.com>
332c74c6ffe84acfc0fa80a99f6590a4be9f561b

Fix bug 700719: SEGV with very large XStep/YStep and transparent patterns.

At high resolutions, the bonkers XStep/YStep for the pattern could confuse
the tile_by_steps_trans logic, and could overflow a 32-bit signed int causing
a sign flip. Protect from this by checking to make sure we only fill within
the fill_trans_buffer->rect.

base/gxp1fill.c


2019-03-19 14:35:43 +0000
Ken Sharp <ken.sharp@artifex.com>
c5b92cc2dc9a20c8b6ba204f1e5a5e292bc53846

Fix FillOrder tag for the TiffG3 and TiffG4 devices

Bug #700255 "Option FillOrder doesn't work anymore"

Commit 0ef309305417776a9f8b8cd143fbf3c5e89456b2 added the FillOrder
switch to the 'tiff' class of devices, but the fax Tiff devices already
processed that switch, and the commit did not remove the processing
from those devices.

This led to us trying to us ending up with the parameter in the params
list twice when we executed get_params (once from the tiff device
processing and once from the tiff fax device processing).

When we then next execute a 'put_param', the list has a duplicate
entry for FillOrder. We stop processing when we find the first entry,
which means the second entry never gets processed, leading to an
unused entry in the list, and that throws an error.

The simplest way to fix this is to remove the duplicate 'get_param()'
processing from the tiff fax devices, leaving it up to the generic
Tiff device.

devices/gdevtfax.c


2019-03-19 13:12:25 +0000
Chris Liddell <chris.liddell@artifex.com>
5eebbe1be2b097e541b14fecbd5a154c2cba1519

Bump version number for release

Resource/Init/gs_init.ps
base/version.mak



Changelog

2019-04-03 09:27:46 +0100

2019-04-03 09:27:46 +0100
Chris Liddell <chris.liddell@artifex.com>
ef23f2457ff6c215d99189a0f78bf28f42d5f98c

Update product string, dates etc for 9.27 release

News/History9.htm revisions also.

base/gscdefs.h
base/version.mak
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Internal.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gs-vms.hlp
doc/sample_downscale_device.htm
doc/subclass.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


2019-03-19 14:53:24 +0000
Chris Liddell <chris.liddell@artifex.com>
5c3344f40f95c4c8fd806265e4e6191d98e06be5

News and changelog for 9.27 release candidate

doc/History9.htm
doc/News.htm


2019-03-19 13:49:49 +0000
Chris Liddell <chris.liddell@artifex.com>
0e3084881a3f2b40ed17a9f71713304bcbf5c976

Product string, dates etc for 9.27 release candidate

base/gscdefs.h
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Internal.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gs-vms.hlp
doc/sample_downscale_device.htm
doc/subclass.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


2019-04-03 03:28:01 -0700
Robin Watts <Robin.Watts@artifex.com>
d832f46edd65968e795f5f419107eb33a7a3e09f

Fix problems with "typedef struct foo_s foo;" redefinitions.

In the header revamp, I'd left various places where we
use the above formulation in more than one location. This
is fine with all the C compilers I tested it on, but seems
to update gcc 4.1.2.

This effect can be seen on later gcc's by using
"-std=gnu89 -pedantic".

This commit tweaks the code to avoid redefinitions of this
kind.

base/gsfont.h
base/gsgdata.h
base/gspath.h
base/gspenum.h
base/gxchar.h
base/gxdevcli.h
base/gxfont.h
base/gxiodev.h
base/gxpath.h
base/gxtext.h
base/lib.mak
psi/imemory.h


2019-03-29 15:43:14 +0000
Robin Watts <Robin.Watts@artifex.com>
0750e5fa1e3c988f07d3fb5adedfb0896e7b400c

Fix Downscaler ETS brokenness.

We are only supposed to use ETS if requested. We pass in a flag to
say whether to use it - probably best, on balance, not to ignore it.

base/gxdownscale.c


2019-03-28 09:21:37 +0000
Chris Liddell <chris.liddell@artifex.com>
1f602898555e969542760ac86b4e250c411e9f8c

Fix sefault with 'so' build.

The loaders were passing an unitialise pointer into gsapi_new_instance()
meaning we might try to dereference the pointer to get to the shared portion
of the library context.

Initialise the pointer to NULL.

Apply the same fix to everywhere that uses gsapi_new_instance.

pcl/pl/plwmainc.c
pcl/pl/realmain.c
psi/apitest.c
psi/dmmain.c
psi/dpmain.c
psi/dwmain.c
psi/dwmainc.c
psi/dxmain.c
psi/dxmainc.c
toolbin/halftone/gen_stochastic/gen_stochastic.c


2019-03-27 14:41:13 +0000
Chris Liddell <chris.liddell@artifex.com>
4be4e4195c88d195502e3e093f0177534af0439c

Update thirdparty.htm: Freetype and jbig2dec versions

doc/thirdparty.htm


2019-03-27 08:08:04 +0000
Chris Liddell <chris.liddell@artifex.com>
6d6a868110e7b1258f6586593f4e6405a1b0dcc3

Add license file for cups/libcups

cups/LICENSE.txt


2019-03-26 15:14:49 +0000
Chris Liddell <chris.liddell@artifex.com>
10eddb8d2b327bfb78c23863577a80b40860f920

Tweak the pcl/LICENSE to make a little more sense

It hadn't been revised really for the "new" directory structure.

It will probably benefit from a more substantial revisit, but for now, this
makes it less confusing.

pcl/LICENSE


2019-03-26 09:23:56 +0000
Chris Liddell <chris.liddell@artifex.com>
bb161b7be76b71a99cb1761bcea7b9c13cf987fb

Reword the 'greeting' to reflect the open source license.

Resource/Init/gs_init.ps


2019-03-26 09:13:42 +0000
Chris Liddell <chris.liddell@artifex.com>
076c127d2a1d697d9d02cf6bce70f5a692e11846

Fix 'greeting' and include COPYING in install

The greeting message still referenced the obsolete 'PUBLIC' file. And
doc/COPYING was missing from the list of files for install.

Resource/Init/gs_init.ps
base/unixinst.mak


2019-03-26 10:51:36 +0000
Chris Liddell <chris.liddell@artifex.com>
6cc71a794e784887fc7d41ebd87473e7a065e87d

Bug 700897: fix validation of -M and -N parameters.

psi/imainarg.c


2019-03-25 19:35:07 -0700
Michael Vrhel <michael.vrhel@artifex.com>
f53e124de64baf9306ee55e5fda46d77091ad176

Fix tiffsep_cmyk_cs_to_cm in tiffsep device

When we were doing just a single or a couple spot colorants using something like
-c "<< /SeparationColorNames [(Pantone 137 CVU)] /SeparationOrder [(Pantone 137 CVU)]>>
setpagedevice" the colorants mappings were not getting properly cleared by
tiffsep_cmyk_cs_to_cm causing fillpage to not clear out the page.

devices/gdevtsep.c


2019-03-25 09:01:51 +0000
Ken Sharp <ken.sharp@artifex.com>
76ada9e73edaf0cf661f5af85d58580caae9f882

Coverity ID 337243 - remove dead code

devices/vector/gdevpdfp.c


2019-03-23 10:29:59 +0000
Ken Sharp <ken.sharp@artifex.com>
06ed92ab4efddaea02069b2411aef401f8c7e5ce

Another trailing white space fix

base/gdevp14.c


2019-03-23 10:26:29 +0000
Ken Sharp <ken.sharp@artifex.com>
c7de4cdfeda7916359303ad0731752918835a876

PDF Interpreter - fix leading and trailing white spaces in pdf_draw.ps

Commit 09c656e066777bd69bbd1902e6163fe3a8a39406 included some
leading and trailing white spaces.

Resource/Init/pdf_draw.ps


2019-03-21 16:42:06 +0000
Chris Liddell <chris.liddell@artifex.com>
7e0a16411957a2809d61be966af6c08c9a735d84

Revert "Update psd devices to only do one pass while rendering."

This reverts commit d2d32bcee1cb1b28494ba9b572afa53ef84391af.

Experiment for release testing.

devices/gdevpsd.c


2019-03-20 13:55:54 +0000
Chris Liddell <chris.liddell@artifex.com>
3c981b6987fb6a30c1911aaa3aeb6535ce92882c

tiffscaled: correctly select the downscaler when using ETS

When tiffscaled uses ETS for the halftoning, and it's downscaling, we have to
select the downscaling "core" based on the factor.

base/gxdownscale.c


2019-03-19 17:49:14 +0100
Knut Petersen <knut_petersen@t-online.de>
2e866aca0186d8847512686b80b2eca12988ba3f

Fix e005c87e09f67f37ce4ae2f80f24cf9182e86d8d

Signed-off-by: Knut Petersen <knut_petersen@t-online.de>

Resource/Init/pdf_font.ps


2019-03-19 10:06:38 -0700
Michael Vrhel <michael.vrhel@artifex.com>
d66449d30e13b4a5d71559d373ab00985b0bd3c1

Bug 700744 Documentation typo.

doc/GS9_Color_Management.pdf
doc/GS9_Color_Management.tex


2019-03-19 08:32:46 -0700
Michael Vrhel <michael.vrhel@artifex.com>
20de9c4570bc556505069ff91c121cfb3d2f5984

Bug 700686 Matte premultiplied images

The undoing of the matte pre-blend must occur in the image color space. As such
the group that the interpreter pushes must be that color space and we must make sure
that we undo the pre-blend before any conversions for the group color space.

Resource/Init/pdf_draw.ps
base/gdevp14.c
base/gxblend.c
base/gxblend.h


2019-03-19 09:25:48 -0700
Ray Johnston <ray.johnston@artifex.com>
ebbb3ec7d20b5f4c444eb11fc9835e07229ccbd9

Fix lib/pdf2dsc.ps to use documented Ghostscript pdf procedures.

We eliminated GS_PDF_ProcSet and pdfdict, but runpdfbegin, dopdfpages,
and runpdfend are still available.

lib/pdf2dsc.ps


2019-03-19 08:34:05 -0700
Ray Johnston <ray.johnston@artifex.com>
52b4d7918e5792e1fb040f1ba72bd71b9f9ec0a9

Fix bug 700719: SEGV with very large XStep/YStep and transparent patterns.

At high resolutions, the bonkers XStep/YStep for the pattern could confuse
the tile_by_steps_trans logic, and could overflow a 32-bit signed int causing
a sign flip. Protect from this by checking to make sure we only fill within
the fill_trans_buffer->rect.

base/gxp1fill.c


2019-03-19 14:35:43 +0000
Ken Sharp <ken.sharp@artifex.com>
e0e9e32357debd5610bca37a804f1bde62f77844

Fix FillOrder tag for the TiffG3 and TiffG4 devices

Bug #700255 "Option FillOrder doesn't work anymore"

Commit 0ef309305417776a9f8b8cd143fbf3c5e89456b2 added the FillOrder
switch to the 'tiff' class of devices, but the fax Tiff devices already
processed that switch, and the commit did not remove the processing
from those devices.

This led to us trying to us ending up with the parameter in the params
list twice when we executed get_params (once from the tiff device
processing and once from the tiff fax device processing).

When we then next execute a 'put_param', the list has a duplicate
entry for FillOrder. We stop processing when we find the first entry,
which means the second entry never gets processed, leading to an
unused entry in the list, and that throws an error.

The simplest way to fix this is to remove the duplicate 'get_param()'
processing from the tiff fax devices, leaving it up to the generic
Tiff device.

devices/gdevtfax.c



Chris Liddell <chris.liddell@artifex.com>
2e843b2dd9a6ae935c9e00ba127302123cb9121e

Bug 700815(2): Fix the end-of-data condition.

The end-of-data condition in the charstring interpreter that checks for SEACs
was allowing an extra byte to read off the end of the string.

In addition, we also want to handle the out-of-data condition for a (g)subr
gracefully.

base/gxtype1.c


2019-03-19 08:53:10 +0000
Chris Liddell <chris.liddell@artifex.com>
b66ebe07ae5c1fb4ef94f9051e537d69eb789896

Bug 700815(1): Init gsubrNumberBias in Type 1 fonts and eexec decoder

The gsubrNumberBias is only used for Type 2 fonts, but the structure and
charstring interpreter are shared between Type 1 and 2 fonts, so we still need
to set gsubrNumberBias for Type 1 fonts (always 0 for Type 1).

Secondly, full initialise the eexec decoder state, along with some stack
variables during eexec decode setup.

This fixes most of the valgrind errors in Bug 700815, but not all.

psi/zfont1.c
psi/zmisc1.c


2019-03-18 10:45:12 +0000
Chris Liddell <chris.liddell@artifex.com>
e005c87e09f67f37ce4ae2f80f24cf9182e86d8d

Bug 700678: Check for embedded font when substituting

When we apply a font name mapping, make sure that the ultimate font we load
comes from disk, and is not embedded in the job.

To aid differentiating between a substitute CIDfont (cidfmap), a "real" CIDFont
resource, and an embedded CIDFont, add a /ResourcePath key to CIDFont resource
dictionaries (susbsitute CIDFonts contain /Path key).

Resource/Init/gs_cidfn.ps
Resource/Init/pdf_font.ps


2015-11-29 08:10:37 -0600
Chris Liddell <chris.liddell@artifex.com>
5edf847476e7a3e342422013283f984e38b52cd9

Bug 695903: Augment fontmap syntax to allow TTCs to work 'properly'.

Support dictionary entries in Fontmap, so a fontmap file can contain a map to
specific fonts in a TTC.

The romfs inlines the fontmap definitions, and ends up parsing them before
we've bootstrapped the Level 2 world properly so the '<<...>>' dictionary
syntax not only is not defined but also cannot even be parsed.

So, temporarily enable Level 2 parsing, and include local definitions of the
names '<<' and '>>' to work as you'd expect.

Resource/Init/Fontmap.GS
Resource/Init/gs_fonts.ps
Resource/Init/gs_res.ps
Resource/Init/gs_ttf.ps


2019-03-19 09:18:09 +0000
Ken Sharp <ken.sharp@artifex.com>
6a49a201c82106e97148553a8394b74e6c656858

PDF interpreter - fix commit 33414cb5930ee715a23b75eb37e919b6f15f96c0

There was a logical error in the prior commit which caused all PDF files
with a /Info dictionary to signal an error.

This rearranges the code to have the correct logic flow, properly
producing an error only for the broken specimen file.

Resource/Init/pdf_main.ps


2019-03-18 19:30:43 +0000
Ken Sharp <ken.sharp@artifex.com>
33414cb5930ee715a23b75eb37e919b6f15f96c0

PDF interpreter - check the type of the Info dictionary before use


Bug #700820 " GPL Ghostscript 9.26: Unrecoverable error, exit code 1"

The problem here is that the trailer dictionary has an entry for the
/Info dictionary, but the object it poitns to is not a dictionary.

For most purposes this doesn't matter, but when the devce is pdfwrite
we try to maintain the information in that dictionary.

This commit tests the type of the object referenced by the key in the
trailer dictionary and if the object isn't a dictionary we don't try to
use it. We do flag an error though.

Resource/Init/pdf_main.ps


2019-03-18 11:54:40 +0000
Ken Sharp <ken.sharp@artifex.com>
b4e343d201e337478973824995c0bbc25955b36e

Silence a compiler warning

This is actually a false positive, the code is:

if ((code = glyph_show_setup(i_ctx_p, &glyph)) != 0)
return code;
if ((code = gs_glyphshow_begin(igs, glyph, imemory_local, &penum)) < 0)
return code;

and the warning is against gs_glyphshow_begin. However glyph is actually
initalised in the line above by glyph_show_setup. There are paths to
exit that routine without setting glyph, but they all return non-zero
exit codes.

I suspect the return macros in glyph_show_setup and co are confusing
the compiler.

To silence the compiler warning, simply initialise the variable.

psi/zcharx.c


2019-03-18 11:13:51 +0000
Ken Sharp <ken.sharp@artifex.com>
9b11ad14c36103f3446680efa71d25a216177ccd

Initialise another variabel to silence valgrind

Following on from 086d30c38cb351e95941a950ddadd300e23cd8a4

The last.count member gets tested in pdfmark_adjust_parent_count, even
when last.id is 0, so we need to initialise that too.

devices/vector/gdevpdfm.c


2019-03-18 10:14:48 +0000
Ken Sharp <ken.sharp@artifex.com>
086d30c38cb351e95941a950ddadd300e23cd8a4

pdfwrite - don't write an incomplete Outline entry

Bug #700816 "Valgrind shows problems with pdfmarks"

The file in question has a recursive Outline entry, which eventually
leads to an execstackoverflow. This causes the pdfwrite device to be
closed, which leads to it closing and writing the Outkine tree as part
of the cleanup. Because of the way the /OUT pdfmark works, this means
there is a dangling reference (because the last /OUT pdfmark had a
child, but we haven't yet received the child data).


There was in fact already code to deal with this, and not write out
the final outline entry. However it relied upon an uninitialised value
being 0, which of course it usually isn't.

Fixed by initialising the value to 0, which should avoid the valgrind
warning, and prevents us writing an invalid Outline tree entry as well.

devices/vector/gdevpdfm.c


2019-03-18 09:47:35 +0000
Ken Sharp <ken.sharp@artifex.com>
1f30baee070ea9da1de1cb479e3a5c49c0514267

Check error codes for configuration errors with the pdfwrite family

Bug #800819 "Incorrect parameter value for sColorConversionStrategy is silently ignored."

The low level parameter checking for the pdfwrite family wasn't
honouring error returns from certain kinds of parameters, most notably
those involving lists of permitted values (eg ColorConversionStrategy)

This commit throws an error for those cases.

This causes one file in the regression test suite 'pt.ps' to throw an
error with the ps2write device. This is because the PostScript program
contains an invocation of setdistillerparams which sets the
ColorImageFilter (and GrayImageFilter) to Flate instead of DCT. Level 2
PostScript doesn't include the Flate filter, that is a level 3 addition
so we now throw an error on that file.

devices/vector/gdevpdfp.c
devices/vector/gdevpsdp.c


2019-03-14 15:21:40 -0700
Nancy Durgin <nancy.durgin@artifex.com>
03019418e745d215beeea1c5b141524eec8346eb

Alternate way to process that whitelist at end of scanner.

This version doesn't assume there is a --oper-- form on the list, so
it works with "functions" (procedures) that as well as with operators.

toolbin/scan_ps_dicts.ps


2019-03-14 14:17:41 -0700
Nancy Durgin <nancy.durgin@artifex.com>
4163949fa861188f647b7106e181a8121522012f

Make sure all references to .sort are executeonly so it can be undef'd

.findfontvalue and .loadttfonttables still had some references

Note: .sort is currently only undef'd in SAFER mode

Resource/Init/gs_ttf.ps


2019-03-14 14:13:15 -0700
Nancy Durgin <nancy.durgin@artifex.com>
d2f3830b364788a88ea6233f8255cc507f483048

Add a bunch of extensions to whitelist

Also, the logic for "functions", which don't have the --oper-- form
on the whitelist, is currently broken, so just put everything
on the operator list until that's sorted (if ever).

toolbin/scan_ps_dicts.ps


2019-03-14 09:40:18 -0700
Nancy Durgin <nancy.durgin@artifex.com>
40c5fae8604fb6f7916beed8b5c5081e29da8cef

Remove some code that was checking for .setglobal to be defined

.setglobal, .currentglobal and .gsheck are all defined in psi/zvmem2.c
This code seems to be leftover from a time when that might not have been
the case, but it's unnecessary and confusing now. The comment in the
C code indicates they are always defined even for language level 1.

Resource/Init/gs_init.ps


2019-03-14 08:57:11 -0700
Nancy Durgin <nancy.durgin@artifex.com>
5503e225ade2de26fd9e41e63cd3d26b14c3878b

Whitelist some more operators that are in the PLRM

Not sure why the Ray's automated extraction didn't pick these up?

toolbin/scan_ps_dicts.ps


2019-03-13 14:53:41 -0700
Nancy Durgin <nancy.durgin@artifex.com>
fbcda19eb6c8cdba96a6315dfb6f8d241c667259

Remove UserObjects from whitelist

This is in the PLRM, but it's not an operator and it's not going to
show up in the scan unless 'defineuserobject' has previously been run.

toolbin/scan_ps_dicts.ps


2019-03-13 08:51:06 -0700
Nancy Durgin <nancy.durgin@artifex.com>
ad63987d8d4395423513e55008f6ecdcd31f9f26

Move .makeoperator docs from Language.htm to Internal.htm.
It is now an internal operator

Remove it from whitelist in scan_ps_dicts.ps

This has already been undef'd (after initialization), just fixing the
documentation.

This commit also adds a new "Internal.htm" documentation file, and
hopefully fixes up the links to it in Readme.htm

doc/Internal.htm
doc/Language.htm
doc/Readme.htm
toolbin/scan_ps_dicts.ps


2019-03-13 15:18:57 +0000
Ken Sharp <ken.sharp@artifex.com>
c633d492cef7de24dafcecceb6efca982b1ad8be

Coverity IDs 279970 and 279971

Add some casts to prevent implicit casting promoting unsigned values to
signed values.

Moost places had already been handled, but three had been missed.

devices/gdevdsp.c


2019-03-13 14:25:47 +0000
Ken Sharp <ken.sharp@artifex.com>
58e490fec4909b18151e25bd55c9e9f91512a007

Fix (non-PostScript) processing of -d switch with radix

The -d switch can take a radix as part of the value assigned to a
named switch. For example -dDisplayFormat=16#20808 is described in the
display device documentation as selecting CMYK rendering.

The implementation in plmain.c was completely broken and returned the
error "Malformed base value for radix" for any switch using '#'.

The first problem is that we increment the pointer 'v' after checking
'c' to see if its a number. That means when its not a number (ie #) we
have moved v on past the # character. So the test for *v being '#'
fails.

Later we use 'val' which has been initialised to the '#' symbol in the
string. We check to see its a number or A->F or a->f and if its not
then we throw an error. Of course its initially pointing at '#' so
it fails immediately.

pcl/pl/plmain.c


2019-03-08 11:51:31 -0800
Ray Johnston <ray.johnston@artifex.com>
9da9391c8f0a1414be45201c79e5cc649a125341

Add "print" operator to whitelist in scan_ps_dicts.ps

toolbin/scan_ps_dicts.ps


2019-03-08 11:40:28 -0800
Ray Johnston <ray.johnston@artifex.com>
805ca20a78cd837b5d6a30ad7d0df0828aa5de38

Add final section that reports any whitelisted operators that are not seen.

By setting the whitelist entry to //false initially, and the //true when
the operator is encountered in the scan, we can report elements that are in
the whitelist that probably don't need to be there (they've already been
undef'ed).

Also for operators, since they may be encountered in a dict in "bare" form,
or may be seen in packedarray procedures with "--" in front and back, we
check for either having been encountered by pulling out the "bare" form
and checking if that whitelist entry has been seen.

toolbin/scan_ps_dicts.ps


2019-03-11 08:16:47 -0600
Henry Stiles <henry.stiles@artifex.com>
8bc9b0e335b0b69d5b174835a92270903c1dd830

Fix Bug #700575 valgrind problem with decode_char.

Previously PCL stored the character code when encoding and returned it
upon decode. This was only implemented properly for TrueType fonts,
ie. Intellifont or bitmap fonts did not set the character which
resulted in an unitialized read. Ostensibly (for PCL/XL) high level
devices pass the character back upon decode, so it is only necessary
to return the passed in value and we can dispense with storing the
last character.

pcl/pl/plchar.c
pcl/pl/plfont.c
pcl/pl/plfont.h


2019-03-11 08:32:15 +0000
Ken Sharp <ken.sharp@artifex.com>
b881341b3d9993d88a1b395b552f28e62d0abc20

Fix a typo in an error message

Reported by Michael Witten via email. There was a typo in the error
message when the number of entries in an xref table didn't match the
value associated with the /Size key in the trailer dictionary.

Resource/Init/pdf_main.ps


2019-03-08 11:55:27 +0000
Ken Sharp <ken.sharp@artifex.com>
6deec5bffda4b7b3e2f7daa4801150e469b4be95

reformat a conditional to avoid a compiler warning

gcc was giving a false warning on 'glyph' being used uninitialised,
which is not (I believe) the case. I could fix it by initialising the
variable, but instead lets remove the annoying multiple calls in an if
clause.

I'm not certain this will silence the warning.

psi/zcharx.c


2019-03-07 16:51:04 +0000
Chris Liddell <chris.liddell@artifex.com>
3c8bc1663619afa6dcf74c287801408508c504b1

Bug 700701: stack cleanup for all 'show' operator family.

The exec stack cleanup done in 'show' needs applied to all the other similar
operators.

psi/zchar.c


2019-03-07 13:39:58 -0800
Nancy Durgin <nancy.durgin@artifex.com>
32258b5f0fe0db14142a6487c46121afa65c2538

Add 'min' and 'max' back in

These are harmless and redundant, but they have been around a long
time and are documented in Language.htm, so it seems better to keep
them than to break stuff.

Internal code all uses .min and .max instead, so yes there are two
versions of the same thing...

Resource/Init/gs_init.ps


2019-03-07 13:28:29 -0800
Nancy Durgin <nancy.durgin@artifex.com>
9f811276ed9eb29a1dc8284159a2995e9be4dabf

Fix the test for which whitelisted operators were found, to check boolean

toolbin/scan_ps_dicts.ps


2019-03-07 11:07:30 -0800
Ray Johnston <ray.johnston@artifex.com>
3d3e0f2788fd3403bf5ac8d31b732f1404cca4aa

Add a check to scan_ps_dicts.ps to report whitelist entries that aren't found.

toolbin/scan_ps_dicts.ps


2019-03-07 12:38:33 -0800
Nancy Durgin <nancy.durgin@artifex.com>
9a835217e1f61272f8830eac643f689ba041902e

Change to use a list of operator/function names and add to dict later

- can break out the lists by category (standard vs extensions)
- adds the "--" around operators dynamically
- can put non-operators (functions) in a separate list if desired
- changed the value in the dict to //false

toolbin/scan_ps_dicts.ps


2019-03-07 10:29:17 -0800
Nancy Durgin <nancy.durgin@artifex.com>
9302928bf518f3ce3e739f1ea428e5f82729d7d9

Undef .pdfcharkeys in gs_ttf.ps

Change references to immediate evaluation and undef at end of file

Resource/Init/gs_ttf.ps


2019-03-07 10:29:01 -0800
Nancy Durgin <nancy.durgin@artifex.com>
36e629576399a596b930878dad0438f9c9a19dd6

Add some ghostscript extensions to whitelist

toolbin/scan_ps_dicts.ps


2019-03-07 08:30:38 -0800
Nancy Durgin <nancy.durgin@artifex.com>
ccf0be61013372c4c449f0b760fa00ac0b20245f

Change shellarguments to .shellarguments and document it.

Resource/Init/gs_init.ps
doc/Language.htm
lib/gslp.ps
lib/pf2afm.ps
lib/pfbtopfa.ps
lib/pphs.ps
lib/printafm.ps
lib/rollconv.ps
lib/viewcmyk.ps
lib/viewpbm.ps
lib/viewpcx.ps
lib/viewraw.ps
lib/viewrgb.ps
toolbin/pdf_info.ps


2019-03-06 13:57:56 -0800
Nancy Durgin <nancy.durgin@artifex.com>
b5a3721b36da0a1a28cb6d132d2c6ae11e1592c0

Undef .confirm, .confirmread

There was a reference in doc/SavedPages.htm to .confirmread which has
been changed in 314c6b9026efbcada4e48b11c9a173a5e91d779c
to use standard postscript.

1) Rearranged code so things are defined before use.
2) Change all references to immediate evaluation.
3) undef

Resource/Init/gs_init.ps
Resource/Init/gs_setpd.ps


2019-03-06 16:11:43 -0700
Henry Stiles <henry.stiles@artifex.com>
f6ddc968966327f3bc24d1edc6a25c0f7ef82cd4

Remove the ownership document.

This hasn't been kept up to date, most of the information can be found
in Bugzilla by looking at default assignee per component.

doc/who_owns_what.txt


2019-03-06 16:08:56 -0700
Henry Stiles <henry.stiles@artifex.com>
2b100b794af3da27c127212af96bf4668fbda89b

Bug #700671 - error code not propagated back.

In attempt to clean up after an error PCL was stepping on the original
error code resulting in the interpreter continuing without fonts.

pcl/pcl/pctop.c


2019-03-06 15:30:14 -0700
Henry Stiles <henry.stiles@artifex.com>
b731a0d961516bd42b510e1ae036cca109b0ccdb

Bug #700671 fix file mode.

The file mode was incorrectly specified to include 'b' with the
sfopen(), the stream code adds another 'b' because it is always
binary. This can cause a crash on Windows 10 (see bug #696101).
Further gp_file_rb should only be used with gp_fopen().

pcl/pl/plfont.c


2019-03-06 13:41:07 -0800
Ray Johnston <ray.johnston@artifex.com>
314c6b9026efbcada4e48b11c9a173a5e91d779c

Rework a saved-pages example to use standard PostScript (not .confirmread)

doc/SavedPages.htm


2019-03-06 13:38:08 -0800
Nancy Durgin <nancy.durgin@artifex.com>
b9947ecde3bb1cd265ab24e5fd5086ae9f09bdc4

Tweak whitelist of scan_ps_dicts.ps, add some color ops

- remove statusdict
- add some standard operators that aren't in the PLRM (related to color)

toolbin/scan_ps_dicts.ps


2019-03-06 10:28:52 -0800
Nancy Durgin <nancy.durgin@artifex.com>
882aec138f3b734182f7494c69cf8c67d72aba77

Undef deprecated min,max,unread and clean up undef of .unread

min, max and unread have been deprecated since like 2001. Deleted
their definitions. This broke vasaley.ps test file, but I edited it
to define its own "min".

Changed existing uses of 'unread' to '.unread', 'min' to '.min', 'max'
to '.max'.

Made sure all uses of .unread are executeonly.

Resource/Init/gs_fonts.ps
Resource/Init/gs_img.ps
Resource/Init/gs_init.ps
Resource/Init/gs_type1.ps


2019-03-06 10:22:25 -0800
Ray Johnston <ray.johnston@artifex.com>
ee9e9f283c82eed181d5a11c7bea3735090fd680

Add whitelist to scan_ps_dicts.ps

Note that unfortunately, we have to have operators both in the 'bare'
form and the display form e.g. (exit) (--exit--).

toolbin/scan_ps_dicts.ps


2019-03-05 13:18:10 -0800
Nancy Durgin <nancy.durgin@artifex.com>
f5e8f8118bdca7ecae547a1d33d10ae1ec97d646

Don't define SAFERUndefinePostScriptOperators unless in SAFER

Previously if SAFER not true, then this would be defined and never undefined.

Resource/Init/gs_init.ps


2019-03-05 15:47:16 -0800
Ray Johnston <ray.johnston@artifex.com>
77152d4b71cf542f3c4cb610ad97c3a4d4efa65b

Initial version of utility to scan dictionaries for operators

toolbin/scan_ps_dicts.ps


2019-02-28 14:57:55 -0800
Nancy Durgin <nancy.durgin@artifex.com>
a45e3a9bf7b878c6f4e4a840ade4e64b5c56cd80

Cleaned up dead code related to .savelocalstate

.savelocalstate was part of display postscript (gs_dps.ps), so it is
no longer defined. Cleaned up conditional code that is now dead code.

Resource/Init/gs_init.ps


2019-02-28 14:22:32 -0800
Nancy Durgin <nancy.durgin@artifex.com>
097bb257147f45e5d1c15278cb95b7d19a147ac8

Undef .makeinternaldict in gs_init.ps

This used to be used more in gs_dps.ps, when multiple contexts were supported.
Downgraded it from an operator to a function. It's now only used in one
place, so undef right after use.

Resource/Init/gs_init.ps


2019-02-28 12:50:34 -0800
Nancy Durgin <nancy.durgin@artifex.com>
def941fa84d55e9ffdd76dec5009440904cf792b

Undef .getpath in gs_init.ps

This was another case where the operator is defined in C and was put
into the level2dict for no apparent reason. The code that uses it (in
pdf_ops.ps and pdf_draw.ps) didn't have level2dict available on the
dictstack when it defined the operators, so it wasn't getting bound.

Solution is to take .getpath out of level2dict. Added zupath_op_defs
for it and fixed makefile. Then can easily undef it.

Resource/Init/gs_init.ps
psi/int.mak
psi/zupath.c


2019-02-28 10:41:44 -0800
Nancy Durgin <nancy.durgin@artifex.com>
f26771b927e154c63101a08c9ca6ecef564e80a3

Undef .useloresscreen in gs_init.ps

Change to immediate evaluation and undef after use.

Resource/Init/gs_init.ps


2019-02-28 09:10:29 -0800
Nancy Durgin <nancy.durgin@artifex.com>
15e29a6e26dca230b9f35ec9bfa92de37a6f7c8c

Undef .setdefaultbgucr in gs_init.ps

This is just used locally. Change to immediate evaluation and undef after use.

Resource/Init/gs_init.ps


2019-02-27 15:21:57 -0800
Nancy Durgin <nancy.durgin@artifex.com>
b8a02cc76747e78e86ad5a127d1aec832b1b7566

Undef .beginpage, .endpage in gs_init.ps

Make sure all uses are executeonly.
After all the other cleanups, these are now easily undefined.

Resource/Init/gs_init.ps
Resource/Init/gs_setpd.ps


2019-02-27 14:25:08 -0800
Nancy Durgin <nancy.durgin@artifex.com>
c7b85fa9d84d5c9304c783461d5c8b91d580bfbb

Undef .mergespecial,.requiredattrs dictionaries in gs_setpd.ps

These are only used locally, but contain some functions (such as
InputAttributes) which were exposed.

Change to immediate evaluation and undef at end of file.

Resource/Init/gs_setpd.ps


2019-02-27 13:58:55 -0800
Nancy Durgin <nancy.durgin@artifex.com>
c2ad80deefb2b5af6b432cf4aa9942303fff17b3

Undef .clearerror in gs_init.ps

Move definition above use, make all uses immediate evaluation and undef.

Resource/Init/gs_init.ps
Resource/Init/gs_res.ps


2019-02-27 13:28:49 -0800
Nancy Durgin <nancy.durgin@artifex.com>
359306748b1aee2497d650b82a5222df2d99e702

Undef .type11mapcid, .type9mapcid

Made sure all uses were bind and executeonly, then can undef.

Note that the "CIDWProc" in pdf_font.ps wasn't bound. I didn't see
any reason for that, so I bound it.

Resource/Init/gs_cidfn.ps
Resource/Init/gs_init.ps
Resource/Init/pdf_font.ps


2019-02-27 12:42:11 -0800
Nancy Durgin <nancy.durgin@artifex.com>
af2c7b51e110d831e1c133e2635b2bad8e2e7dc8

Undef EPSBoundingBoxInit in gs_init.ps

This is only referenced during initialization. Undef after use.

Resource/Init/gs_init.ps


2019-02-27 11:40:03 -0800
Nancy Durgin <nancy.durgin@artifex.com>
34c34b9d9cc51bb90bf1e7c761bb917fcd094734

Undef .unstoppederrorhandler in gs_init.ps

Change to immediate evaluation and undef right after use.

Resource/Init/gs_init.ps


2019-03-04 07:14:31 +0000
Ken Sharp <ken.sharp@artifex.com>
7cb19e8362925329feed688db308aa3e5b935d0a

Coverity ID 33608

We weren't acting on a return value. If we get an error, which I believe
should actually be impossible in this case, we might potentially have
an invalid object being pointed to by an array.

Just in case, if we get an error here, discard the array we just
allocated and propagate the error.

psi/istack.c


2019-03-04 07:05:21 +0000
Ken Sharp <ken.sharp@artifex.com>
c38992507901fb8a3991ae61f5301f28719230b7

Coverity ID 333611

The error handling code in the run length encode filter confuses
Coverity because it relies on a series of 'got' operations that jump
into a block of otherwise unreachable code.

The code is (IMO) ugly and confusing, so refactor it to avoid the
'if (0)' blocks. This results in many fewer goto labels, and simpler
code.

base/srle.c


2019-03-04 07:02:31 +0000
Ken Sharp <ken.sharp@artifex.com>
ff41c469b656224fb90083e8f622af21952266d9

Coverity ID 333614 sign extension

An intermediate calculation results in a cast to 'int' which is then
promoted (on 64-bit systems) to an unsigned long long. If the top bit
of the intermediate value is set, then all the top bits of the final
value will be set.

Do an explicit cast to an unsigned to avoid this.

devices/gdevxalt.c


2019-03-04 06:09:15 +0000
Ken Sharp <ken.sharp@artifex.com>
00909869edf9f38af985086495e310ed2ea6b916

Coverity IDs 333615, 333613, 333610, 333606

Recent changes ot the code (extra chacking of the return value from
gs_matrix_invert are causing Coverity to regard unchecked return codes
from this routine as a problem.

Add return code checks (or cast to void) to pacify.

contrib/eplaser/gdevescv.c
contrib/lips4/gdevl4v.c
contrib/opvp/gdevopvp.c
devices/vector/gdevpdtt.c


2019-03-04 05:54:56 +0000
Ken Sharp <ken.sharp@artifex.com>
a7ab9861741f1aad06f4932c92b1a27fc13e230e

Coverity ID #333616

Add a comment to the default case so that Coverity can tell that we
fall through to the next case deliberately.

base/srle.c


2019-03-02 15:04:33 -0800
Michael Vrhel <michael.vrhel@artifex.com>
d5bc9bd2a548e6c12dd8224b6d18615d050a5731

Only use plug-in clone if transform is not identity

lcms will if it finds the table is essentially the identity set
the transform to a copy operation. If this is the case, then
just use that operation as it will be as fast as things can get.

lcms2mt/src/cmsxform.c


2019-02-26 17:22:21 +0000
Robin Watts <Robin.Watts@artifex.com>
79ce761f39aac21c270d8fb19142f5f8146440d2

Bug 700606: Fix problem with interpolated indexed >8bit images.

In the initial decode of the line, all but the first pixel of the
line is getting a value 0.

We look to be wrongly applying the nth map function to the nth
pixel, when the nth map function is intended for the nth component
of the pixel. Given we are only processing indexed images at this
point, we therefore always want the 0th map function.

base/gxiscale.c


2019-02-26 19:38:12 -0800
Nancy Durgin <nancy.durgin@artifex.com>
6931f9b2fe9aa8d6ffcdbfece50ffde0ac8d00e8

Undef /.generate_dir_list_templates, /.generate_dir_list_templates_with_length

Made these operators due to length. Made sure all uses are executeonly.
Undef in gs_init.ps

Resource/Init/gs_fonts.ps
Resource/Init/gs_init.ps
Resource/Init/gs_res.ps


2019-02-26 15:46:24 -0800
Nancy Durgin <nancy.durgin@artifex.com>
ebea5737da47a55e0838b9472bc05d209717d670

Undef .internalstopped in gs_init.ps

This is used all over the place, tons of edits. Making it an operator
didn't work (something to do with the stack during an error I think --
fails on tests_private/ps/ps3fts/141-01.ps).

So I made all the references be immediate evaluation, then can undef
in gs_init.ps.

Resource/Init/gs_btokn.ps
Resource/Init/gs_cidfm.ps
Resource/Init/gs_cidfn.ps
Resource/Init/gs_cidtt.ps
Resource/Init/gs_cmap.ps
Resource/Init/gs_diskn.ps
Resource/Init/gs_fonts.ps
Resource/Init/gs_frsd.ps
Resource/Init/gs_init.ps
Resource/Init/gs_lev2.ps
Resource/Init/gs_res.ps
Resource/Init/gs_setpd.ps
Resource/Init/gs_type1.ps
Resource/Init/pdf_base.ps
Resource/Init/pdf_main.ps
Resource/Init/pdf_ops.ps
Resource/Init/pdf_rbld.ps


2019-02-26 14:34:08 -0800
Nancy Durgin <nancy.durgin@artifex.com>
239d82b8b382afd435f3b48025954715633da9a9

Fixed previous undef of .stopped

The .stopped operator had been previously undef'd, but all the usages
weren't executeonly so it still shows up in the operator scan. Made usages
executeonly so .stopped is more thoroughly gone.

Resource/Init/gs_init.ps


2019-02-26 13:13:21 -0800
Nancy Durgin <nancy.durgin@artifex.com>
a4dbb260b6525e65d9bbe894591a79830afe191e

Undef .numicc_components and .set_outputintent in gs_init.ps

These are defined as C operators and used in pdf_main.ps. For some
reason they were defined in ll3dict, and during their use in
pdf_main.ps, ll3dict wasn't on the dictstack, so they didn't get
bound, meaning they couldn't easily be undef'd.

The solution I picked was to take them out of ll3dict, as I see no
reason for them to be there. That's a change to the C code (zicc.c).
I also renamed the structure to be zicc_op_defs instead of
zicc_ll3_op_defs, to eliminate any confusion. That required a
makefile change (int.mak).

After those changes, undef'ing in gs_init.ps is easy.

Resource/Init/gs_init.ps
psi/int.mak
psi/zicc.c


2019-02-26 09:58:03 -0800
Nancy Durgin <nancy.durgin@artifex.com>
94a78ca611ccc59383e5c4ea4beba4a13f4d4afd

Undef .runresource in gs_init.ps

Change to immediate evaluation (used in gs_res.ps) and undef.

Resource/Init/gs_init.ps
Resource/Init/gs_res.ps


2019-02-26 09:53:37 -0800
Nancy Durgin <nancy.durgin@artifex.com>
81c820ac5154751b248bdc91d0416d1eec354be2

Undef .PurgeDict in gs_init.ps

This was already used with immediate evaluation, so just undef it.

Resource/Init/gs_init.ps


2019-02-21 15:13:50 -0800
Nancy Durgin <nancy.durgin@artifex.com>
2aa1452450845649105c752c246a7a9c9b93b479

Undef .registererror and .registererror2 in gs_init.ps

.registererror2 is only used locally. Move code so it's defined before use.
Change to immediate evaluation and undef right afterwards.

.registererror is only used during initialization (not used in any
procedure definitions), though it's also used in gs_dps2.ps in the same way.
Undef after the uses.

Resource/Init/gs_init.ps


2019-02-21 13:22:20 -0800
Nancy Durgin <nancy.durgin@artifex.com>
23f68c46dd32cc955aec10bfc1c13438bb89a166

Undef .execute in gs_init.ps

Used locally, had to rearrange some code.
Change to immediate evaluation and undef after use.

Resource/Init/gs_init.ps


2019-02-21 10:40:58 -0800
Nancy Durgin <nancy.durgin@artifex.com>
d17c277a2e847990fccab18de357afea87024065

Undef .printerror_long in gs_init.ps

Some whitespace changes and moved code around.
This is only used locally.
Change to immediate evaluation and undef after use.

Resource/Init/gs_init.ps


2019-02-21 09:07:51 -0800
Nancy Durgin <nancy.durgin@artifex.com>
be56100b1ecf53092c9d678e4783b5660eb3e47e

Clean up and rearrange some code related to SAFER

Add some comments about which ones are extensions and to separate the code.
Make the temporary stuff not be operators (no need).

Resource/Init/gs_init.ps


2019-02-21 08:53:51 -0800
Nancy Durgin <nancy.durgin@artifex.com>
bdd92585f4a0aaa734053a5755e556ed61c8545d

Undef .locksafeglobal, .locksafe_userparams in gs_init.ps

Both of these are only used locally in gs_init.ps. Undef right after use.

Resource/Init/gs_init.ps


2019-02-25 14:55:40 +0000
Chris Liddell <chris.liddell@artifex.com>
a3b526cafb940890aff47dd9933777b88321b3ce

Bug 700678: Check for embedded font when substituting

When we apply a font name mapping, make sure that the ultimate font we load
comes from disk, and is not embedded in the job.

Resource/Init/gs_fonts.ps


2019-02-25 19:16:03 +0000
Robin Watts <Robin.Watts@artifex.com>
d2d32bcee1cb1b28494ba9b572afa53ef84391af

Update psd devices to only do one pass while rendering.

Previously, PSD devices would loop over each component in the file
and then over each line in the file. For non-page mode rendering
therefore, we would render each page as many times as there were
components.

Change the logic here to loop over each component, then over each
line.

This means we seek within the file as we write, but we already
impose restrictions on the output for this device to ensure that
we don't write multiple pages to the same file, so this is no
great loss.

devices/gdevpsd.c


2019-02-25 19:51:16 -0800
Michael Vrhel <michael.vrhel@artifex.com>
4c741f6ff9b1ab8a0fb433af9db8d7b0db335318

Have lcms2mt clone method check for transform plug-ins

When cloning a transform, it is necessary to see if there
are any plugins that should be used with the new data types.

lcms2mt/src/cmsxform.c


2019-02-24 22:01:04 -0800
Ray Johnston <ray.johnston@artifex.com>
d683d1e6450d74619e6277efeebfc222d9a5cb91

Bug 700585: Obliterate "superexec". We don't need it, nor do any known apps.

We were under the impression that the Windows driver 'PScript5.dll' used
superexec, but after testing with our extensive suite of PostScript file,
and analysis of the PScript5 "Adobe CoolType ProcSet, it does not appear
that this operator is needed anymore. Get rid of superexec and all of the
references to it, since it is a potential security hole.

Resource/Init/gs_init.ps
psi/icontext.c
psi/icstate.h
psi/zcontrol.c
psi/zdict.c
psi/zgeneric.c


2019-02-22 13:43:15 -0800
Michael Vrhel <michael.vrhel@artifex.com>
1bc4205dca71ca075af6ca95aa53a33f5a724586

Bug 700584 Cups device

The RGBW color space needs to have the white value mapped properly during the encode process.

cups/gdevcups.c


2019-02-21 13:01:24 -0800
Michael Vrhel <michael.vrhel@artifex.com>
f89824ec77691e80b954fd0e783fc41cf6246599

Bug 692405 X11 device

The X11 device copy_color proc was accessing indices outside its 16 value cache
causing improper color drawing for the cmyk2 device. For the cmyk4 device, the
bit manipulations mapping to rgb were incorrect.

devices/gdevxalt.c


2019-02-21 19:12:18 +0000
Robin Watts <Robin.Watts@artifex.com>
dd60ff8ba5030f078eccabe26a617374c1c2961f

Improve bounding box return for clip list accumulator.

This should hopefully reduce the amount of work the scan converter
has to do every time it writes to the clip list accumulator; in
particular the clist should set this up so that we don't needlessly
scan convert lines outside the current band.

base/gxacpath.c


2019-02-21 14:20:40 +0000
Robin Watts <Robin.Watts@artifex.com>
02b6572798cfa75f1b77cfa666748add0ae7db31

Bug 700643: Rejig scan converter - back off in high memory cases.

Group scan converter calling logic together, and call it through
a single gx_scan_convert_and_fill function.

Have the scan converter bale if the required memory is larger than
an arbitrary size (currently 1Meg). We subdivide the path into
bands and retry.

base/gxfill.c
base/gxscanc.c
base/gxscanc.h


2019-02-19 16:37:53 +0000
Robin Watts <Robin.Watts@artifex.com>
ed1d07fb8c324dea9988359bbcc400979155ffa8

Avoid buffer overflow in transparency buffer dump debug.

base/gdevp14.c


2019-02-18 17:48:32 +0000
Robin Watts <Robin.Watts@artifex.com>
f5a93cd8ca658ce80234319e7355335086c71872

Tweak "device_encodes_tags" to avoid const warnings.

base/gxdevcli.h


2019-02-22 12:28:23 +0000
Chris Liddell <chris.liddell@artifex.com>
a82601e8f95a2f2147f3b3b9e44ec2b8f3a6be8b

Bug 700576(redux): an extra transient proc needs executeonly'ed.

Resource/Init/gs_res.ps


2019-02-21 07:35:41 -0800
Nancy Durgin <nancy.durgin@artifex.com>
70e04b6d103193dd1eb1e7748cb6fb231c0482cf

Undef .setsafeglobal

Only used in gs_init.ps, undef right after use.

Resource/Init/gs_init.ps


2019-02-19 15:03:16 -0800
Nancy Durgin <nancy.durgin@artifex.com>
04e71e429c83dead2c5e69bf126b5c8cf1c18167

Undef .vmreclaim in gs_init.ps

This was tricky because it can be used in showpage, which wasn't bound.
Previous commit makes it possible to bind showpage.

It's used for debugging in the memento build, but this is useful so I
needed to maintain that functionality.

Also used in gs_lev2.ps, so make sure that is bound.

Since this operator is defined in C in the level2dict, it needs to
be undef'd from both systemdict and level2dict.

Resource/Init/gs_init.ps
Resource/Init/gs_lev2.ps


2019-02-19 14:56:31 -0800
Nancy Durgin <nancy.durgin@artifex.com>
9a6d754d60409d4ff3832d83801b1d3f96303932

Make it possible to .bind showpage and copypage

A bunch of operators were being redefined later in other code, so that
binding showpage and copypage picked up the wrong versions. I think
historically this was due to the way level2/level3 support was
implemented. Since we no longer support level1 postscript, we can
clean some of this up.

The cleanup involves moving some operators from other files into
gs_init.ps and also removing duplicate (level1) definitions when applicable.

- Move 'initgraphics' operator definition from gs_cspace.ps
- Move .currentnumcopies, .beginpage, .endpage from gs_setpd.ps
- Move 'copypage' definition down near showpage, so code is in right places

There are no changes to the code within the moved functions, other than to
make them .bind executeonly.

Resource/Init/gs_cspace.ps
Resource/Init/gs_init.ps
Resource/Init/gs_setpd.ps


2019-02-19 08:38:08 -0800
Nancy Durgin <nancy.durgin@artifex.com>
214fdd5625c81afa4e2c206eb3e54f1f0435580f

Undef .getdefaulthalftone in gs_init.ps

Used in gs_init.ps and gs_ll3.ps. Change to immediate evaluation and undef.

Resource/Init/gs_init.ps
Resource/Init/gs_ll3.ps


2019-02-19 09:29:48 -0800
Nancy Durgin <nancy.durgin@artifex.com>
eb5b4c273d42584d560d5d923565fcb4a07ff02d

Undef .bindoperators in gs_init.ps

We undef in different places depending on whether BINDNOW is true or not.

Resource/Init/gs_init.ps


2019-02-18 12:11:45 -0800
Ray Johnston <ray.johnston@artifex.com>
be86d2ff2f0f0ea0e365707f3be0fa0c9e7315ee

Bug 700599: Issue an error message if an ExtGstate is not found.

Previously, this was silently ignored. Only issue a single warning,
and respect PDFSTOPONERROR to prevent continuing with potentially
incorrect output.

Note that tests_private/pdf/uploads/bug696410.pdf also now gets this
error message (ExtGState" instead of ExtGState in object 10).

Resource/Init/pdf_draw.ps


2019-02-20 09:54:28 +0000
Chris Liddell <chris.liddell@artifex.com>
ed9fcd95bb01f0768bf273b2526732e381202319

Bug 700576: Make a transient proc executeonly (in DefineResource).

This prevents access to .forceput

Solution originally suggested by cbuissar@redhat.com.

Resource/Init/gs_res.ps


2019-02-20 09:50:13 +0000
Chris Liddell <chris.liddell@artifex.com>
73d1a911f4c8b19c19d37a963c39b01a181b46e1

Update to iclude TOC overflow solution

Also, remove the RS/6000 reference, and just reference IBM AIX

doc/Make.htm


2019-02-19 19:34:59 -0800
Michael Vrhel <michael.vrhel@artifex.com>
e1d09836703104ca5ac8cb94a47f2ce27bee28cd

Macro removal

Get rid of two macros in the halftone tile creation code.
One was replaced with an inline function. The other was simple
enough and used only in two spots to just use directly.

base/gxcht.c


2019-02-13 12:01:54 -0800
Michael Vrhel <michael.vrhel@artifex.com>
ba2043a548559d184cbfe90ca9884734dba6efdc

Bug 700584: cups device

The cups device has a pile of different color spaces. It is up to the cups device to
ensure that the color is handled properly for these. RGBA should certainly be treated
as a 32 3 component color similar to our pngalpha device. RGBW will be treated the same way.

Note that I looked at the output using Mike Sweet's rasterview program. I suspect there
probably is some work that needs to be done on that viewer to ensure proper viewing of
this type of data. With this patch gs is doing all it can.

cups/gdevcups.c


2019-02-14 15:14:50 -0800
Nancy Durgin <nancy.durgin@artifex.com>
1521304bd0da395fd11a950ab82a40deebc1f8c4

Undef .makepathtemplate in gs_init.ps

Only used locally. Change to immediate evaluation and undef.

Resource/Init/gs_init.ps


2019-02-14 15:10:28 -0800
Nancy Durgin <nancy.durgin@artifex.com>
8512e98984c6d1be2bcefd0493fc5c4dd26f118e

Undef .uservar in gs_init.ps

It was already an operator. Make sure all uses are executeonly and undef.

Resource/Init/gs_init.ps
Resource/Init/gs_statd.ps
Resource/Init/gs_trap.ps


2019-02-14 14:23:46 -0800
Nancy Durgin <nancy.durgin@artifex.com>
53a8955c422713ef6794f39de823a03d2f056790

Undef .userdict in gs_init.ps

It was already an operator. Make sure all uses are executeonly and undef.

Resource/Init/gs_dps2.ps
Resource/Init/gs_init.ps
Resource/Init/gs_lev2.ps
Resource/Init/gs_trap.ps


2019-02-14 13:40:08 -0800
Nancy Durgin <nancy.durgin@artifex.com>
7cd5f3cb820f75bc6ad636f09504918d96c9ba63

Undef .growdict and .growdictlength in gs_init.ps

Changed uses to immediate evaluation, undef with the others.

Resource/Init/gs_fonts.ps
Resource/Init/gs_init.ps


2019-02-14 13:12:17 -0800
Nancy Durgin <nancy.durgin@artifex.com>
4ae191913f5c3260d780108217c63d161f49272a

Undef .putdeviceprops in gs_init.ps

This is only used by /putdeviceprops, but I don't understand what's
going on with error handling and the comment about backward compatibility.
Both .putdeviceprops and putdeviceprops were already operators.

Just undef .putdeviceprops with the other operators, after making sure
everything is executeonly.

Resource/Init/gs_init.ps


2019-02-14 11:58:00 -0800
Nancy Durgin <nancy.durgin@artifex.com>
9a4acb441374641ba820648e5ae098ce9e5ae9d6

Undef .promptmsg in gs_init.ps

There used to be some code related to readline in lib/gs_rdlin.ps
that would redfine the .promptmsg, but that code is now gone.
There doesn't seem to be any reason to keep .promptmsg any more.
If somebody wants to redefine /prompt, that is still fine and is
documented in the PLRM.

Change to use immediate evaluation and then undef it.

Resource/Init/gs_init.ps


2019-02-14 11:39:08 -0800
Nancy Durgin <nancy.durgin@artifex.com>
e187134ce58a398d46cb0065929ecbe9b40b6d7c

Undef .packtomark in gs_init.ps

This is used in a bunch of other files. Changed all those to
immediate evaluation.

Resource/Init/gs_btokn.ps
Resource/Init/gs_init.ps
Resource/Init/gs_res.ps
Resource/Init/gs_ttf.ps
Resource/Init/pdf_base.ps
Resource/Init/pdf_sec.ps


2019-02-16 15:27:43 +0000
Ken Sharp <ken.sharp@artifex.com>
3ba38b60a2380a8fbac7d315da5dfeaaf3d4cf21

Fix some compiler warnings

Noticed in a regression run where warnings were not swallowed. When
using 'C' Keys we should use the function which searches dictionaries
using a 'C' string instead of a byte string (which may not be null
terminated).

devices/vector/gdevpdfj.c


2019-02-16 11:14:57 +0000
Ken Sharp <ken.sharp@artifex.com>
6c4ef58b66dadf546cbc7370ebbabe5505acc7ed

PS interpreter - properly restore exec stack after error in zshow

Bug #700618 "Ghostscript - Invalid read in op_show_finish_setup()"

The problem occurs some time before the actual seg fault. The test file
is overly complex (not uncommon for fuzzed files), a simpler file would
be:

/S 80 string def
108 480 moveto
{ 1 S show
} loop

This runs in a loop, showing an empty string. But each iteration of the
loop leaves an object on the exec stack. Eventually we reach the stack
limit. The internals of 'show' require us to be able to push an object
(actually, 2 objects) on to the operand stack, so this results in a
stack overflow.

Although zshow() checks the return code properly, it does not reset the
exec stack pointer in the case of an error (it adds up to 11 objects
to the exec stack itself). For a fatal error this isn't a problem, but
stack overflow is non-fatal; the interpreter can increase the stack size
and retry.

This is where the problem exhibits. When we retry zshow() we have left
entries on the exec stack, in particular a 'mark', because we didn't
rewind the exec stack on error. We then try to use that to locate an
enumerator stored on the exec stack, but because we didn't complete the
setup, what we find is garbage.

The solution is simply to restore the exec stack pointer on error,
before we return. We should also free the enumerator to prevent a
(saved by garbage collection) memory leak. So also initialise the
pointer to NULL, so we can safely free it, even if we didn't get round
to allocating it.

There are 2 error conditions in this code, we need to update both.

psi/zchar.c


2019-02-14 10:20:03 -0800
Ray Johnston <ray.johnston@artifex.com>
205591753126802da850ada6511a0ff8411aa287

Fix bug 700585: Restrict superexec and remove it from internals and gs_cet.ps

Also while changing things, restructure the CETMODE so that it will
work with -dSAFER. The gs_cet.ps is now run when we are still at save
level 0 with systemdict writeable. Allows us to undefine .makeoperator
and .setCPSImode internal operators after CETMODE is handled.

Change previous uses of superexec to using .forceput (with the usual
.bind executeonly to hide it).

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


2019-02-14 10:16:18 -0800
Nancy Durgin <nancy.durgin@artifex.com>
4250323f0c5e85f43bd82255c846f98869a46354

Remove undef of /odef from the SAFER list.

Oops, this change crept in on an earlier commit. No need to include in
the SAFER list since it's being undef'ed in the main list.

Resource/Init/gs_init.ps


2019-02-14 10:09:00 -0800
Nancy Durgin <nancy.durgin@artifex.com>
e8acf6d1aa1fc92f453175509bfdad6f2b12dc73

Undef /odef in gs_init.ps

Made a new temporary utility function in gs_cet.ps (.odef) to use instead
of /odef. This makes it fine to undef odef with all the other operators in
gs_init.ps

This punts the bigger question of what to do with .makeoperator, but it
doesn't make the situation any worse than it already was.

Resource/Init/gs_cet.ps
Resource/Init/gs_init.ps


2019-02-13 14:03:29 -0800
Nancy Durgin <nancy.durgin@artifex.com>
3e6e57c0a80948f322b9842add4a7ab86915cdc6

Undef /obind from gs_init.ps

This is only used in gs_typ32.ps, just undef with all the other things in
gs_init.ps

Resource/Init/gs_init.ps


2019-02-13 13:54:25 -0800
Nancy Durgin <nancy.durgin@artifex.com>
533f78554f194524abb55183d370e64354caa329

Deleted definition of /execute, which wasn't used anywhere.

As far as I can tell... It's extremely challenging to try to grep for uses of
this word.

Resource/Init/gs_init.ps


2019-02-13 09:36:29 -0800
Nancy Durgin <nancy.durgin@artifex.com>
c5ed6a1f8583068484b4c138fb1e0e1ef1ad2a3f

Undef /runlibfile0 in gs_init.ps

This is just used temporarily.
Change to immediate evaluation and undef right after use.

Resource/Init/gs_init.ps


2019-02-13 08:43:00 -0800
Nancy Durgin <nancy.durgin@artifex.com>
e0b0c12518bc58020efda5ca3d1e4888b33060b2

Delete /ppstack, which is defined in gs_init.ps and not used anywhere

Resource/Init/gs_init.ps


2019-02-13 08:29:39 -0800
Nancy Durgin <nancy.durgin@artifex.com>
b26b5ec2be0a924981a47c8a66b1cfe936170129

Remove 'copystring', which was only used in one place

Just put the code in-line.

Resource/Init/gs_fonts.ps
Resource/Init/gs_init.ps


2019-02-12 14:00:29 -0800
Nancy Durgin <nancy.durgin@artifex.com>
25c744f8a7761676d7790f513ca138eaaed2c366

Undef .set/.currentfilladjust, re-def .set/.currentfilladjust2

The .setfilladjust, .currentfilladjust were just wrappers around the
'2' versions. They were used in only a couple places, and were just
dupping/popping the extra args, so I replaced these with equivalent
uses of the underlying operators.

These were "compatibility" operators for .setfilladjust2 and
.currentfilladjust2, which do the same basic thing but take two values
(x,y) instead of 1.

Robin wants these to be official extensions because they are useful
for testing, so I have taken out the code that undef's .setfilladjust2
and .currentfilladjust2. We need to add documentation for these.

Resource/Init/gs_init.ps
Resource/Init/pdf_ops.ps


2019-02-12 10:41:34 -0800
Nancy Durgin <nancy.durgin@artifex.com>
509cb1f2103a2b35efe463271a94b2c33ed6b838

Undef /printgreeting in gs_init.ps

Only used locally. Undef right after use.

Resource/Init/gs_init.ps


2019-02-13 15:15:33 +0000
Robin Watts <robin.watts@artifex.com>
0e0981f84562bff97f45e401c704289544d4f523

Avoid buffer overread in pcl ccittfax decompression.

If you:

make gpcl6debugvg
valgrind --track-origins=yes debugbin/gpcl6 -sOutputFile=test.pdf
-dMaxBitmap=400000000 -sDEVICE=pdfwrite -r75 -Z: -dNOPAUSE
-dBATCH -K2000000 -dClusterJob
tests_private/customer_tests/bug693269.prn

Then we get valgrind errors in cf_decode_eol.

The cause is that process_ccitt_compress is making the read buffer
4 bytes too long, due to forgetting to remove the allowance for the
4 bytes used for the header word.

The fix is simply to adjust the buffer size.

pcl/pcl/rtraster.c


2019-02-09 13:34:17 +0100
Sebastian Rasmussen <sebras@gmail.com>
660eaabf87a143b5217dc875550968883d8e4fc0

Bug 700554: jbig2: Use custom allocator for jbig2dec/luratech decoders.

base/sjbig2.c
base/sjbig2.h
base/sjbig2_luratech.c
base/sjbig2_luratech.h
psi/zfjbig2.c


2019-02-09 13:34:38 +0100
Sebastian Rasmussen <sebras@gmail.com>
0d942b34ae4a5385f5cd3cfa9b2c708f56c65860

jbig2dec: Return allocator once it is retired.

jbig2dec/CHANGES
jbig2dec/jbig2.c
jbig2dec/jbig2.h


2019-02-12 17:27:56 +0000
Chris Liddell <chris.liddell@artifex.com>
0fb8c19f9b848fb691dc067a0feebbfee539672b

Bug 700564: Tweak to fix shared libjpeg

A custom header include wasn't protected by proprocessor directives.

And remove one not required inclusion.

base/sjpegc.c
devices/gdevpdfimg.c


2019-02-12 08:04:39 -0800
Nancy Durgin <nancy.durgin@artifex.com>
ecf45905a555386c157967aefc986c94002b3c6d

Undef .pdfcharkeys from gs_ttf.ps

Used locally. Change to immediate evaluation and undef.

Resource/Init/gs_ttf.ps


2019-02-07 14:22:14 -0800
Nancy Durgin <nancy.durgin@artifex.com>
05dddc4d150b372eecd28817b8441694843b64d8

Move code around to prepare for more undef'ing

Moved code so things are declared before referenced.
No changes to the code, just moved it around in the file.

Resource/Init/gs_ttf.ps


2019-02-07 14:02:49 -0800
Nancy Durgin <nancy.durgin@artifex.com>
e7faf522a5f5a770659cf4d1c9cd7f3362eb9b4d

Undef .findcmap, .pdfmapsymbolic in gs_ttf.ps

Used locally. Change to immediate evaluation and undef.

Resource/Init/gs_ttf.ps


2019-02-07 13:53:00 -0800
Nancy Durgin <nancy.durgin@artifex.com>
9a0db357352e338fe8432ec1e18aa901aed61fdd

Undef .loadttcidfont, .loadpdfttfont in gs_ttf.ps

These are used in pdf_font.ps. Need to rearrange the order of things
in the Makefiles so that gs_ttf.ps is included before pdf_font.ps in
obj/iconfig.h. This also meant moving gs_mgl_e.ps, though I wonder if
it could be moved up with the other encodings (gs_mex_e.ps,
gs_mro_e.ps, etc). I didn't look into right now -- it would be a lot
of Makefile hacking.

After makefile change: change .loadttcidfont and .loadpdfttfont to
operators, make sure their usage is executeonly, and undef in
gs_init.ps.

Resource/Init/gs_init.ps
Resource/Init/gs_ttf.ps
psi/int.mak


2019-02-12 09:15:54 +0000
Chris Liddell <chris.liddell@artifex.com>
355434f4b1bbe8c4f98cafad5a6868aa2f0eaae1

Bug 700533: Undo FT over/underflow workaround

Older versions of Freetype had a problem with overflow (and underflow) in the
Truetype hinting code. That was resolved some time ago with the addition of
(or handling of) the F_dot_P value.

In the file associaited with this issue, the glyph offset is caused by this
workaround.

Thus the workaround is no longer required, and as it actually causes a problem,
it is hereby removed.

base/fapi_ft.c


2019-02-11 07:40:02 -0800
Robin Watts <Robin.Watts@artifex.com>
fd643f053ea4a311a9e61a10069cfe8747aa950c

Bug 700577: Follow on fix.

If the matrix inversion fails, set values for tmat as well as smat.

devices/vector/gdevpdtt.c


2019-02-11 09:31:04 +0000
Chris Liddell <chris.liddell@artifex.com>
0038d98e024edb55a844f8371e62eacbbeb6f6a6

Bug 700582: Handle disabled streams in s_file_available()

and s_file_read_seek()

base/sfxstdio.c


2019-02-06 17:30:00 +0000
Chris Liddell <chris.liddell@artifex.com>
52196a78714e632c2c4001edffc65285346ac998

Ensure uses of true/false/null are immiediately evaluated

Resource/Init/gs_cet.ps
Resource/Init/gs_epsf.ps
Resource/Init/gs_init.ps
Resource/Init/gs_lev2.ps
Resource/Init/gs_pdfwr.ps
Resource/Init/gs_setpd.ps
Resource/Init/pdf_base.ps
Resource/Init/pdf_draw.ps
Resource/Init/pdf_font.ps
Resource/Init/pdf_main.ps
Resource/Init/pdf_ops.ps


2019-02-10 17:56:23 -0800
Michael Vrhel <michael.vrhel@artifex.com>
08ffa461bbf0914757c11be28c99829dcdae5a38

Bug 696318 psdcmykog issues

The psdcmykog device has to ignore certain postscript color settings since
it does not support any colorants other than the cmykog ones.
I tested with a file that had Artifex Green and Artifex Orange to
ensure that rendered properly still after this fix.

devices/gdevpsd.c


2019-02-10 19:10:26 -0700
Henry Stiles <henry.stiles@artifex.com>
aaf522721db34addf48ae1cc64d559bddbcc1c02

Improve function naming and simplify initialization and destructor.

No expected differences.

pcl/pxl/pximage.c


2019-02-08 04:08:08 +0100
Sebastian Rasmussen <sebras@gmail.com>
d9edb5a256b00e787d72462320112ef39bfa27b3

Without enough prefix codes, a Huffman table cannot be generated.

Previously this was treated as a warning, possibly allowing access
to uninitialized prefix code entries.

jbig2dec/jbig2_text.c


2019-02-08 04:03:40 +0100
Sebastian Rasmussen <sebras@gmail.com>
e4a0d6264627ece2a2c09da9d81d21b6b2158481

Make sure to indicate error upon unexpected OOB.

jbig2dec/jbig2_text.c


2018-12-07 18:12:48 +0100
Sebastian Rasmussen <sebras@gmail.com>
a89d75c1a059093aab4218046a9f258e86a5ab5f

Clarify the element size of GR_stats when memsetting.

In case Jbig2ArithCx ever changes, but it is unlikely.

jbig2dec/jbig2_symbol_dict.c


2019-02-08 04:15:41 +0100
Sebastian Rasmussen <sebras@gmail.com>
f2cadf483f44518ddae68c3146ae77f205f7e11b

Use common pattern for error detection.

Previously the code used a non-standard variant, but it is better
to do error detection the same way everywhere.

jbig2dec/jbig2_halftone.c


2018-12-07 18:12:23 +0100
Sebastian Rasmussen <sebras@gmail.com>
6238141c4564df091515fac92e3c35275d5ce26f

Bug 700384: Indicate error upon error, do not just warn.

Building a Huffman table failed, this was correctly detected,
but success was indicated to the caller causing a reference
template to be left uninitialized, which later on caused the
generic refinement region decoder attempt to use this
uninitialized data. This was reported by MSAN.

Thanks to oss-fuzz for reporting.

jbig2dec/jbig2_text.c


2019-01-24 03:55:57 +0100
Sebastian Rasmussen <sebras@gmail.com>
a0421f035fd418d27fd2df80b896d97d3d6e87ea

Bug 694247: Do not confuse openjpeg input buffer usage with size.

Previously s_opjd_accumulate_input() populated the openjpeg input data
buffer and adjusted the buffer size and usage fields accordingly. The
openjpeg callbacks for reading, skipping and seeking confused these two
fields and used the buffer size instead of the buffer usage. This meant
that there was a risk of reading uninitialized data.

base/sjpx_openjpeg.c


2019-01-25 15:49:56 +0100
Sebastian Rasmussen <sebras@gmail.com>
9a317d2ddfb82ad584a91540fca80db36c6440c7

Add sanitize variant of gpdl target.

base/unix-end.mak


2019-02-07 18:18:59 +0000
Robin Watts <robin.watts@artifex.com>
38c864f6300ccb2664c3d8707ef41564645742e4

Fix Memento_find when running under valgrind.

base/memento.c


2019-02-07 20:00:55 +0000
Robin Watts <robin.watts@artifex.com>
046cd2e7fc5c6a11a5e59835b06a70f3b65f9eb1

Ensure that gs_matrix_invert always has its return checked.

If you do:

make gsdebugvg
valgrind --track-origins=yes debugbin/gs -sOutputFile=test.ps
-dMaxBitmap=400000000 -sDEVICE=ps2write -r300 -Z: -dNOPAUSE
-dBATCH -K2000000 -dClusterJob comparefiles/Bug694772.pdf

then you get:

Conditional jump or move depends on uninitialised value(s)
at 0x945795: gs_matrix_multiply (gsmatrix.c:88)
by 0x7E568B: pdf_calculate_text_size (gdevpdtt.c:2352)
by 0x7E58DD: pdf_update_text_state (gdevpdtt.c:2386)
by 0x7D2E28: pdf_process_string (gdevpdte.c:679)
by 0x7D079E: pdf_process_string_aux (gdevpdte.c:79)
by 0x7D68D1: process_plain_text (gdevpdte.c:1582)
by 0x7E902C: pdf_text_process (gdevpdtt.c:3566)
by 0x956BEC: gs_text_process (gstext.c:595)
by 0xB445A0: op_show_continue_pop (zchar.c:583)
by 0xB42B95: zshow (zchar.c:71)
by 0xB11AD6: do_call_operator (interp.c:86)
by 0xB14B0D: interp (interp.c:1300)
Uninitialised value was created by a stack allocation
at 0x7E57EA: pdf_update_text_state (gdevpdtt.c:2373)

This is because a matrix inversion fails and is uncaught.

base/gshtscr.c
devices/vector/gdevpdfi.c
devices/vector/gdevpdtc.c
devices/vector/gdevpdtt.c
devices/vector/gdevpx.c
devices/vector/gdevtxtw.c
devices/vector/gdevxps.c
pcl/pxl/pximage.c


2019-02-07 17:30:48 +0000
Robin Watts <robin.watts@artifex.com>
1c247504269f70d07ce95104440a36f34f1a68a0

Bug 700577: Ensure text enum initialisation sets reqired flags

The default begin_text function initialises various things like
charpath_flag and is_pure_color. The PCL interpreter then calls
directly into the graphics lib for string measurement etc, and
this depends on these flag.

Sadly, not all text enumerator initialisations set these flags;
in particular if we have the flp device in effect, the subclass
begin_text function is used and that does not init those values.

The simplest solution appears to be to amend
gs_text_enum_init_dynamic to always set these flags as required.

base/gstext.c
base/gxchar.c


2019-01-31 16:34:30 -0800
Michael Vrhel <michael.vrhel@artifex.com>
f10f2900633674746f6a8155200f24db51449523

Bug 696318: psdrgb device

With certain postscript files, the psdrgb device was getting its process
color model changed causing significant confusion for the device.

devices/gdevpsd.c


2019-02-06 21:36:54 +0000
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
5daf81e0edb5dee2911bf419fa2423b2588449ab

Bug 697545 : Prevent numerous memory leaks.

Cleanup font for all error returns.

Error created using :-
MEMENTO_FAILAT=21465 ./membin/gpcl6 -sDEVICE=pbmraw -dMaxBitmap=2000 -o /dev/null ./tests_private/pcl/pcl5cfts/fts.0282

pcl/pcl/pcsfont.c


2019-02-06 09:51:49 -0800
Ray Johnston <ray.johnston@artifex.com>
8da995af1f586f2f90cac274aa738cd8dad3759f

Undef check_r6_password and PDFexecform

Immediate binding and undef for check_r6_password.

Move PDFexecform from gs_lev2.ps to pdf_draw.ps (the only place it was
used), and put it and .PDFexecform in pdfdict. PDFexecform and
.PDFexecform don't need odef -- just make them executeonly (even though
they will be hidden in pdfdict).

Also change the initial size of pdfdict to just over the actual size
(it was growing to > 400 maxlength).

Resource/Init/gs_lev2.ps
Resource/Init/pdf_draw.ps
Resource/Init/pdf_main.ps
Resource/Init/pdf_ops.ps
Resource/Init/pdf_sec.ps


2019-02-07 08:48:53 -0800
Nancy Durgin <nancy.durgin@artifex.com>
060c83126ad016a691f6ef1b43d5232956ddc128

Undef /.loadttfont, /.loadwofffont, /.loadwofftables from gs_ttf.ps

Used locally, so change to immediate evaluation and undef.

Resource/Init/gs_ttf.ps


2019-02-06 15:35:05 -0800
Nancy Durgin <nancy.durgin@artifex.com>
bdc3e6b7201c2a73eeae60cf4cfffb843f5034ea

Reorder code to prep for future cleanup

Resource/Init/gs_ttf.ps


2019-02-06 14:36:01 -0800
Nancy Durgin <nancy.durgin@artifex.com>
dd3b403b72931b9ef52630665fc418ad96075197

Undef .readttdata,.nname in gs_ttf.ps

Used locally. Use immediate evaluation and undef.

Resource/Init/gs_ttf.ps


2019-02-06 14:34:01 -0800
Nancy Durgin <nancy.durgin@artifex.com>
46ec997913d63b6c7d3ac666484c1a04551a082b

Undef .printtab in gs_ttf.ps

Used locally, so change to immediate evaluation and undef.

Resource/Init/gs_ttf.ps


2019-02-06 14:28:17 -0800
Nancy Durgin <nancy.durgin@artifex.com>
91bf6eef15c30efd90c4e98cc4b95e9e7f85a763

Undef .pickcmap, .pickcmap_with_xlatmap, .pickcmap_with_no_xlatmap in gs_ttf.ps

.pickcmap uses immediate evaluation on the other two, so just undef them.

Make .pickcmap an operator because it's a big function. Make sure all uses
are executeonly. Undef in gs_init.ps.

Resource/Init/gs_init.ps
Resource/Init/gs_ttf.ps


2019-02-06 13:01:26 -0800
Nancy Durgin <nancy.durgin@artifex.com>
715541a5c7390508d923d48e2eda4417b82a2710

Undef .makesfnts in gs_ttf.ps

Large procedure, so made it an operator. Make sure all references are
executeonly. Undef in gs_init.ps.

Resource/Init/gs_init.ps
Resource/Init/gs_ttf.ps


2019-02-06 11:47:15 -0800
Nancy Durgin <nancy.durgin@artifex.com>
ce52f184357a8043c0b314f2e8319237b75c29ae

Undef .ttkeys in gs_ttf.ps

Used locally -- change to immediate evaluation and undef at end of file.

Resource/Init/gs_ttf.ps


2019-02-06 10:12:34 -0800
Nancy Durgin <nancy.durgin@artifex.com>
c58684b54be4190a8f1ce3d92200f420aefba9dd

Undef .is_ttf_or_otf, .is_woff from gs_ttf.ps

Only used locally, changed to immediate evaluation.

Also moved some of the related things that were already undef'd, to be
handled together.

Resource/Init/gs_ttf.ps


2019-02-07 07:12:36 -0800
Michael Vrhel <michael.vrhel@artifex.com>
7cc8aeb7bf93deab5d86aeeca6c5b22a3890345d

Bug 700571 SoftMask Matte rendering

Fix for multiple issues with the removal of the preblended transparency
that can exist with the softmask

base/gdevp14.c
base/gdevp14.h
base/gxblend.c


2019-02-04 11:36:19 -0800
Robin Watts <Robin.Watts@artifex.com>
28f825c642a9af53136a7e661c6026db53604b76

Workaround Shading/clist valgrind issues with trans_device.

When shading into the clist the code has to cope with 2 devices;
the target device, and the 'trans_device', which is updated to
use the source colorspace for the shading.

The number of components can vary between the two, meaning that
the shading code has to be passing (say) 1 component around,
but the call into the clist will attempt to write (say) 3 components.

The clist appears to cope with this mismatch on reading (and I
haven't found a case where we write too few components), so for
now, just add a hacky PACIFY_VALGRIND section to clear the
spare color components.

base/gxshade6.c


2019-02-05 15:22:15 -0800
Nancy Durgin <nancy.durgin@artifex.com>
6c8a539b2a2c199bcde37acc652b882239407c47

Undef .is_hex_digit, .pop3ex, .popfex from gs_ttf.ps

These were already used with immediate evaluation, so just need to undef.

Resource/Init/gs_ttf.ps


2019-02-05 14:06:06 -0800
Nancy Durgin <nancy.durgin@artifex.com>
ebfacf80bf673dbaa7e742687f4d319cd1b8dd11

Undef .loadttfontdict, which undefs a bunch of internal procedures

Changed to immediate evaluation of the dict. Undef dict at end of file.
Eliminates a bunch of internal procedures.

Resource/Init/gs_ttf.ps


2019-02-05 12:19:00 -0800
Nancy Durgin <nancy.durgin@artifex.com>
402c16dec171424700639d8aa41009dbc57b66a7

Remove undef of /postalias that was supposed to be removed after v9.09

There are no remaining references to "postalias", so this appears to be
dead/unneeded code, as indicated by the comment.

Resource/Init/gs_ttf.ps


2019-02-05 12:12:42 -0800
Nancy Durgin <nancy.durgin@artifex.com>
3575fc86cfcffcec935023238a2d6d0ae62875ca

Undef .findttfontname and .findwoffname from gs_ttf.ps

Move code so defined before use. Use immediate evaluation. Undef locally.

Resource/Init/gs_ttf.ps


2019-02-05 12:07:36 -0800
Nancy Durgin <nancy.durgin@artifex.com>
4e051acc94b70a952ba2f2baa7209df3a2924bb6

Undef .findseg from gs_ttf.ps

Used locally. Immediate ref and undef in file.

Resource/Init/gs_ttf.ps


2019-02-05 11:54:12 -0800
Nancy Durgin <nancy.durgin@artifex.com>
1bebd7f9f299026de62868e72f70979460080a27

Undef .fill_identity_cmap, .definettcidfont in gs_ttf.ps

Local definition -- use immediate evaluation and then undef.

Resource/Init/gs_ttf.ps


2019-02-05 09:28:48 -0800
Nancy Durgin <nancy.durgin@artifex.com>
9876fb74118b91ec87a34673735bcd89900ad66a

Undef .charkeys from gs_ttf.ps

- This is a huge procedure, so I made it an operator rather than using
immediate evaulation
- Make sure all uses are executeonly
- Undef in gs_init.ps

Resource/Init/gs_init.ps
Resource/Init/gs_ttf.ps


2019-02-05 09:25:17 -0800
Nancy Durgin <nancy.durgin@artifex.com>
3c12cbfa2585c4af7173e6045c2339f051574b3c

Undef .addglyph from gs_ttf.ps

- this already only had immediate references
- undef at end of gs_ttf.ps

Resource/Init/gs_ttf.ps


2019-02-06 11:17:27 +0000
Robin Watts <robin.watts@artifex.com>
1ca42001f0ae456aa3ec080e88719e2d4b4f8131

Tweak cff_write_Encoding to avoid writing badly formed table.

The following:

make gsdebugvg
valgrind --track-origins=yes debugbin/gs -sOutputFile=/dev/null
-dMaxBitmap=400000000 -sDEVICE=pdfwrite -r72 -Z: -dNOPAUSE
-dBATCH -K2000000 -dClusterJob Bug691693.pdf

results in valgrind warnings:

Use of uninitialised value of size 8
at 0x53F0B6: deflate_slow (in ghostpdl/bin/gs)
by 0x53CDA5: deflate (in ghostpdl/bin/gs)
by 0x6CB1B7: s_zlibE_process (in ghostpdl/bin/gs)
by 0x6B35F0: swritebuf (in ghostpdl/bin/gs)
by 0x6B31EB: s_process_write_buf (in ghostpdl/bin/gs)
by 0x6B28E5: spputc (in ghostpdl/bin/gs)
by 0x6B2CE1: sputs (in ghostpdl/bin/gs)
by 0x7E3A43: type2_put_hintmask (in ghostpdl/bin/gs)
by 0x7E4704: psf_convert_type1_to_type2 (in ghostpdl/bin/gs)
by 0x7D9770: cff_put_CharString (in ghostpdl/bin/gs)
by 0x7DAB9B: cff_write_CharStrings (in ghostpdl/bin/gs)
by 0x7DC58B: psf_write_type2_font (in ghostpdl/bin/gs)
Uninitialised value was created by a stack allocation
at 0x7DAF8E: cff_write_Encoding (in ghostpdl/bin/gs)

Investigation shows that cff_write_Encoding is outputting a table
with uninitialised bytes in that. Not only that, in such cases
it can clearly omit some valid data.

Conceptually, the routine starts with an empty index table, with
uninitialised values. For each of the possible 256 entries within
the font, it attempts to encode the char to get the glyph index.
If this fails, then the glyph is not encoded, so not mentioned in
the table.

Assuming it is encoded, it finds the index for that glyph within
the subset. If there is no index, then it is not in the subset, so
no entry in the table.

If there is an index, we look up the glyph name. If there is no
glyph name, we choose not to encode the glyph in the table. This
is the (first) case which is causing us problems.

Finally, we check to see if the encoded index fits into the simple
(0..255) table without clashing with a previously encoded glyph;
if so, we insert it into the index table (incrementing the number
of entries we have inserted), if not, we have to resort to using a
supplement entry.

The code then assumes that the first 'actual_enc' bytes of index
make up the table. This is sadly not the case.

In the test given above, this routine is called several times, one
of which demonstrates that this assumption is false.

While the entries do yield a set of index values that form a prefix
within the table (from 0 to 20), number 14 has no glyph name. This
results in byte 14 of the table having a garbage value in, and
(more worryingly), because actual_enc is only incremented to 20,
we don't write the final entry of the table at all, effectively
dropping a glyph.

It is possible that something has gone wrong earlier in the process
and that this should be a fatal error, but observation of the code
shows that if we use a supplement, because a j maps to a previously
used i, we'll similarly miscount the length of the table.

A better solution, seems to me, to be to keep track of the maximum
encoded value that has gone into the index table, and to ensure
that every value within that table has a defined value.

The table is initialised with 0's, as Chris informs me that the CIF
SID for .notdef is 0.

We make matching changes to cff_Encoding_size.

devices/vector/gdevpsf2.c


2019-02-06 09:54:22 +0000
Ken Sharp <ken.sharp@artifex.com>
0cf2aa5cdb1d7392cd4a6b11a30625be91ef9be0

PDF interpreter - reset colour space after starting a Group

Bug #700572 "PDF to TIFF - only borders left after conversion - no errors"

The problem is that the PDF file does not set a fill (or indeed stroke)
colour space or colour before beginning to draw on the canvas. Thus it
relies upon the default colour values.

Because the page has a transparency Group, and the Group has a Colour
space, we set the colour space before we begin rendering. The defined
colour space of the group is an ICCBased space with four components.
The PDF Reference is clear that the default colour for an ICCBased space
is that all the components should be 0. This results in us drawing all
the filled elements in 0 0 0 0, or white.

We need to set the colour space before we define the group for the
transparency compositor, because the code relies upon the colour space
of the group being current at the time the group is 'defined'.

Grabbing the current colour space, before setting the group space, and
then setting it back again afterwards, effectively a gsave/grestore but
only for the colour space fixes this problem. This causes differences in
7 test files, which I believe are progressions.

Resource/Init/pdf_draw.ps


2019-02-05 07:31:05 -0800
Nancy Durgin <nancy.durgin@artifex.com>
8d0253fdeb73bdb021f665e7c5478d6e1f41898e

Delete .makemodifiedfont

This goes with .definemodifiedfont, which was previously deleted.
Neither of these functions are referenced anywhere, so removing completely.

Resource/Init/gs_fonts.ps


2019-01-31 15:06:54 -0800
Nancy Durgin <nancy.durgin@artifex.com>
d0883434eb7fd7239048b404dab884803a42f52d

Undef .FontDirectory

- It was already an operator. Make it executeonly.
- Make sure all uses are executeonly.
- Undef in gs_init.ps

Resource/Init/gs_fonts.ps
Resource/Init/gs_init.ps


2019-01-31 12:10:48 -0800
Nancy Durgin <nancy.durgin@artifex.com>
cea599bca413609c288a43c7b1d765b53f200083

Undef .substitutefont and .substitutefontname

Used in gs_fonts.ps and pdf_font.ps

- make it an operator
- make sure all procedures that use it are executeonly
- undef in gs_init.ps

Resource/Init/gs_fonts.ps
Resource/Init/gs_init.ps


2019-01-31 11:58:21 -0800
Nancy Durgin <nancy.durgin@artifex.com>
c52e82d2eeae0eb498eef80c1a86d788fe0b117d

Undef .loadinitialfonts

Defined in gs_fonts.ps and used in gs_init.ps. Undef right after use in
gs_init.ps.

Resource/Init/gs_init.ps


2019-02-04 16:56:51 +0000
Robin Watts <robin.watts@artifex.com>
c5fd7dc0f3c706eddd59488a33fc334a2860da49

Ensure return code of gs_bbox_transform_inverse always checked.

Spotted this while debugging something else.

base/gdevbbox.c
base/gdevbbox.h
base/gsdevmem.c
base/gslib.c
base/gsshade.c
base/gxp1fill.c
base/gxshade1.c
base/gxshade6.c
xps/xpsopacity.c


2019-02-01 10:48:31 +0000
Robin Watts <robin.watts@artifex.com>
2d5b86f0acf37fcb6176817580c2d3bb745e27d2

Avoid valgrind error in gs_shading_A_fill_rectangle_aux

The following sequence:

make gsdebugvg
debugbin/gs -sOutputFile=test.pdf -dMaxBitmap=400000000
-sDEVICE=pdfwrite -r72 -Z: -dNOPAUSE -dBATCH -K2000000 -dClusterJob
/home/marcos/cluster/tests_private/comparefiles/Bug695746.pdf
valgrind --track-origins=yes debugbin/gs -sOutputFile=/dev/null
-dMaxBitmap=400000000 -sDEVICE=ppmraw -r72 -Z: -dNOPAUSE -dBATCH
-K2000000 -dClusterJob test.pdf

produces valgrind errors:

==31466== Conditional jump or move depends on uninitialised value(s)
==31466== at 0x47873B: gs_shading_A_fill_rectangle_aux (gxshade1.c:256)
==31466== by 0x478B6A: gs_shading_A_fill_rectangle (gxshade1.c:301)
==31466== by 0x476374: gs_shading_do_fill_rectangle (gsshade.c:477)
==31466== by 0x4748DB: gx_dc_pattern2_fill_rectangle (gsptype2.c:243)
==31466== by 0xA442ED: gx_default_fill_path (gxfill.c:707)
==31466== by 0xA75F9C: gx_fill_path (gxpaint.c:52)
==31466== by 0x94D38A: do_fill (gspaint.c:318)
==31466== by 0x94D488: fill_with_rule (gspaint.c:352)
==31466== by 0x94D4D7: gs_fill (gspaint.c:363)
==31466== by 0xB64A36: zfill (zpaint.c:27)
==31466== by 0xB10E74: do_call_operator (interp.c:86)
==31466== by 0xB143DA: interp (interp.c:1410)
==31466== Uninitialised value was created by a stack allocation
==31466== at 0x4784DC: gs_shading_A_fill_rectangle_aux (gxshade1.c:216)

These are due to the inversion of a matrix failing, and the error
being ignored.

Fix the error handling in the function; if the inversion fails, just
don't render anything and exit. Returning an error causes content to
be lost from cluster test files.

As a side effect of this, fix gsicc_release_link to follow the
general rule for destructors that they should accept NULL without
error.

base/gsicc_cache.c
base/gsmatrix.c
base/gxshade1.c


2019-02-03 12:09:52 +0000
Chris Liddell <chris.liddell@artifex.com>
556bb1c7110ee65af5c38a32610c8dfdd9aedc43

Add non-packed capability to packps

For creating opdfread.h we normally strip comments and whitespace from the
Postscript, but that makes reading debugging the opdfread Postscript even more
unpleasant than it has to be.

This adds a "-d" option ("don't pack") to pack_ps.c.

Also adds a subtarget for opdfread.h that means invoking make thus:
make DEBUG_OPDFREAD=1

will create opdfread.h without stripping whitespace and comments, so the output
from ps2write is only baroque and less wilfully horrific.

base/pack_ps.c
devices/devs.mak


2019-02-03 12:09:04 +0000
Chris Liddell <chris.liddell@artifex.com>
7f86b6a5add79b7a32d216f5095e93112ff58506

Add copyright notice to source file

devices/gdevpdfimg.c


2019-02-04 17:01:42 +0000
Ken Sharp <ken.sharp@artifex.com>
dc685b7525c9ccea3ee59bacd6d6f25ab22d174a

pdfwrite - use the correct enumerator when handling PCL bitmap fonts

Bug #700562 "Valgrind reveals use of unitialised value in text code"

This is a follow-on from commit c47512e5e638d903d69925f7ebab4de2aa3f481f
again what we have is confusion over *which* of the two enumerators we
should be using, when we are converting fonts which we can't preserve
into type 3 fonts.

For non-PCL cases we don't need the text enumerator for the 'default'
show functions, so we specifically set pdev->pte to NULL (at around line
3477 in gdevpdtt.c). However for PCL bitmap fonts, or the GL/2 stick
font, we do need the 'default' enumerator which we create in order to
process the 'BuildGlyph' for the character.

So we need to make sure we are using the correct enumerator when we try
to read back the 'returned_glyph'.

devices/vector/gdevpdtt.c


2019-02-03 14:44:02 -0700
Henry Stiles <henry.stiles@artifex.com>
0495abb3605831147f39691701030405b44cd5d0

Fix 700565 - SetHalftoneMethod parsing is wrong.

The parameter numbering was off by one and the check for object type
should not have exited the command.

Also change the operator to not report missing attributes. This
results in changes to error test files in the Quality Logic suite,
however, we did not match the HP error report previously and don't
plan to do so. Oddly, HP reports a C file and line number in the
report, we suspect this is a bug.

pcl/pxl/pxink.c


2019-02-04 10:39:19 +0000
Ken Sharp <ken.sharp@artifex.com>
cfc80a96f5ba682d86ce2ee1375cfca5b5941fea

type 3 masked image - pacify valgrind with pdfwrite

Bug #693814 "Valgrind reports uninitialised value(s) in pdf written image streams"

The valgrind warnings are real, but essentially benign. If the wisth of
the mask data for a type 3 masked image is not a multiple of 8, then we
do not completely write to each bit of the final byte of mask data.

When writing the mask data to a PDF file, we obviously write the entire
last byte, which causes valgrind to (correctly) complain about using
uninitialised data. Of course the uninitialised bits are never actually
used, even by the PDF consumer.

We could put a PACIFY_VALGRIND around this line, but writing
uninitialised bytes means we could run the same input twice and get two
slight different PDF files, which would flag as a diff in our testing.
It would also annoy the 'reproducible builds' people, potentially.

Since its only a single byte, just clear it for reproducibility, even
when we aren't running valgrind.

base/gximage3.c


2019-02-02 16:21:48 +0000
Ken Sharp <ken.sharp@artifex.com>
ca8246f639c73127fd05b674679864a9bf2eb0d2

XPS interpreter - address a valgrind problem

Bug #700557 "valgrind error pdfwriting text from an xps file"

The fault is not in pdfwrite, its the XPS interpreter. The pdfwrite
device copies a font, which involves calling gs_c_name_glyph() to
retrieve the name of a given glyph. The expectation (because this is
making a copy of a font) is that the returned string will be persistent
and not managed by the font or pdfwrite.

In the PostScript interpreter this is managed by adding the glyph name
to the PostScript name table, which is persistent to the end of job and
then freed.

Now, the XPS interpreter supplies a routine xps_true_callback_glyph_name
which is called to retrieve the glyph name. If there is a POST table in
the font, and it has names, and we can read it, we allocate some memory
and copy the name there before returning a pointer to that memory.

If there is a POST table, but its a format which has no names, or which
we cannot deal with, then the code simply made a buffer, printed a
dummy name into it, and returned that. The problem is that as soon as
we return, the buffer we created on the stack goes out of scope leading
to the valgrind error.

It appears that in XPS (and PCL where this code originated) there is no
mechanism like ht name table, and so even when we can find a name in the
POST table, we allocate memory for it, and allow it to leak!!

See the comment at around line 263 of xpsttf.c, and note that this is
the same code as in pl_glyph_name() in plfont.c

Since this memory leak already happens for the case where the POST
table can be read, I've (reluctantly) chosen to do the same in the case
where we simply invent a glyph (PCL doesn't do this). I'm not happy
about it, and the owners of the relevant interpreters really ought to
fix this properly IMO, or we should rewrite the 'copy_glyph' method
from the fonts so that it owns the memory for the name, but this would
be a huge undertaking.

xps/xpsttf.c


2019-02-01 13:07:29 -0800
Michael Vrhel <michael.vrhel@artifex.com>
11338176d31567a5d63e49d6f91ccac7db706716

Rename pdf14 parent_color_info_procs to parent_color_info

As Ray pointed out, this structure has more than just procs in it.

base/gdevp14.c
base/gdevp14.h


2019-01-31 11:31:30 -0800
Ray Johnston <ray.johnston@artifex.com>
4ec9ca74bed49f2a82acb4bf430eae0d8b3b75c9

Hide pdfdict and GS_PDF_ProcSet (internal stuff for the PDF interp).

We now keep GS_PDF_ProcSet in pdfdict, and immediately bind pdfdict
where needed so we can undef it after the last PDF interp file has
run (pdf_sec.ps).

Resource/Init/pdf_base.ps
Resource/Init/pdf_draw.ps
Resource/Init/pdf_font.ps
Resource/Init/pdf_main.ps
Resource/Init/pdf_ops.ps
Resource/Init/pdf_sec.ps


2019-02-01 14:45:18 +0000
Ken Sharp <ken.sharp@artifex.com>
78b321cdcbc22df928f3af2772473435e4d0695a

txtwrite - fix use of incorrect index for recording Widths

When scanning multi-byte CIDFont text, we were using the text enumerator
'index' to store the widths of glyphs. However this is incorrect when
the CIDFont uses multiple bytes; the index is the byte count into the
input string, not the numebr of characters processed.

Use TextBufferIndex instead, which is correctly updated to track the
character index in the string, not the byte index.

devices/vector/gdevtxtw.c


2019-01-31 19:14:49 +0000
Robin Watts <robin.watts@artifex.com>
52cbdabc0627bbeb918ffeb5f0fe15a6922a8322

Bug 700306: Fix values returned by bbox device.

The "any part of a pixel" code in the new scan converter holds a
"cursor" position that determines where edges intersect with
the scanlines. The leftmost and rightmost positions of intersection
are held in this as values of type fixed.

The "null" cursor position is represented by using maximal/minimal
values. Unfortunately, I used {max,min}_int_in_fixed, rather than
{max,min}_fixed, which meant they weren't nearly as maximal/minimal
as they ought to have been.

This meant that the logic for inserting the real left/right hand
edges went wrong, and we output spurious positions into the
edgebuffer table. This in turn caused larger spans to be filled
to the underlying device than expected, hence upsetting the bbox.

For all other devices, there was no problem because overly large
or small values are clipped away.

base/gxscanc.c


2019-01-30 15:09:45 -0800
Nancy Durgin <nancy.durgin@artifex.com>
e1f3eb6e848498a085fbec7333cbe2a22d7be318

Undef .growfontdict

- make it an operator
- make sure all procedures that use it are executeonly
- undef in gs_init.ps

Resource/Init/gs_fonts.ps
Resource/Init/gs_init.ps
Resource/Init/gs_type1.ps


2019-01-30 14:49:10 -0800
Nancy Durgin <nancy.durgin@artifex.com>
052d8d2afc14b14efa46632f355ee24b273760f1

Undef .fontnameproperties

Used in a gs_fonts.ps and pdf_font.ps. Immediate evaluation and undef in
gs_init.ps.

Resource/Init/gs_fonts.ps
Resource/Init/gs_init.ps
Resource/Init/pdf_font.ps


2019-01-30 13:54:06 -0800
Nancy Durgin <nancy.durgin@artifex.com>
7b5031745ae7f00f9d6c653bf647330e1e1f5a9b

Undef .findfontname

Only used locally, so use immediate evaluation.

Resource/Init/gs_fonts.ps


2019-01-30 13:40:45 -0800
Nancy Durgin <nancy.durgin@artifex.com>
64cc22e15f680418c539f0f1d286168bc6d1cf75

Undef .definenativefontmap

Only used locally, so use immediate evaluation.

Resource/Init/gs_fonts.ps


2019-01-30 13:38:02 -0800
Nancy Durgin <nancy.durgin@artifex.com>
829a8c85112193116f39928568e8bf56138b7410

Undef .definemodifiedfont

This was a random procedure not actually used anywhere...

Resource/Init/gs_fonts.ps


2019-01-30 12:14:52 -0800
Nancy Durgin <nancy.durgin@artifex.com>
865e68569b194992ab097006f2884c1dc1e83d05

Undef .definefakefonts

All the comments seem to say not to bind this one, but immediate evaluation
should be fine.

Undef in gs_init.ps after all uses.

Resource/Init/gs_fonts.ps
Resource/Init/gs_init.ps


2019-01-30 12:09:43 -0800
Nancy Durgin <nancy.durgin@artifex.com>
430e219ea17a2650577d70021399c4ead05869e0

Undef .completefont

- make it an operator
- make sure all procedures that use it are executeonly
- undef in gs_init.ps

Resource/Init/gs_fonts.ps
Resource/Init/gs_init.ps
Resource/Init/gs_ttf.ps


2019-01-30 09:51:54 -0800
Nancy Durgin <nancy.durgin@artifex.com>
cdcb56ed5af686ab2e368587506f12ba071ff41e

Undef .buildnativefontmap

- make it an operator
- make sure all procedures that use it are executeonly
- undef in gs_init.ps

Resource/Init/gs_fonts.ps
Resource/Init/gs_init.ps
Resource/Init/gs_res.ps


2019-01-30 09:40:25 -0800
Nancy Durgin <nancy.durgin@artifex.com>
fe316c21cb1c9a192da58158155a56f46f1f753a

Undef .origdefinefont, .origundefinefont, .origfindfont

I don't understand why these need to be defined (in gs_res.ps) but things
break if they are not. So just undef them in gs_init.ps after all the
initialization is complete.

Resource/Init/gs_init.ps
Resource/Init/gs_res.ps


2019-01-30 09:05:55 -0800
Nancy Durgin <nancy.durgin@artifex.com>
d68c6d816d5d584ce340f9d4c827279cc4321125

Remove .glyphwidth implementation, since it isn't used anywhere

Deleted C implementation.
Made finish_stringwidth() static since it no longer needs to be exported
to zglyphwidth().

psi/ichar.h
psi/zchar.c
psi/zcharx.c


2019-01-30 08:14:58 -0800
Nancy Durgin <nancy.durgin@artifex.com>
d74962183f1929ebfab7db119d97ca0b82eb3816

Undef .findfontop

This needs to stay an operator (based on the comments), so have to undef it
in gs_init.ps.

Resource/Init/gs_init.ps


2019-01-29 21:05:41 +0000
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
412a279721c0f17d496147f3b87de873123a530e

Bug 697545 : Prevent numerous memory leaks.

Saving the desired_implmentation ensures that the correct cleanup routines are called.

Error created using :-
MEMENTO_FAILAT=1846 ./membin/gpcl6 -sDEVICE=pbmraw -dMaxBitmap=2000 -o /dev/null ./tests_private/pcl/pcl5cfts/fts.0270

pcl/pl/plmain.c


2019-01-30 09:30:37 -0800
Michael Vrhel <michael.vrhel@artifex.com>
9bf4dddd99987b45375972ee95d061cc7d3d393f

Bug 696600: psdcmykog device_procs

My earlier fix caused massive problems with any transparency files.
This should fix all the issues.

devices/gdevcmykog.c


2019-01-29 11:50:21 -0800
Ray Johnston <ray.johnston@artifex.com>
f075b380de5c2826055d092f2e4616ed6da89e87

Fix debug message 'v' output num_components_new with spot colors.

The debug message was before the new_num_components was adjusted for
num_spots.

base/gdevp14.c


2019-01-28 09:58:51 -0800
Ray Johnston <ray.johnston@artifex.com>
0dcbfa4a999fcfe154c313e1a63855b7c0355a8e

Bug 700493: Search parent Resources, if not found in Local or Page

The spec mentions that the Page Resources are inherited by a Form
Xobject (not recommended), but Adobe and mupdf find, and use, the
Resource definition in a parent (ancestor) Xobject. Recursively
search the parent Resources ONLY if it isn't found in the Form's
Resources or the Page Resources (which may include Resources of
ancestors of the Page).

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


2019-01-28 10:09:10 -0800
Ray Johnston <ray.johnston@artifex.com>
647992061fc815d29982ecbc1ad76e3e86cc714f

Fix Bug 694190 for cmykspot and custom put_image functions (fix SEGV)

When we get an error in the PDF interpreter, we can end up in the put_image
function. This check belongs in the two other pdf14 put_image functions.

base/gdevp14.c


2019-01-18 09:33:45 -0800
Ray Johnston <ray.johnston@artifex.com>
0530328c8d16e69557f8bdeafcd40d8a75f5e994

Fix SEGV found with broken PDF interpreter and Bug690770.pdf

Found accidentally when I was working on a PDF interpreter change, when
closing the pdf14 device, the smaskcolor->ref_count was decremented, but
that object had already been freed (stale pointer). The free was by a
"restore", so the smaskcolor needs to be in stable_memory so that it
will be protected from the restore. Similarly for the "profiles" of that
structure (and free both with stable_memory).

base/gdevp14.c


2019-01-29 08:31:06 -0800
Nancy Durgin <nancy.durgin@artifex.com>
13faebdf8817a99e1476736687ca2d75c002fb25

Fixed some issues with htmldiff.pl

1) I am using pngize=0. My version of bmpcmp automatically outputs in
png format. I think this reveals a bug related to file suffixes?
Anyway, I added an "outsuffix" variable and at least for my situation,
it now works. I don't know if this is a general fix or not.

2) The metafile string was built with $imstr, which isn't a defined
variable? Changed this to be $imstr1. How did this ever work?

toolbin/htmldiff.pl


2019-01-29 14:31:03 +0000
Robin Watts <robin.watts@artifex.com>
7c8f63f6765254367cb85e3bd0f3b9b1388237c7

Bug 693814: Fix valgrind error in pdf_image_plane_data_alt.

Valgrind is not smart enough to realise that <undefined_value> * 0 =
defined 0.

Thus, initialise raster to 0.

This makes the following command run without warnings:

valgrind --track-origins=yes bin/gs -sOutputFile=out.pdf
-dMaxBitmap=400000000 -sDEVICE=pdfwrite -r300 -Z:
-dNOPAUSE -dBATCH -K2000000 -dClusterJob
/home/marcos/cluster/tests_private/comparefiles/Bug692226.ps

base/gximage3.c


2019-01-29 12:51:09 +0000
Robin Watts <robin.watts@artifex.com>
14ccdd48a3ba6f546e024a21c3837dc258d1f79d

Bug 700512: Fix error from image_render_icc16.

If we render a skewed image using image_render_icc16, and the first
two pixels on the line have identical source values, the current
code would forget to do the color mapping. This would result in
a "Fatal" error coming back from the underlying pixel plot routine
which causes the whole program to exit.

The fix is simply to insist that the first pixel on a row must
always be mapped.

base/gxi12bit.c


2019-01-28 15:07:07 -0800
Robin Watts <Robin.Watts@artifex.com>
7eff21255ed7b053bb78e7654793c63943b10a01

Avoid valgrind problems with copy_landscape.

The copy_landscape routine uses memflip8x8 to transpose 8 lines
of data to be 8 columns of data.

At the end of the line, unless the width is a multiple of 8, we
therefore end up accessing uninitialised data. This trips
valgrind.

We therefore introduce a special case variant for the end of the
line, where we mask off the undefined bits.

This can be seen by doing:

make vg
bin/gs -sOutputFile=test.ps -dMaxBitmap=400000000 -sDEVICE=ps2write
-r300 -Z: -dNOPAUSE -dBATCH -K2000000 -dClusterJob
/home/marcos/cluster/tests_private/comparefiles/Bug691740.pdf
valgrind --track-origins=yes bin/gs -sOutputFile=/dev/null
-dMaxBitmap=400000000 -sDEVICE=pkmraw -r300 -Z: -dNOPAUSE
-dBATCH -K2000000 -dClusterJob test.ps

base/gsutil.c
base/gsutil.h
base/gxifast.c


2019-01-28 09:43:17 -0800
Robin Watts <Robin.Watts@artifex.com>
c79f5245d24398b6f024e5e8611882a10b2799b0

Fix strange valgrind problem; compiler error?

On peeves, the following commands produce valgrind warnings:

make vg
bin/gs -sOutputFile=out.ps -dMaxBitmap=400000000 -sDEVICE=ps2write
-r300 -Z: -dNOPAUSE -dBATCH -K2000000 -dClusterJob
/home/marcos/cluster/tests_private/comparefiles/Bug691112.pdf
valgrind --track-origins=yes bin/gs -sOutputFile=/dev/null
-dMaxBitmap=400000000 -sDEVICE=ppmraw -r300 -Z: -dNOPAUSE
-dBATCH -K2000000 -dClusterJob out.ps

Debugging shows that the "run_len" member of the RLE stream state
is not being initialised. As far as I can tell, it really out to
be.

Changing the code to use the (neater, IMHO) mechanism of initing
the stream state by calling the template init function seems to
solve this. I cannot for the life of me see why this should make
a difference, but this is a better way to work in any case.

base/gxclutil.c


2019-01-28 20:21:24 -0800
Michael Vrhel <michael.vrhel@artifex.com>
659cb78748c9f4bb4e5f45a1c07872176fba7e57

Bug 696600: psdcmykog device issues

The psdcmykog device is a DeviceN color based device but unlike psdcmyk and
tiffsep it can't change its color characteristics. It remains as
a 6 color cmykog device. Postsript files can change the maxseparations
(example 29-07E.PS) The gdevdevn code will, if it
detects a change occured, close the device and reopen (see
devn_printer_put_params) possibly resetting the color info. tiffsep
and psdcmyk, when reopened, will reset their color characteristics based upon
the content of the page, avoiding any issues upon the reopen. Here we
will need to make sure to set the color information to avoid problems.

devices/gdevcmykog.c


2019-01-27 17:40:25 -0700
Henry Stiles <henry.stiles@artifex.com>
7c3c69932c9b12526a54830cca745ceb21aebdec

Bug 700492 - xl readImage IllegalAttributeValue.

Support switching compression schemes within a single image. We now
allow switching between lossless modes (uncompressed, rle and
delta-row) but do not allow changing to jpeg compression.
Interleaving lossy and lossless compression within a single image is
not expected in practice.

pcl/pxl/pximage.c


2019-01-28 10:45:58 -0800
Michael Vrhel <michael.vrhel@artifex.com>
6476023744d256b12ea11bff3e121104df99f426

Bug 695046: icc profile not found

When the code is compiled without compile inits the icc profiles
associated with enumerated color spaces in jpx images could not
be found.

base/gsicc_manage.c
base/gsicc_manage.h


2019-01-28 14:16:35 +0000
Robin Watts <robin.watts@artifex.com>
c52f058c6d5c912d9d9da609929b4cd306e2760e

pdfwrite: Avoid valgrind errors when comparing image lines.

Within pdf_dump_converted_image we compare scanlines of image data
to the next one. Unfortunately, if scanlines aren't an exact number
of bytes wide, we have uninitialised bits at the end, which can a)
cause spurious mismatches, and b) cause valgrind errors, such as
seen with the following:

make vg
valgrind --track-origins=yes bin/gs -sOutputFile=out.ps
-dMaxBitmap=400000000 -sDEVICE=ps2write -r300 -Z: -dNOPAUSE
-dBATCH -K2000000 -dClusterJob
/home/marcos/cluster/tests_private/comparefiles/Bug690237.pdf

Here we simply use a modified line comparison routine to test
the exact set of bits required.

devices/vector/gdevpdfd.c


2019-01-22 09:37:43 +0000
Robin Watts <robin.watts@artifex.com>
b092266152f2c43f7f5bb195bf9ef37afa46996b

Fix buffer overread in cmd_compress_bitmap.

The following commands:

make debugvg
debugbin/gs -sOutputFile=/dev/null -dMaxBitmap=400000000 -sDEVICE=ppmraw
-r300 -Z: -dNOPAUSE -dBATCH -K2000000 -dClusterJob out2.ps

cause a read of uninitialised data in cmd_compress_bitmap.

Painstaking debugging shows that the problem is due to an overread
at the end of a bitmap line.

cmd_put_bits is called with 408 bits of bitmap data. This passes the
details into clist_bitmap_bytes, and is told that uncompressed_raster
should be 448 bits.

It then passes this side into cmd_compress_bitmap, which causes the
buffer overread.

The interesting point is that this call is:

status = cmd_compress_bitmap((stream_state *) & sstate, data,
uncompressed_raster << 3 /*width_bits */ ,
raster, height, &w);

which suggests that at some point in the past we were passing the
correct value of width_bits in, and we then changed to passing
the wrong width in.

Sadly, there is no hint in the commit record as to WHY this changed.
This line dates back to the earliest commit we have in source control
in 1998, so it looks like it hasn't changed for a while.

This is only the first part of the problem, though; once in
cmd_compress_bitmap, the value is fed into bitmap_raster() which again
rounds it up so it reads off the end of the defined data.

We therefore rework cmd_compress_bitmap. We specifically only compress
the actual bits of data that we have, and ensure that any padding bits
(or bytes) are correctly sent as constant zeros.

As well as assugaging valgrind, and preventing potential genuine
(if unlikely) buffer overreads, this ensures that we should get
repeatable results on each successive run.

base/gxclbits.c


2019-01-23 16:13:17 +0000
Robin Watts <robin.watts@artifex.com>
f78601f3d8df7ed16550d834cbf2c440804a6f41

Rework RunLengthEncoder.

The existing RunLengthEncoder relies on being able to read ahead
a few bytes, and then decide that it wants to ask the caller for
more data.

Unfortunately, this means that the clist cmd_compress_bitmap routine
can only call it in the "here is all the data in a solid block" case,
not in the "here is the data a line at a time" case.

This will become even more of a limitation when I rework
cmd_compress_bitmap to avoid overrun reads in a future commit.

The primary difference here is that we never backtrack on our reads
within the compression routine. We keep the last 1, 2 or 3 bytes
read in the state as n0, n1 and n2, and we insert literal bytes into a
array within the state for copying out later.

Because we now allow cmd_compress_bitmap to run in cases when it
didn't before, we trip over a bug in there. If height > 0 and
raster < width_bytes (for instance when raster = 0, so we can repeat
the same line several times), on 64bit builds the pointer
arithmetic goes wrong, and we end up accessing illegal memory.
Fix with a simple cast to int.

base/gxclbits.c
base/srle.c
base/srlx.h


2019-01-28 09:37:36 +0000
Ken Sharp <ken.sharp@artifex.com>
290ad1e4321ee46d34e7f6fdc6936e909092f7d5

txtwrite - forcibly disable interpolation

Bug #700525 "/unknownerror in --imagemask-- on txtwrite device"

If we have interpolation on, and we get an imagemask, then the rendering
code tries to use get_bits() to perform the interpolation. This
obviously doesn't work with a non-rendering device.

The simplest solution is to disable interpolation, which isn't in any
even useful on a non-rendering device.

devices/vector/gdevtxtw.c


2019-01-17 15:11:56 -0800
Nancy Durgin <nancy.durgin@artifex.com>
946025aa4219d2a386ff0ca5b48e7be71d86b81f

Undef/hide internal operators in gs_typ42.ps

Undef internal .type42build, only used locally.

Make %Type42BuildChar and %Type42BuidlGlyph executeonly to properly hide
.type42execchar.

Resource/Init/gs_typ42.ps


2019-01-17 14:28:28 -0800
Nancy Durgin <nancy.durgin@artifex.com>
9be4230804851ee1cba0aebc97e98f12bc885593

Undef/hide internal operators from gs_type1.ps

/.loadfont1 -- used locally, rearranged code so def is before use
/.type1build -- end of file has some optional code (it may skip to EOF),
so I just undef'd it in gs_init.ps

Made %Type1BuildChar, %Type1BuildGlyph, %Type2BuildChar, %Type2BuildGlyph
executeonly to properly hide .type1execchar and .type2execchar.

Resource/Init/gs_init.ps
Resource/Init/gs_type1.ps


2019-01-17 12:18:26 -0800
Nancy Durgin <nancy.durgin@artifex.com>
e6feb75ec94d7102440a2b86ce16841b3e3023af

Undef/hide internal operators in gs_cidfn.ps

/.checkfonttype
/.loadcidfontresource
/.readglyphdata

Make %Type9BuildGlyph and %Type11BuildGlyph funcs executeonly to
properly hide the '.type*execchar' operators that they call.

Resource/Init/gs_cidfn.ps


2019-01-17 09:31:17 -0800
Nancy Durgin <nancy.durgin@artifex.com>
95ac05d50f5af5f81f0ab2e0e0731a65ad59085e

undef .composefontdict from gs_cmap.ps

Resource/Init/gs_cmap.ps
Resource/Init/gs_init.ps


2019-01-16 12:55:22 -0800
Nancy Durgin <nancy.durgin@artifex.com>
2905c901244a3c105560a48ae3047196961920d7

Undef internal operators from gs_cff.ps

- rearranged some code in gs_cff.ps to have things defined before used
- /.init_wOFF_otto_font_file is only used locally, undef right after use
- /.init_otto_font_file is used by pdf_fonts.ps, undef in gs_init.ps

/.init_otto_font_file was being defined after it was used, because
gs_cff.ps was run after pdf_fonts.ps. Need to define before using, in
order to be able to undef, so had to change psi/int.mak to load
gs_cff.ps before pdf_fonts.ps. Also moved around the cff.dev dependencies
accordingly.

NOTE: To see what order the files will be loaded, you can look at
obj/iconfig.h which is generated by the makefile magic. You can also
look at the INITFILES array in gs_init.ps, which the stuff in
iconfig.h eventually generates.

Resource/Init/gs_cff.ps
Resource/Init/gs_init.ps
psi/int.mak


2019-01-23 12:00:30 -0800
Nancy Durgin <nancy.durgin@artifex.com>
e7ff64cf9b756278f19c87d295ee0fd95c955c05

Fixed bug caused by the way .checksetparams was undef'd

Previously, had undef'd it by making it an operator.
Now just use an immediate reference and undef it in the gs_lev2.ps file.

This fixes bug introduced in commit fe4c47d8e25d6366ecbb5ff487348148b908a89e.

Undef'ing .checksetparams by making it an operator doesn't work right because
errors report .checksetparams as the offending function instead of
the operator that uses it (setsystemparams in this case).

This caused an error in file /tests_private/ps/ps3cet/27-09.PS on page 3,
where it reports the offending function of some error-handling tests.
Reporting function should be 'setsystemparams', not '.checksetparams' on
this page.

Resource/Init/gs_init.ps
Resource/Init/gs_lev2.ps


2019-01-24 15:33:37 +0000
Ken Sharp <ken.sharp@artifex.com>
e51c447b690c233b6299e68f9c031a32c61cc263

pdfwrite - detecting duplicate images, check for pending masks

Bug #700495 "gs/gpdl difference with pdfwrite"

This exhibits with gpdl but not gs because, for some unknown reason, the
MD5 sums from gpdl differ in a few cases from those returned by GS,
I have no idea why.

But that's not the problem, so I'm ignoring it for now.

The real problem is that when we have an image which has an associated
Mask or SMask, when checking to see if it is a duplicate of a prior
image, we were not checking to see if the prior image also had a Mask
or SMask (as appropriate) which could lead to us emitting an image
with a missing mask.

We cater for that now in smask_image_check. Also not strictly part of
this problem, when we did add a Mask or SMask to a stream cos object, we
didn't invalidate its MD5, which could mean it would match a later image
when it should not. So set the md5_valid flag to 0 when we add a mask
entry to the cos object.

On the cluster this show progressions with two files, image-qa.ps and
692217.pdf (drop shadows were previously missing)

Note that the previous output for image-qa.ps was incorrect with both
gs *and* gpdl.

devices/vector/gdevpdfi.c
devices/vector/gdevpdfj.c


2019-01-24 08:45:51 +0000
Chris Liddell <chris.liddell@artifex.com>
3c952a9bde27766af4832435e62fcb659df1ee1f

Bug 700500: Check Type 3 fonts for transparency

The transparency checking code didn't check Type 3 font resources for
transparency settings, thus we could miss those, and fail to push the
compositor device.

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


2019-01-23 18:59:19 -0800
Michael Vrhel <michael.vrhel@artifex.com>
f5cb0ef75fc11bb65a63a1af35ee2edc94656bb4

Bug 693787 Valgrind issue

An error code was not returned when it was encountered
leading to the use of uninitialized values.

base/gxshade4.c


2019-01-23 11:52:19 -0800
Michael Vrhel <michael.vrhel@artifex.com>
aad16609bbc3476c56fa8ab8b52b64c1653594d4

Bug 693816 Valgrind issue

During CMYK color space install unset the device color
to ensure that any of the overprint checking is not
invoked with unknown values.

psi/zcolor.c


2019-01-22 13:34:32 -0800
Michael Vrhel <michael.vrhel@artifex.com>
4cf03307489c9c27da77607821598ded1aa14e73

Bug 694243 Valgrind issue

During the creation of the transparency buffer information we were
exiting if the width or height were zero. We needed to fill in
a few more items (like the width and the height) before doing so
as they are tested elsewhere.

base/gdevp14.c


2019-01-11 13:36:36 +0000
Chris Liddell <chris.liddell@artifex.com>
49c8092da88ef6bb0aa281fe294ae0925a44b5b9

Remove .forcedef, and harden .force* ops more

Remove .forcedef and replace all uses with a direct call to .forceput instead.

Ensure every procedure (named and trasient) that calls .forceput is
executeonly.

Resource/Init/gs_dps1.ps
Resource/Init/gs_init.ps
Resource/Init/gs_lev2.ps
Resource/Init/gs_ll3.ps
Resource/Init/gs_res.ps
Resource/Init/gs_statd.ps


2019-01-09 14:24:07 +0000
Chris Liddell <chris.liddell@artifex.com>
2768d1a6dddb83f5c061207a7ed2813999c1b5c9

Undefine a bunch of gs_fonts.ps specific procs

Also reorder and add some immediate evaluation, so it still works with the
undefining.

Resource/Init/gs_dps1.ps
Resource/Init/gs_fonts.ps
Resource/Init/gs_res.ps


2018-12-18 10:42:10 +0000
Chris Liddell <chris.liddell@artifex.com>
59d8f4deef90c1598ff50616519d5576756b4495

Harden some uses of .force* operators

by adding a few immediate evalutions

Resource/Init/gs_dps1.ps
Resource/Init/gs_fonts.ps
Resource/Init/gs_init.ps


2018-12-15 09:08:32 +0000
Chris Liddell <chris.liddell@artifex.com>
99f13091a3f309bdc95d275ea9fec10bb9f42d9a

Bug700317: Fix logic for an older change

Unlike almost every other function in gs, dict_find_string() returns 1 on
success 0 or <0 on failure. The logic for this case was wrong.

psi/interp.c


2018-12-13 15:28:34 +0000
Chris Liddell <chris.liddell@artifex.com>
2db98f9c66135601efb103d8db7d020a672308db

Any transient procedures that call .force* operators

(i.e. for conditionals or loops) make them executeonly.

Resource/Init/gs_diskn.ps
Resource/Init/gs_dps1.ps
Resource/Init/gs_fntem.ps
Resource/Init/gs_fonts.ps
Resource/Init/gs_init.ps
Resource/Init/gs_lev2.ps
Resource/Init/gs_pdfwr.ps
Resource/Init/gs_res.ps
Resource/Init/gs_setpd.ps
Resource/Init/pdf_base.ps
Resource/Init/pdf_draw.ps
Resource/Init/pdf_font.ps
Resource/Init/pdf_main.ps
Resource/Init/pdf_ops.ps


2018-12-05 12:22:13 +0000
Chris Liddell <chris.liddell@artifex.com>
13b0a36f8181db66a91bcc8cea139998b53a8996

Sanitize op stack for error conditions

We save the stacks to an array and store the array for the error handler to
access.

For SAFER, we traverse the array, and deep copy any op arrays (procedures). As
we make these copies, we check for operators that do *not* exist in systemdict,
when we find one, we replace the operator with a name object (of the form
"/--opname--").

psi/int.mak
psi/interp.c
psi/istack.c
psi/istack.h


2019-01-23 11:45:16 +0000
Ken Sharp <ken.sharp@artifex.com>
c47512e5e638d903d69925f7ebab4de2aa3f481f

pdfwrite - sort out a type confusion

Bug #700490 "gs_text_enum_t used as pdf_text_enum_t"

There seems to have been 2 sources of confusion here; this falls into
the 'how did this ever work' category.

The problem only occurs when we are forced to go to a bitmap font, which
for PostScript and PDF input is very rare, but for PCL there are several
font types we cannot support and so we must make bitmapped fonts for
them.

We use a pointer in the pdfwrite device structure to store a pointer to
the text enumerator, but we store the *wrong* enumerator. We store
pte_default, which is the enumerator we just created for the standard
test processing. We don't need to store that one, its available as the
argument to all the procedures. What we need access to is the original
text enumerator, the pdfwrite one, and its that one we should be storing
in the device structure.

There was similar confusion in pdf_text_set_cache, which set penum to
'pte' casting it to a pdf_text_enum * in the process. This is clearly
wrong in the case of making a bitmap font, because we made a standard
text enumerator and passed that in, so 'pte' won't be a pdf text
enumerator.

Now it is possible to exercise a different code path and arrive at
pdf_text_set_cache with a pdf_text_enumerator. There is no other way
to arrive here.

So we check pdev->pte (where we would have stored the original pdf
text enumerator) and if its not NULL we use it as a pdf text enumerator.
If it is NULL, then we believe the enumerator pte should he a pdf
text enumerator and cast it as such. Also add a check to ensure that
the enumerator from the arguments *is* a pdf_text enumerator to avoid
this confusion in future.

Finally, clean up a couple of minor compiler warnings in passing.

devices/vector/gdevpdtt.c


2019-01-22 17:31:33 +0000
Robin Watts <robin.watts@artifex.com>
79589242c72d432f06c7a5f545989362564ab57e

Add a couple of helpful perl scripts for valgrind testing.

vdb.pl automates the running of valgrind jobs under gdb, and
multiplexes the output from valgrind and gdb together.

vgbatch.pl automates the running of a list of "cluster like"
tests under valgrind.

toolbin/vdb.pl
toolbin/vgbatch.pl


2019-01-21 16:57:10 +0000
Robin Watts <robin.watts@artifex.com>
882343089e6c9ec2a4ce574cd7198281706b2f21

Fix valgrind problem in pdfwrite.

The following command:

gs -sOutputFile=out2.ps -dMaxBitmap=400000000 -sDEVICE=ps2write -r72
-Z: -dNOPAUSE -dBATCH -K2000000 -dClusterJob
/home/marcos/cluster/tests_private/comparefiles/Bug690837.pdf

shows problems where we call dash_pattern_eq on uninitialised data.

It looks very much to me like pdf_load_viewer_state fails to copy
the dash data, despite allocating space for it. We fix that here.

Also, we never check whether the allocation fails or not. Add some
error checking.

devices/vector/gdevpdfg.c


2019-01-19 12:45:45 +0000
Robin Watts <robin.watts@artifex.com>
f612df16597bbae73707d0dc9a90235b3de26c6e

Preemptively fix more potential valgrind problems.

Again, while we know that a+b = a|b when (a&b)==0 (ignoring
overflow), valgrind is not that smart, and can hence incorrectly
get undefinedness calculations wrong.

Fix cases in gdevm2 that look wrong, in the same way as the
previous commit fixed gdevm1.

base/gdevm2.c


2019-01-19 04:32:18 -0800
Robin Watts <Robin.Watts@artifex.com>
d1a355ecf8adfce6758638aa79bc9f5338fc1e64

Bug 693784: Tweak copy_mono code for valgrind.

We are smart enough to know that doing a+b is the same as
doing a|b when (a&b)=0 (ignoring overflow). Valgrind is not.

Accordingly our "bit fetching and skewing" code, when run
under valgrind can introduce spurious "undefined" status
to bits when it should not.

The fix is just to use | when we really mean |.

This makes:

debugbin/gs -sOutputFile=out.pkm -dMaxBitmap=400000000
-sDEVICE=pkmraw -r300 -sDEFAULTPAPERSIZE=letter
-dNOPAUSE -dBATCH -K1000000 -dClusterJob -dJOBSERVER
tests/Ghent_V3.0/010_CMYK_OP_x3.pdf

run to completion with no valgrind warnings.

base/gdevm1.c


2019-01-17 14:27:07 +0000
Robin Watts <robin.watts@artifex.com>
8176af6bdcf8c9d3e80862965d02ed4e71b02236

Bug 693747: Fix valgrind problem.

In the image scaling code, we use interpolate_scaled_expanded_height
to calculate a value that will only be used if abs_interp_limit > 1.

The setup code only bothers to initialise the values used for this
calculation if abs_interp_limit > 1, hence valgrind complains that
this is using undefined values.

The simple fix is to only calculate the values if they might be
used.

base/gxiscale.c


2019-01-16 17:56:39 +0000
Robin Watts <robin.watts@artifex.com>
1d0582d65fcb8760628c80a25cd0ff6a0d2db65b

GPDL: Tweak PS device init for subclassing.

Subclassing doesn't work with gpdl. For example:

gpdl -sDEVICE=pdfwrite -o out.pdf -dFirstPage=3 lib/image-qa.ps

The device is correctly subclassed on an open, but then we use
zcurrentoutputdevice to find the device for us to setdevice it.
This finds the childmost (i.e. pdfwrite) device, rather than
first_lastpage.

Here, we use zcurrentdevice instead.

psi/imain.c


2019-01-16 15:34:53 +0000
Robin Watts <robin.watts@artifex.com>
6cee9657ff63ed555e6092f7eded544189d078d5

Valgrind: tweak sample_unpack functions to avoid false positive UMRs.

The "sample_unpack" template functions rely on unpacking whole
bytes at a time. Sometimes, the ends of these buffers of bytes
may have bits that are (intentionally, and permissibly) undefined.

Update the code so that in PACIFY_VALGRIND builds we cope with
these undefined bits, and carry the undefinedness over into the
output.

base/gxsamplp.h


2019-01-16 15:10:56 +0000
Chris Liddell <chris.liddell@artifex.com>
4cf2ad7ad15bd52472a342c979bdd48315c43155

Update source/header file copyright notice to 2019

Makefile.in
Resource/CIDFont/ArtifexBullet
Resource/ColorSpace/DefaultCMYK
Resource/ColorSpace/DefaultGray
Resource/ColorSpace/DefaultRGB
Resource/ColorSpace/TrivialCMYK
Resource/ColorSpace/sGray
Resource/ColorSpace/sRGB
Resource/Decoding/FCO_Dingbats
Resource/Decoding/FCO_Symbol
Resource/Decoding/FCO_Unicode
Resource/Decoding/FCO_Wingdings
Resource/Decoding/Latin1
Resource/Decoding/StandardEncoding
Resource/Decoding/Unicode
Resource/Encoding/CEEncoding
Resource/Encoding/ExpertEncoding
Resource/Encoding/ExpertSubsetEncoding
Resource/Encoding/NotDefEncoding
Resource/Encoding/Wingdings
Resource/Init/FCOfontmap-PCLPS2
Resource/Init/Fontmap.GS
Resource/Init/gs_agl.ps
Resource/Init/gs_btokn.ps
Resource/Init/gs_cff.ps
Resource/Init/gs_cidcm.ps
Resource/Init/gs_ciddc.ps
Resource/Init/gs_cidfm.ps
Resource/Init/gs_cidfn.ps
Resource/Init/gs_cidtt.ps
Resource/Init/gs_cmap.ps
Resource/Init/gs_cspace.ps
Resource/Init/gs_dbt_e.ps
Resource/Init/gs_diskn.ps
Resource/Init/gs_dps1.ps
Resource/Init/gs_dps2.ps
Resource/Init/gs_dscp.ps
Resource/Init/gs_epsf.ps
Resource/Init/gs_fapi.ps
Resource/Init/gs_fntem.ps
Resource/Init/gs_fonts.ps
Resource/Init/gs_frsd.ps
Resource/Init/gs_icc.ps
Resource/Init/gs_il1_e.ps
Resource/Init/gs_init.ps
Resource/Init/gs_lev2.ps
Resource/Init/gs_ll3.ps
Resource/Init/gs_mex_e.ps
Resource/Init/gs_mgl_e.ps
Resource/Init/gs_mro_e.ps
Resource/Init/gs_pdf_e.ps
Resource/Init/gs_pdfwr.ps
Resource/Init/gs_res.ps
Resource/Init/gs_resmp.ps
Resource/Init/gs_setpd.ps
Resource/Init/gs_statd.ps
Resource/Init/gs_std_e.ps
Resource/Init/gs_sym_e.ps
Resource/Init/gs_trap.ps
Resource/Init/gs_ttf.ps
Resource/Init/gs_typ32.ps
Resource/Init/gs_typ42.ps
Resource/Init/gs_type1.ps
Resource/Init/gs_wan_e.ps
Resource/Init/pdf_base.ps
Resource/Init/pdf_draw.ps
Resource/Init/pdf_font.ps
Resource/Init/pdf_main.ps
Resource/Init/pdf_ops.ps
Resource/Init/pdf_rbld.ps
Resource/Init/pdf_sec.ps
Resource/SubstCID/CNS1-WMode
Resource/SubstCID/GB1-WMode
Resource/SubstCID/Japan1-WMode
Resource/SubstCID/Korea1-WMode
arch/arch_autoconf.h.in
arch/windows-arm-msvc.h
arch/windows-x64-msvc.h
arch/windows-x86-msvc.h
base/all-arch.mak
base/assert_.h
base/bench.c
base/claptrap-impl.h
base/claptrap.h
base/ctype_.h
base/dirent_.h
base/dos_.h
base/echogs.c
base/errno_.h
base/ets.h
base/ets_tm.h
base/expat.mak
base/fapi_bs.mak
base/fapi_ft.c
base/fapibstm.c
base/fapiufst.c
base/fcntl_.h
base/freetype.mak
base/gconf.c
base/gconf.h
base/gdbflags.h
base/gdebug.h
base/gdevabuf.c
base/gdevbbox.c
base/gdevbbox.h
base/gdevdbit.c
base/gdevdcrd.c
base/gdevdcrd.h
base/gdevddrw.c
base/gdevddrw.h
base/gdevdevn.c
base/gdevdevn.h
base/gdevdevnprn.h
base/gdevdflt.c
base/gdevdgbr.c
base/gdevdrop.c
base/gdevdsha.c
base/gdevemap.c
base/gdevepo.c
base/gdevepo.h
base/gdevflp.c
base/gdevflp.h
base/gdevhit.c
base/gdevkrnlsclass.c
base/gdevkrnlsclass.h
base/gdevm1.c
base/gdevm16.c
base/gdevm2.c
base/gdevm24.c
base/gdevm32.c
base/gdevm4.c
base/gdevm40.c
base/gdevm48.c
base/gdevm56.c
base/gdevm64.c
base/gdevm8.c
base/gdevmem.c
base/gdevmem.h
base/gdevmpla.c
base/gdevmpla.h
base/gdevmplt.c
base/gdevmplt.h
base/gdevmr1.c
base/gdevmr2n.c
base/gdevmr8n.c
base/gdevmrop.h
base/gdevmrun.c
base/gdevmrun.h
base/gdevmx.c
base/gdevnfwd.c
base/gdevoflt.c
base/gdevoflt.h
base/gdevp14.c
base/gdevp14.h
base/gdevpccm.c
base/gdevpccm.h
base/gdevpipe.c
base/gdevplnx.c
base/gdevplnx.h
base/gdevppla.c
base/gdevppla.h
base/gdevprn.c
base/gdevprn.h
base/gdevpxat.h
base/gdevpxen.h
base/gdevpxop.h
base/gdevrops.c
base/gdevsclass.c
base/gdevsclass.h
base/gdevvec.c
base/gdevvec.h
base/gen_ordered.c
base/gen_ordered.h
base/genarch.c
base/genconf.c
base/gendev.c
base/genht.c
base/gp.h
base/gp_dosfe.c
base/gp_dosfs.c
base/gp_dvx.c
base/gp_getnv.c
base/gp_mktmp.c
base/gp_msdll.c
base/gp_msdos.c
base/gp_mshdl.c
base/gp_mslib.c
base/gp_mspol.c
base/gp_msprn.c
base/gp_mswin.c
base/gp_mswin.h
base/gp_nsync.c
base/gp_ntfs.c
base/gp_nxpsprn.c
base/gp_os2.c
base/gp_os2.h
base/gp_os2fs.c
base/gp_os2pr.c
base/gp_os9.c
base/gp_paper.c
base/gp_psync.c
base/gp_stdia.c
base/gp_stdin.c
base/gp_strdl.c
base/gp_unifn.c
base/gp_unifs.c
base/gp_unix.c
base/gp_upapr.c
base/gp_vms.c
base/gp_wgetv.c
base/gp_win32.c
base/gp_wpapr.c
base/gp_wsync.c
base/gp_wutf8.c
base/gp_wxpsprn.cpp
base/gpcheck.h
base/gpgetenv.h
base/gpmisc.c
base/gpmisc.h
base/gpsync.h
base/gs.mak
base/gs_dll_call.h
base/gs_mgl_e.h
base/gs_mro_e.h
base/gsalloc.c
base/gsalloc.h
base/gsalpha.c
base/gsalpha.h
base/gsalphac.c
base/gsalphac.h
base/gsargs.c
base/gsargs.h
base/gsbitcom.c
base/gsbitmap.h
base/gsbitops.c
base/gsbitops.h
base/gsbittab.c
base/gsbittab.h
base/gsccode.h
base/gsccolor.h
base/gscdef.c
base/gscdefs.h
base/gscdevn.c
base/gscdevn.h
base/gscedata.c
base/gscedata.h
base/gscencs.c
base/gscencs.h
base/gschar.c
base/gschar.h
base/gschar0.c
base/gscicach.c
base/gscicach.h
base/gscie.c
base/gscie.h
base/gsciemap.c
base/gscindex.h
base/gsclipsr.c
base/gsclipsr.h
base/gscms.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/gscompt.h
base/gscoord.c
base/gscoord.h
base/gscparam.c
base/gscpixel.c
base/gscpixel.h
base/gscpm.h
base/gscrd.c
base/gscrd.h
base/gscrdp.c
base/gscrdp.h
base/gscrypt1.c
base/gscrypt1.h
base/gscscie.c
base/gscsel.h
base/gscsepr.c
base/gscsepr.h
base/gscspace.c
base/gscspace.h
base/gscssub.c
base/gscssub.h
base/gsdcolor.h
base/gsdevice.c
base/gsdevice.h
base/gsdevmem.c
base/gsdll.h
base/gsdllwin.h
base/gsdparam.c
base/gsdps1.c
base/gsdsrc.c
base/gsdsrc.h
base/gsequivc.c
base/gsequivc.h
base/gserrors.h
base/gsexit.h
base/gsfcid.c
base/gsfcid2.c
base/gsfcmap.c
base/gsfcmap.h
base/gsfcmap1.c
base/gsflip.c
base/gsflip.h
base/gsfname.c
base/gsfname.h
base/gsfont.c
base/gsfont.h
base/gsfont0.c
base/gsfont0c.c
base/gsform1.h
base/gsfunc.c
base/gsfunc.h
base/gsfunc0.c
base/gsfunc0.h
base/gsfunc3.c
base/gsfunc3.h
base/gsfunc4.c
base/gsfunc4.h
base/gsgc.h
base/gsgcache.c
base/gsgcache.h
base/gsgdata.c
base/gsgdata.h
base/gsgstate.c
base/gsgstate.h
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.h
base/gsicc_cache.c
base/gsicc_cache.h
base/gsicc_cms.h
base/gsicc_create.c
base/gsicc_create.h
base/gsicc_lcms2.c
base/gsicc_lcms2mt.c
base/gsicc_manage.c
base/gsicc_manage.h
base/gsicc_monitorcm.c
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/gsinit.c
base/gsio.h
base/gsiodev.c
base/gsiodevs.c
base/gsiodisk.c
base/gsioram.c
base/gsiorom.c
base/gsiorom.h
base/gsipar3x.h
base/gsiparam.h
base/gsiparm3.h
base/gsiparm4.h
base/gsjconf.h
base/gsjmorec.h
base/gslib.c
base/gslib.h
base/gslibctx.c
base/gslibctx.h
base/gsline.c
base/gsline.h
base/gslparam.h
base/gsmalloc.c
base/gsmalloc.h
base/gsmatrix.c
base/gsmatrix.h
base/gsmchunk.c
base/gsmchunk.h
base/gsmdebug.h
base/gsmemory.c
base/gsmemory.h
base/gsmemraw.h
base/gsmemret.c
base/gsmemret.h
base/gsmisc.c
base/gsnamecl.c
base/gsnamecl.h
base/gsncdummy.c
base/gsncdummy.h
base/gsnogc.c
base/gsnogc.h
base/gsnotify.c
base/gsnotify.h
base/gsovrc.c
base/gsovrc.h
base/gspaint.c
base/gspaint.h
base/gsparam.c
base/gsparam.h
base/gsparam2.c
base/gsparams.c
base/gsparams.h
base/gsparamx.c
base/gsparamx.h
base/gspath.c
base/gspath.h
base/gspath1.c
base/gspath2.h
base/gspcolor.c
base/gspcolor.h
base/gspenum.h
base/gspmdrv.c
base/gspmdrv.h
base/gspmdrv.rc
base/gsptype1.c
base/gsptype1.h
base/gsptype2.c
base/gsptype2.h
base/gsrect.h
base/gsrefct.h
base/gsromfs0.c
base/gsrop.c
base/gsrop.h
base/gsroprun.c
base/gsroprun1.h
base/gsroprun24.h
base/gsroprun8.h
base/gsropt.h
base/gsroptab.c
base/gsserial.c
base/gsserial.h
base/gsshade.c
base/gsshade.h
base/gssprintf.h
base/gsstate.c
base/gsstate.h
base/gsstrl.h
base/gsstrtok.h
base/gsstruct.h
base/gsstype.h
base/gstext.c
base/gstext.h
base/gstiffio.c
base/gstiffio.h
base/gstparam.h
base/gstrans.c
base/gstrans.h
base/gstrap.c
base/gstrap.h
base/gstype1.c
base/gstype1.h
base/gstype2.c
base/gstype42.c
base/gstypes.h
base/gsuid.h
base/gsutil.c
base/gsutil.h
base/gswin.rc
base/gsxfont.h
base/gx.h
base/gxacpath.c
base/gxalloc.h
base/gxalpha.h
base/gxarith.h
base/gxband.h
base/gxbcache.c
base/gxbcache.h
base/gxbitfmt.h
base/gxbitmap.h
base/gxbitops.h
base/gxblend.c
base/gxblend.h
base/gxblend1.c
base/gxccache.c
base/gxccman.c
base/gxcdevn.h
base/gxchar.c
base/gxchar.h
base/gxchrout.c
base/gxchrout.h
base/gxcht.c
base/gxcid.h
base/gxcie.h
base/gxcindex.h
base/gxclbits.c
base/gxcldev.h
base/gxclfile.c
base/gxclimag.c
base/gxclio.h
base/gxclip.c
base/gxclip.h
base/gxclip2.c
base/gxclip2.h
base/gxclipm.c
base/gxclipm.h
base/gxclipsr.h
base/gxclist.c
base/gxclist.h
base/gxcllzw.c
base/gxclmem.c
base/gxclmem.h
base/gxclpage.c
base/gxclpage.h
base/gxclpath.c
base/gxclpath.h
base/gxclrast.c
base/gxclread.c
base/gxclrect.c
base/gxclthrd.c
base/gxclthrd.h
base/gxclutil.c
base/gxclzlib.c
base/gxcmap.c
base/gxcmap.h
base/gxcolor2.h
base/gxcomp.h
base/gxcoord.h
base/gxcpath.c
base/gxcpath.h
base/gxcspace.h
base/gxctable.c
base/gxctable.h
base/gxcvalue.h
base/gxdcconv.c
base/gxdcconv.h
base/gxdcolor.c
base/gxdcolor.h
base/gxdda.h
base/gxdevbuf.h
base/gxdevcli.h
base/gxdevice.h
base/gxdevmem.h
base/gxdevndi.c
base/gxdevrop.h
base/gxdevsop.h
base/gxdht.h
base/gxdhtres.h
base/gxdhtserial.c
base/gxdhtserial.h
base/gxdither.h
base/gxdownscale.c
base/gxdownscale.h
base/gxdtfill.h
base/gxfapi.c
base/gxfapi.h
base/gxfapiu.c
base/gxfapiu.h
base/gxfarith.h
base/gxfcache.h
base/gxfcid.h
base/gxfcmap.h
base/gxfcmap1.h
base/gxfill.c
base/gxfill.h
base/gxfillsl.h
base/gxfilltr.h
base/gxfillts.h
base/gxfixed.h
base/gxfmap.h
base/gxfont.h
base/gxfont0.h
base/gxfont0c.h
base/gxfont1.h
base/gxfont42.h
base/gxfrac.h
base/gxftype.h
base/gxfunc.h
base/gxgetbit.h
base/gxgstate.h
base/gxhintn.c
base/gxhintn.h
base/gxhintn1.c
base/gxhldevc.c
base/gxhldevc.h
base/gxht.c
base/gxht.h
base/gxht_thresh.c
base/gxht_thresh.h
base/gxhtbit.c
base/gxhttile.h
base/gxhttype.h
base/gxi12bit.c
base/gxi16bit.c
base/gxiclass.h
base/gxicolor.c
base/gxidata.c
base/gxifast.c
base/gximag3x.c
base/gximag3x.h
base/gximage.c
base/gximage.h
base/gximage1.c
base/gximage3.c
base/gximage3.h
base/gximage4.c
base/gximask.c
base/gximask.h
base/gximono.c
base/gxiodev.h
base/gxiparam.h
base/gxipixel.c
base/gxiscale.c
base/gxline.h
base/gxlum.h
base/gxmatrix.h
base/gxmclip.c
base/gxmclip.h
base/gxobj.h
base/gxoprect.c
base/gxoprect.h
base/gxp1fill.c
base/gxp1impl.h
base/gxpaint.c
base/gxpaint.h
base/gxpath.c
base/gxpath.h
base/gxpath2.c
base/gxpcache.h
base/gxpcmap.c
base/gxpcolor.h
base/gxpcopy.c
base/gxpdash.c
base/gxpflat.c
base/gxrplane.h
base/gxsample.c
base/gxsample.h
base/gxsamplp.h
base/gxscanc.c
base/gxscanc.h
base/gxshade.c
base/gxshade.h
base/gxshade1.c
base/gxshade4.c
base/gxshade4.h
base/gxshade6.c
base/gxstate.h
base/gxstdio.h
base/gxstroke.c
base/gxsync.c
base/gxsync.h
base/gxtext.h
base/gxtmap.h
base/gxttf.h
base/gxttfb.c
base/gxttfb.h
base/gxtype1.c
base/gxtype1.h
base/gxxfont.h
base/gzacpath.h
base/gzcpath.h
base/gzht.h
base/gzline.h
base/gzpath.h
base/gzspotan.c
base/gzspotan.h
base/gzstate.h
base/ijs.mak
base/instcopy
base/jbig2.mak
base/jerror_.h
base/jmemcust.c
base/jmemcust.h
base/jpeg.mak
base/jpegxr.mak
base/lcms2.mak
base/lcms2mt.mak
base/lcups.mak
base/lcupsi.mak
base/ldf_jb2.mak
base/lib.mak
base/locale_.h
base/lwf_jp2.mak
base/malloc_.h
base/math_.h
base/memory_.h
base/mkromfs.c
base/msvccmd.mak
base/msvclib.mak
base/msvctail.mak
base/openjpeg.mak
base/openvms.mak
base/openvms.mmk
base/pack_ps.c
base/pcwin.mak
base/pipe_.h
base/png.mak
base/png_.h
base/ramfs.c
base/ramfs.h
base/sa85d.c
base/sa85d.h
base/sa85x.h
base/saes.c
base/saes.h
base/sarc4.c
base/sarc4.h
base/sbcp.c
base/sbcp.h
base/sbtx.h
base/scanchar.h
base/scantab.c
base/scf.h
base/scfd.c
base/scfdgen.c
base/scfdtab.c
base/scfe.c
base/scfetab.c
base/scfparam.c
base/scfx.h
base/scommon.h
base/sdcparam.c
base/sdcparam.h
base/sdct.h
base/sdctc.c
base/sdctd.c
base/sdcte.c
base/sddparam.c
base/sdeparam.c
base/seexec.c
base/setjmp_.h
base/sfilter.h
base/sfilter1.c
base/sfilter2.c
base/sfxboth.c
base/sfxcommon.c
base/sfxfd.c
base/sfxstdio.c
base/shc.c
base/shc.h
base/sidscale.c
base/sidscale.h
base/siinterp.c
base/siinterp.h
base/simscale.c
base/simscale.h
base/siscale.c
base/siscale.h
base/sisparam.h
base/sjbig2.c
base/sjbig2.h
base/sjbig2_luratech.c
base/sjbig2_luratech.h
base/sjpeg.h
base/sjpegc.c
base/sjpegd.c
base/sjpege.c
base/sjpx_luratech.c
base/sjpx_luratech.h
base/sjpx_none.c
base/sjpx_openjpeg.c
base/sjpx_openjpeg.h
base/slzwc.c
base/slzwd.c
base/slzwe.c
base/slzwx.h
base/smd5.c
base/smd5.h
base/smtf.h
base/spdiff.c
base/spdiffx.h
base/spngp.c
base/spngpx.h
base/spprint.c
base/spprint.h
base/spsdf.c
base/spsdf.h
base/srdline.h
base/srld.c
base/srle.c
base/srlx.h
base/ssha2.c
base/ssha2.h
base/sstring.c
base/sstring.h
base/stat_.h
base/std.h
base/stdint_.h
base/stdio_.h
base/stdpre.h
base/stream.c
base/stream.h
base/strimpl.h
base/string_.h
base/strmio.c
base/strmio.h
base/stub.mak
base/szlibc.c
base/szlibd.c
base/szlibe.c
base/szlibx.h
base/szlibxx.h
base/tiff.mak
base/time_.h
base/ttcalc.c
base/ttcalc.h
base/ttcommon.h
base/ttconf.h
base/ttconfig.h
base/ttfinp.c
base/ttfinp.h
base/ttfmain.c
base/ttfmemd.c
base/ttfmemd.h
base/ttfoutl.h
base/ttfsfnt.h
base/ttinterp.c
base/ttinterp.h
base/ttload.c
base/ttload.h
base/ttmisc.h
base/ttobjs.c
base/ttobjs.h
base/tttables.h
base/tttype.h
base/tttypes.h
base/ugcclib.mak
base/unistd_.h
base/unix-aux.mak
base/unix-dll.mak
base/unix-end.mak
base/unix-gcc.mak
base/unixansi.mak
base/unixhead.mak
base/unixinst.mak
base/unixlink.mak
base/valgrind.h
base/version.mak
base/vms_x_fix.h
base/vmsmath.h
base/windows_.h
base/winlib.mak
base/winplat.mak
base/winrtsup.cpp
base/winrtsup.h
base/wrfont.c
base/wrfont.h
base/write_t1.c
base/write_t1.h
base/write_t2.c
base/write_t2.h
base/x_.h
base/zlib.mak
configure.ac
devices/contrib.mak
devices/devs.mak
devices/gdev3852.c
devices/gdev4081.c
devices/gdev8510.c
devices/gdev8bcm.c
devices/gdev8bcm.h
devices/gdevatx.c
devices/gdevbit.c
devices/gdevbj10.c
devices/gdevbjc.h
devices/gdevbjcl.c
devices/gdevbjcl.h
devices/gdevbmp.c
devices/gdevbmp.h
devices/gdevbmpc.c
devices/gdevccr.c
devices/gdevcdj.c
devices/gdevcfax.c
devices/gdevchameleon.c
devices/gdevcif.c
devices/gdevclj.c
devices/gdevcljc.c
devices/gdevcmykog.c
devices/gdevcslw.c
devices/gdevdfax.c
devices/gdevdjet.c
devices/gdevdjtc.c
devices/gdevdljm.c
devices/gdevdljm.h
devices/gdevdm24.c
devices/gdevdsp.c
devices/gdevdsp.h
devices/gdevdsp2.h
devices/gdevepsc.c
devices/gdevepsn.c
devices/gdevescp.c
devices/gdevfax.c
devices/gdevfax.h
devices/gdevfpng.c
devices/gdevgprf.c
devices/gdevhl7x.c
devices/gdevicov.c
devices/gdevijs.c
devices/gdevimgn.c
devices/gdevjbig2.c
devices/gdevjpeg.c
devices/gdevjpx.c
devices/gdevl31s.c
devices/gdevlbp8.c
devices/gdevlj56.c
devices/gdevlp8k.c
devices/gdevlxm.c
devices/gdevmeds.c
devices/gdevmeds.h
devices/gdevmgr.c
devices/gdevmgr.h
devices/gdevmiff.c
devices/gdevn533.c
devices/gdevo182.c
devices/gdevokii.c
devices/gdevpbm.c
devices/gdevpcl.c
devices/gdevpcl.h
devices/gdevpcx.c
devices/gdevpe.c
devices/gdevperm.c
devices/gdevphex.c
devices/gdevpjet.c
devices/gdevplan.c
devices/gdevplib.c
devices/gdevplib.h
devices/gdevpm.h
devices/gdevpng.c
devices/gdevpsd.c
devices/gdevpsd.h
devices/gdevpsim.c
devices/gdevpxut.c
devices/gdevpxut.h
devices/gdevrinkj.c
devices/gdevsj48.c
devices/gdevsnfb.c
devices/gdevsppr.c
devices/gdevstc.c
devices/gdevstc.h
devices/gdevstc1.c
devices/gdevstc2.c
devices/gdevstc3.c
devices/gdevstc4.c
devices/gdevtfax.c
devices/gdevtfax.h
devices/gdevtfnx.c
devices/gdevtifs.c
devices/gdevtifs.h
devices/gdevtknk.c
devices/gdevtrac.c
devices/gdevtsep.c
devices/gdevupd.c
devices/gdevwpr2.c
devices/gdevx.c
devices/gdevx.h
devices/gdevxalt.c
devices/gdevxcf.c
devices/gdevxcmp.c
devices/gdevxcmp.h
devices/gdevxini.c
devices/gdevxres.c
devices/gxfcopy.c
devices/gxfcopy.h
devices/minftrsz.c
devices/minftrsz.h
devices/rinkj/evenbetter-rll.c
devices/rinkj/evenbetter-rll.h
devices/rinkj/rinkj-byte-stream.c
devices/rinkj/rinkj-byte-stream.h
devices/rinkj/rinkj-config.c
devices/rinkj/rinkj-config.h
devices/rinkj/rinkj-device.c
devices/rinkj/rinkj-device.h
devices/rinkj/rinkj-dither.c
devices/rinkj/rinkj-dither.h
devices/rinkj/rinkj-epson870.c
devices/rinkj/rinkj-epson870.h
devices/rinkj/rinkj-screen-eb.c
devices/rinkj/rinkj-screen-eb.h
devices/vector/gdevagl.c
devices/vector/gdevagl.h
devices/vector/gdevpdf.c
devices/vector/gdevpdfb.c
devices/vector/gdevpdfb.h
devices/vector/gdevpdfc.c
devices/vector/gdevpdfc.h
devices/vector/gdevpdfd.c
devices/vector/gdevpdfe.c
devices/vector/gdevpdfg.c
devices/vector/gdevpdfg.h
devices/vector/gdevpdfi.c
devices/vector/gdevpdfj.c
devices/vector/gdevpdfk.c
devices/vector/gdevpdfm.c
devices/vector/gdevpdfo.c
devices/vector/gdevpdfo.h
devices/vector/gdevpdfp.c
devices/vector/gdevpdfr.c
devices/vector/gdevpdft.c
devices/vector/gdevpdfu.c
devices/vector/gdevpdfv.c
devices/vector/gdevpdfx.h
devices/vector/gdevpdt.c
devices/vector/gdevpdt.h
devices/vector/gdevpdtb.c
devices/vector/gdevpdtb.h
devices/vector/gdevpdtc.c
devices/vector/gdevpdtd.c
devices/vector/gdevpdtd.h
devices/vector/gdevpdte.c
devices/vector/gdevpdtf.c
devices/vector/gdevpdtf.h
devices/vector/gdevpdti.c
devices/vector/gdevpdti.h
devices/vector/gdevpdts.c
devices/vector/gdevpdts.h
devices/vector/gdevpdtt.c
devices/vector/gdevpdtt.h
devices/vector/gdevpdtv.c
devices/vector/gdevpdtv.h
devices/vector/gdevpdtw.c
devices/vector/gdevpdtw.h
devices/vector/gdevpdtx.h
devices/vector/gdevpsdf.h
devices/vector/gdevpsdi.c
devices/vector/gdevpsdp.c
devices/vector/gdevpsds.c
devices/vector/gdevpsds.h
devices/vector/gdevpsdu.c
devices/vector/gdevpsf.h
devices/vector/gdevpsf1.c
devices/vector/gdevpsf2.c
devices/vector/gdevpsfm.c
devices/vector/gdevpsft.c
devices/vector/gdevpsfu.c
devices/vector/gdevpsfx.c
devices/vector/gdevpsu.c
devices/vector/gdevpsu.h
devices/vector/gdevpx.c
devices/vector/gdevtxtw.c
devices/vector/gdevxps.c
devices/vector/opdfread.ps
devices/vector/whitelst.c
devices/vector/whitelst.h
gpdl/gpdl.mak
gpdl/psi/gpdlpsi.mak
gpdl/psi/psitop.c
gpdl/pspcl6_gcc.mak
gpdl/pspcl6_msvc.mak
ijs/Makefile.am
ijs/configure.ac
ijs/ijs.c
ijs/ijs.h
ijs/ijs_client.c
ijs/ijs_client.h
ijs/ijs_client_example.c
ijs/ijs_exec_unix.c
ijs/ijs_exec_win.c
ijs/ijs_server.c
ijs/ijs_server_example.c
ijs/unistd_.h
ios/ios_arch-arm.h
ios/ios_arch-x86.h
jbig2dec/config_win32.h
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_image_rw.h
jbig2dec/jbig2_mmr.c
jbig2dec/jbig2_mmr.h
jbig2dec/jbig2_page.c
jbig2dec/jbig2_page.h
jbig2dec/jbig2_priv.h
jbig2dec/jbig2_refinement.c
jbig2dec/jbig2_refinement.h
jbig2dec/jbig2_segment.c
jbig2dec/jbig2_segment.h
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/os_types.h
jbig2dec/pbm2png.c
lib/FCOfontmap-PCLPS3
lib/FCOfontmap-PS3
lib/Fontmap.ATB
lib/Fontmap.ATM
lib/Fontmap.OS2
lib/Fontmap.SGI
lib/Fontmap.Sol
lib/Fontmap.URW-136.T1
lib/Fontmap.URW-136.TT
lib/Fontmap.Ult
lib/Fontmap.VMS
lib/align.ps
lib/caption.ps
lib/cat.ps
lib/cid2code.ps
lib/docie.ps
lib/font2pcl.ps
lib/gs_ce_e.ps
lib/gs_il2_e.ps
lib/gs_kanji.ps
lib/gs_ksb_e.ps
lib/gs_lgo_e.ps
lib/gs_lgx_e.ps
lib/gs_wl1_e.ps
lib/gs_wl2_e.ps
lib/gs_wl5_e.ps
lib/gslp.ps
lib/gsnup.ps
lib/image-qa.ps
lib/jispaper.ps
lib/lines.ps
lib/mkcidfm.ps
lib/pdf2dsc.ps
lib/pfbtopfa.ps
lib/ppath.ps
lib/pphs.ps
lib/prfont.ps
lib/ps2ai.ps
lib/ps2epsi.ps
lib/rollconv.ps
lib/stcinfo.ps
lib/stcolor.ps
lib/stocht.ps
lib/traceimg.ps
lib/traceop.ps
lib/uninfo.ps
lib/viewcmyk.ps
lib/viewgif.ps
lib/viewmiff.ps
lib/viewpbm.ps
lib/viewpcx.ps
lib/viewps2a.ps
lib/viewraw.ps
lib/viewrgb.ps
lib/winmaps.ps
lib/zeroline.ps
pcl/pcl/pcbiptrn.c
pcl/pcl/pcbiptrn.h
pcl/pcl/pccid.c
pcl/pcl/pccid.h
pcl/pcl/pccolor.c
pcl/pcl/pccoord.h
pcl/pcl/pccprint.c
pcl/pcl/pccsbase.c
pcl/pcl/pccsbase.h
pcl/pcl/pcdict.h
pcl/pcl/pcdither.c
pcl/pcl/pcdither.h
pcl/pcl/pcdraw.c
pcl/pcl/pcdraw.h
pcl/pcl/pcfont.c
pcl/pcl/pcfont.h
pcl/pcl/pcfontpg.c
pcl/pcl/pcfontst.h
pcl/pcl/pcfrgrnd.c
pcl/pcl/pcfrgrnd.h
pcl/pcl/pcfsel.c
pcl/pcl/pcfsel.h
pcl/pcl/pcht.c
pcl/pcl/pcht.h
pcl/pcl/pcident.c
pcl/pcl/pcident.h
pcl/pcl/pcimpl.c
pcl/pcl/pcindxed.c
pcl/pcl/pcindxed.h
pcl/pcl/pcjob.c
pcl/pcl/pcl.mak
pcl/pcl/pcl_top.mak
pcl/pcl/pclookup.c
pcl/pcl/pclookup.h
pcl/pcl/pcmacros.c
pcl/pcl/pcmisc.c
pcl/pcl/pcmtx3.c
pcl/pcl/pcmtx3.h
pcl/pcl/pcommand.c
pcl/pcl/pcommand.h
pcl/pcl/pcpage.c
pcl/pcl/pcpage.h
pcl/pcl/pcpalet.c
pcl/pcl/pcpalet.h
pcl/pcl/pcparam.h
pcl/pcl/pcparse.c
pcl/pcl/pcparse.h
pcl/pcl/pcpatrn.c
pcl/pcl/pcpatrn.h
pcl/pcl/pcpattyp.h
pcl/pcl/pcpatxfm.c
pcl/pcl/pcpatxfm.h
pcl/pcl/pcrect.c
pcl/pcl/pcsfont.c
pcl/pcl/pcstate.h
pcl/pcl/pcstatus.c
pcl/pcl/pcsymbol.c
pcl/pcl/pcsymbol.h
pcl/pcl/pctext.c
pcl/pcl/pctop.c
pcl/pcl/pctop.h
pcl/pcl/pctpm.h
pcl/pcl/pcuptrn.c
pcl/pcl/pcuptrn.h
pcl/pcl/pcursor.c
pcl/pcl/pcursor.h
pcl/pcl/pcwhtidx.c
pcl/pcl/pcwhtidx.h
pcl/pcl/pcxfmst.h
pcl/pcl/pgchar.c
pcl/pcl/pgcolor.c
pcl/pcl/pgconfig.c
pcl/pcl/pgdraw.c
pcl/pcl/pgdraw.h
pcl/pcl/pgfdata.c
pcl/pcl/pgfdata.h
pcl/pcl/pgfont.c
pcl/pcl/pgfont.h
pcl/pcl/pgframe.c
pcl/pcl/pggeom.c
pcl/pcl/pggeom.h
pcl/pcl/pginit.c
pcl/pcl/pginit.h
pcl/pcl/pglabel.c
pcl/pcl/pglfill.c
pcl/pcl/pgmand.h
pcl/pcl/pgmisc.c
pcl/pcl/pgmisc.h
pcl/pcl/pgparse.c
pcl/pcl/pgpoly.c
pcl/pcl/pgstate.h
pcl/pcl/pgvector.c
pcl/pcl/rtgmode.c
pcl/pcl/rtgmode.h
pcl/pcl/rtmisc.c
pcl/pcl/rtmisc.h
pcl/pcl/rtraster.c
pcl/pcl/rtraster.h
pcl/pcl/rtrstcmp.c
pcl/pcl/rtrstcmp.h
pcl/pcl/rtrstst.h
pcl/pl/pjparse.c
pcl/pl/pjparse.h
pcl/pl/pjparsei.c
pcl/pl/pjtop.c
pcl/pl/pjtop.h
pcl/pl/pl.mak
pcl/pl/plalloc.c
pcl/pl/plapi.c
pcl/pl/plapi.h
pcl/pl/plchar.c
pcl/pl/plchar.h
pcl/pl/pldebug.h
pcl/pl/pldict.c
pcl/pl/pldict.h
pcl/pl/pldraw.c
pcl/pl/pldraw.h
pcl/pl/plfapi.c
pcl/pl/plfapi.h
pcl/pl/plfont.c
pcl/pl/plfont.h
pcl/pl/plftable.c
pcl/pl/plftable.h
pcl/pl/plht.c
pcl/pl/plht.h
pcl/pl/plimpl.c
pcl/pl/pllfont.c
pcl/pl/pllfont.h
pcl/pl/plmain.c
pcl/pl/plmain.h
pcl/pl/plparams.c
pcl/pl/plparams.h
pcl/pl/plparse.h
pcl/pl/plromfs.mak
pcl/pl/plsymbol.c
pcl/pl/plsymbol.h
pcl/pl/pltop.c
pcl/pl/pltop.h
pcl/pl/pluchar.c
pcl/pl/plufont.c
pcl/pl/plufstlp.c
pcl/pl/plufstlp.h
pcl/pl/plufstlp1.c
pcl/pl/plulfont.c
pcl/pl/plvalue.c
pcl/pl/plvalue.h
pcl/pl/plvocab.c
pcl/pl/plvocab.h
pcl/pl/plwimg.c
pcl/pl/plwimg.h
pcl/pl/plwmainc.c
pcl/pl/plwreg.c
pcl/pl/plwreg.h
pcl/pl/plwres.h
pcl/pl/realmain.c
pcl/pxl/pxasm.ps
pcl/pxl/pxattr.h
pcl/pxl/pxbfont.c
pcl/pxl/pxbfont.h
pcl/pxl/pxbfont.ps
pcl/pxl/pxcet.txt
pcl/pxl/pxdict.h
pcl/pxl/pxdiff.txt
pcl/pxl/pxenum.h
pcl/pxl/pxerrors.c
pcl/pxl/pxerrors.h
pcl/pxl/pxffont.c
pcl/pxl/pxfont.c
pcl/pxl/pxfont.h
pcl/pxl/pxfts.txt
pcl/pxl/pxgstate.c
pcl/pxl/pxgstate.h
pcl/pxl/pximage.c
pcl/pxl/pximpl.c
pcl/pxl/pxink.c
pcl/pxl/pxl.mak
pcl/pxl/pxlib.txt
pcl/pxl/pxoper.h
pcl/pxl/pxpaint.c
pcl/pxl/pxparse.c
pcl/pxl/pxparse.h
pcl/pxl/pxptable.c
pcl/pxl/pxptable.h
pcl/pxl/pxpthr.c
pcl/pxl/pxpthr.h
pcl/pxl/pxsessio.c
pcl/pxl/pxspec.txt
pcl/pxl/pxstate.c
pcl/pxl/pxstate.h
pcl/pxl/pxstream.c
pcl/pxl/pxsymbol.ps
pcl/pxl/pxsymbol.psc
pcl/pxl/pxsymbol.psh
pcl/pxl/pxtag.h
pcl/pxl/pxtop.c
pcl/pxl/pxvalue.c
pcl/pxl/pxvalue.h
pcl/tools/pxlasm.py
pcl/tools/pxldis.py
pcl/tools/suite.tcl
psi/bfont.h
psi/btoken.h
psi/dmmain.c
psi/dmmain.r
psi/dpmain.c
psi/dscparse.c
psi/dscparse.h
psi/dstack.h
psi/dwdll.c
psi/dwdll.h
psi/dwimg.c
psi/dwimg.h
psi/dwmain.c
psi/dwmain.rc
psi/dwmainc.c
psi/dwnodll.c
psi/dwreg.c
psi/dwreg.h
psi/dwres.h
psi/dwtext.c
psi/dwtext.h
psi/dwtrace.c
psi/dwtrace.h
psi/dxmain.c
psi/dxmainc.c
psi/estack.h
psi/files.h
psi/ghost.h
psi/gs.c
psi/gsdll.c
psi/gsdll2.rc
psi/gsdll32.rc
psi/gserver.c
psi/gsos2.rc
psi/ialloc.c
psi/ialloc.h
psi/iapi.c
psi/iapi.h
psi/iastate.h
psi/iastruct.h
psi/ibnum.c
psi/ibnum.h
psi/ichar.h
psi/ichar1.h
psi/icharout.h
psi/icid.h
psi/icie.h
psi/icolor.h
psi/iconf.c
psi/iconf.h
psi/icontext.c
psi/icontext.h
psi/icremap.h
psi/icsmap.h
psi/icstate.h
psi/iddict.h
psi/iddstack.h
psi/idebug.c
psi/idebug.h
psi/idict.c
psi/idict.h
psi/idictdef.h
psi/idicttpl.h
psi/idisp.c
psi/idisp.h
psi/idosave.h
psi/idparam.c
psi/idparam.h
psi/idsdata.h
psi/idstack.c
psi/idstack.h
psi/ierrors.h
psi/iesdata.h
psi/iestack.h
psi/ifapi.h
psi/ifcid.h
psi/ifilter.h
psi/ifilter2.h
psi/ifont.h
psi/ifont1.h
psi/ifont2.h
psi/ifont42.h
psi/ifrpred.h
psi/ifunc.h
psi/ifwpred.h
psi/igc.c
psi/igc.h
psi/igcref.c
psi/igcstr.c
psi/igcstr.h
psi/igstate.h
psi/iht.h
psi/iimage.h
psi/iinit.c
psi/iinit.h
psi/ilevel.h
psi/ilocate.c
psi/imain.c
psi/imain.h
psi/imainarg.c
psi/imainarg.h
psi/imemory.h
psi/iminst.h
psi/iname.c
psi/iname.h
psi/inamedef.h
psi/inameidx.h
psi/inames.h
psi/inamestr.h
psi/inobtokn.c
psi/inouparm.c
psi/int.mak
psi/interp.c
psi/interp.h
psi/iosdata.h
psi/iostack.h
psi/ipacked.h
psi/iparam.c
psi/iparam.h
psi/iparray.h
psi/ipcolor.h
psi/iplugin.c
psi/iplugin.h
psi/ireclaim.c
psi/iref.h
psi/isave.c
psi/isave.h
psi/iscan.c
psi/iscan.h
psi/iscanbin.c
psi/iscanbin.h
psi/iscannum.c
psi/iscannum.h
psi/isdata.h
psi/isstate.h
psi/istack.c
psi/istack.h
psi/istkparm.h
psi/istream.h
psi/istruct.h
psi/itoken.h
psi/iutil.c
psi/iutil.h
psi/iutil2.c
psi/iutil2.h
psi/ivmem2.h
psi/ivmspace.h
psi/main.h
psi/mkfilelt.cpp
psi/msvc.mak
psi/msvc32.mak
psi/msvc64.mak
psi/nsisinst.nsi
psi/oparc.h
psi/opcheck.h
psi/opdef.h
psi/oper.h
psi/opextern.h
psi/os2.mak
psi/ostack.h
psi/psapi.c
psi/psapi.h
psi/psromfs.mak
psi/store.h
psi/winint.mak
psi/zalg.c
psi/zarith.c
psi/zarray.c
psi/zbfont.c
psi/zbseq.c
psi/zcfont.c
psi/zchar.c
psi/zchar1.c
psi/zchar2.c
psi/zchar32.c
psi/zchar42.c
psi/zchar42.h
psi/zcharout.c
psi/zcharx.c
psi/zcid.c
psi/zcie.c
psi/zcie.h
psi/zcolor.c
psi/zcolor.h
psi/zcolor1.c
psi/zcolor2.c
psi/zcolor3.c
psi/zcontrol.c
psi/zcrd.c
psi/zcsindex.c
psi/zcspixel.c
psi/zcssepr.c
psi/zdevcal.c
psi/zdevice.c
psi/zdevice2.c
psi/zdfilter.c
psi/zdict.c
psi/zdouble.c
psi/zdps1.c
psi/zdscpars.c
psi/zfaes.c
psi/zfapi.c
psi/zfarc4.c
psi/zfbcp.c
psi/zfcid.c
psi/zfcid0.c
psi/zfcid1.c
psi/zfcmap.c
psi/zfdctd.c
psi/zfdcte.c
psi/zfdecode.c
psi/zfile.c
psi/zfile.h
psi/zfile1.c
psi/zfileio.c
psi/zfilter.c
psi/zfilter2.c
psi/zfimscale.c
psi/zfjbig2.c
psi/zfjpx.c
psi/zfmd5.c
psi/zfont.c
psi/zfont0.c
psi/zfont1.c
psi/zfont2.c
psi/zfont32.c
psi/zfont42.c
psi/zfontenum.c
psi/zform.c
psi/zfproc.c
psi/zfrsd.c
psi/zfrsd.h
psi/zfsample.c
psi/zfsha2.c
psi/zfunc.c
psi/zfunc.h
psi/zfunc0.c
psi/zfunc3.c
psi/zfunc4.c
psi/zfzlib.c
psi/zgeneric.c
psi/zgstate.c
psi/zht.c
psi/zht1.c
psi/zht2.c
psi/zht2.h
psi/zicc.c
psi/zicc.h
psi/zimage.c
psi/zimage3.c
psi/ziodev.c
psi/ziodev2.c
psi/ziodevsc.c
psi/zmath.c
psi/zmatrix.c
psi/zmedia2.c
psi/zmisc.c
psi/zmisc1.c
psi/zmisc2.c
psi/zmisc3.c
psi/zncdummy.c
psi/zpacked.c
psi/zpaint.c
psi/zpath.c
psi/zpath1.c
psi/zpcolor.c
psi/zpdf_r6.c
psi/zpdfops.c
psi/zrelbit.c
psi/zshade.c
psi/zstack.c
psi/zstring.c
psi/zsysvm.c
psi/ztoken.c
psi/ztrans.c
psi/ztrap.c
psi/ztype.c
psi/zupath.c
psi/zusparam.c
psi/zutf8.c
psi/zvmem.c
psi/zvmem2.c
psi/zwinutf8.c
toolbin/GenSubstCID.ps
toolbin/afmutil.py
toolbin/color/icc_creator/ICC_Creator/CIELAB.h
toolbin/color/icc_creator/ICC_Creator/ICC_Creator.cpp
toolbin/color/icc_creator/ICC_Creator/ICC_Creator.h
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/encs2c.ps
toolbin/errlist.tcl
toolbin/extractFonts.ps
toolbin/extractICCprofiles.ps
toolbin/gen_ldf_jb2.py
toolbin/genfontmap.ps
toolbin/gitlog2changelog.py
toolbin/gsmake.tcl
toolbin/halftone/gen_ordered/gen_ordered_main.c
toolbin/halftone/gen_stochastic/gen_stochastic.c
toolbin/headers.tcl
toolbin/jpxtopdf.c
toolbin/leaks.tcl
toolbin/makehist.tcl
toolbin/memory.py
toolbin/ocheck.py
toolbin/pdf_info.ps
toolbin/pre.tcl
toolbin/precheck.tcl
toolbin/split_changelog.py
toolbin/suite.tcl
toolbin/tests/build_revision.py
toolbin/tests/check_all.py
toolbin/tests/check_comments.py
toolbin/tests/check_dirs.py
toolbin/tests/check_docrefs.py
toolbin/tests/cmpi.py
toolbin/tests/compare_checksumdb.py
toolbin/tests/compare_checksums.py
toolbin/tests/dump_checksum.py
toolbin/tests/dump_checksum_plus.py
toolbin/tests/dump_checksum_raw.py
toolbin/tests/get_baseline_log.py
toolbin/tests/get_baselines.py
toolbin/tests/gscheck_all.py
toolbin/tests/gscheck_fuzzypdf.py
toolbin/tests/gscheck_pdfwrite.py
toolbin/tests/gscheck_raster.py
toolbin/tests/gscheck_testfiles.py
toolbin/tests/gsconf.py
toolbin/tests/gsparamsets.py
toolbin/tests/gssum.py
toolbin/tests/gstestgs.py
toolbin/tests/gstestutils.py
toolbin/tests/gsutil.py
toolbin/tests/make_baselinedb.py
toolbin/tests/make_testdb.py
toolbin/tests/make_two_pdfversions
toolbin/tests/make_two_versions
toolbin/tests/myoptparse.py
toolbin/tests/rasterdb.py
toolbin/tests/revert_baseline
toolbin/tests/revert_pdfbaseline
toolbin/tests/run_nightly.py
toolbin/tests/run_parallel
toolbin/tests/run_regression.py
toolbin/tests/testdiff.py
toolbin/tests/update_baseline.py
toolbin/tests/update_specific
toolbin/tmake.tcl
xps/ghostxps.h
xps/xps.mak
xps/xpsanalyze.c
xps/xpscff.c
xps/xpscolor.c
xps/xpscommon.c
xps/xpscrc.c
xps/xpsdoc.c
xps/xpsfapi.c
xps/xpsfapi.h
xps/xpsfont.c
xps/xpsglyphs.c
xps/xpsgradient.c
xps/xpshash.c
xps/xpsimage.c
xps/xpsjpeg.c
xps/xpsjxr.c
xps/xpsmem.c
xps/xpsopacity.c
xps/xpspage.c
xps/xpspath.c
xps/xpspng.c
xps/xpsresource.c
xps/xpsromfs.mak
xps/xpstiff.c
xps/xpstile.c
xps/xpstop.c
xps/xpsttf.c
xps/xpsutf.c
xps/xpsvisual.c
xps/xpsxml.c
xps/xpszip.c


2019-01-16 08:08:28 -0800
Nancy Durgin <nancy.durgin@artifex.com>
373d83836619fe8b675b3db7235e4fee19b699fd

Fixed typo and cleaned up usage of //systemdict vs systemdict

Typo was misspelling of /.PDF_UNDEF_OPLIST

Cleaned this up to just use //systemdict and .forceundef because the
mix of uses was confusing.

Took out 'executeonly' because it's not needed (though harmless). This
procedure will have already been undef'd by the time the user gets access
to the interpreter.

Resource/Init/gs_init.ps


2019-01-15 15:30:46 -0800
Nancy Durgin <nancy.durgin@artifex.com>
9cae141e4654124379dc4738bbea4b5b6e13d37b

Added array .PDF_UNDEF_OPLIST to pdf_main.ps instead of maintaining twice

Used to maintain two different lists of operators in gs_init.ps and pdf_main.ps
for undef'ing operators that are used by pdf, in two cases of DELAYBIND or
not DELAYBIND.

This change defines the array in pdf_main.ps and just references it in
gs_init.ps.

Also added a couple operators to the pdf_main.ps list that had gotten
out of sync with the gs_init.ps one (which is why we really need just one
list...)

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


2019-01-16 14:10:01 +0000
Chris Liddell <chris.liddell@artifex.com>
5fac4ab4815b3bd86d471389357cdc7cc184f65c

Update the copyright year (2019) in the documentation

doc/API.htm
doc/C-style.htm
doc/Commprod.htm
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gdevds32.c
doc/sample_downscale_device.htm
doc/subclass.htm
doc/thirdparty.htm


2019-01-16 05:12:54 -0800
Robin Watts <Robin.Watts@artifex.com>
03a1e5eaf83896053fa32f68d328ff48f86d906f

Valgrind fixes.

Firstly, move entirely to HAVE_VALGRIND rather than ENABLE_VALGRIND.
My fault for having introduced 2 schemes to do the same thing in
the past.

Accordingly, move direct inclusions of memcheck/valgrind.h over to
calling our local valgrind.h header.

And finally, fix the problem that prompted all of this; in
image_simple_expand, we take 1 bit data in. The last bytes in this
data can frequently be only semi-filled, resulting in some
undefined bits. While our code to quickly skip complete bytes is
safe by construction, valgrind cannot recognise it as such, and so
signals false positive UMRs.

Work around that here by tweaking valgrinds ideas of what bits
are defined.

base/gsinit.c
base/gxclfile.c
base/gxclist.c
base/gxclmem.c
base/gxclutil.c
base/gxifast.c
base/valgrind.h
psi/imain.c


2019-01-14 12:41:25 +0000
Robin Watts <robin.watts@artifex.com>
b5ecd380a5af595f5e843352df88a6957b1accda

New valgrind makefile targets and clist tweak.

We introduce 2 new families of targets to the makefile.

1) vg, gsvg, gpcl6vg, gxpsvg, gpdlvg
2) debugvg, gsdebugvg, gpcl6debugvg, gxpsdebugvg, gpdldebugvg

Those build release and debug versions of the executables, tweaked
to work better with valgrind. These mirror the existing *mementovg
targets that were introduced a while ago.

2 extra tweaks are introduced here too.

Firstly, *for these targets*, we default to using memory for
bandlist storage. This should cut down on the number of false
positives we get when using the clist as uninitialised padding
bytes will not be flagged up as they are written to the clist
file. (Instead, they will only be flagged up if they are actually
used during clist playback).

Secondly, whenever we write out a clist block and reset the buffer,
we reset the buffer to "undefined" state so that valgrind can give
us useful information again.

base/gxclutil.c
base/unix-end.mak


2017-11-17 00:22:03 +0000
Robin Watts <Robin.Watts@artifex.com>
53faf466e769bd380a14370aa38562b942e783c2

Add clist valgrind helper call.

base/gxcldev.h
base/gxclimag.c
base/gxclpath.c
base/gxclutil.c


2019-01-14 11:34:09 +0000
Robin Watts <robin.watts@artifex.com>
1f5d4a1ce74ea841102a7c77e29c68e9b7a032c2

Improve -Z: output messages at startup.

The "Init done" messages given by -Z: were misleading.

Here, we simplify the process a bit. We move the init messages
(other than the dumping of the args used) out of -Z: and into
--debug=init-details.

The 3 different init messages are now explicitly done around
each of the 3 phases, rather than in the code that calls
those 3 phases. This makes it far clearer, as the phases can
be called from many different places depending on the exact
command line in use.

The only downside to this is that only the final phase shows up
in normal use, as the parsing of --debug=init_details doesn't
happen until after after the first 2 phases of init have taken
place. This is no worse than the current code, so we'll take this
for now, and update it later (maybe by prescanning the arg list)
if it's ever an issue later on.

base/gdbflags.h
psi/imain.c
psi/imainarg.c


2019-01-11 19:24:47 -0800
Ray Johnston <ray.johnston@artifex.com>
41810035925a2dd419354e8ca918f425603e5cb4

Bug 700482: Binary Object scanner could write past allocated ref array

The object length (osize) was used to compute the max_array_index, but
this exceeded the number of refs allocated based on the overall length
given in the BOS header. We only allocated overall_length/8 but the bad
object length value (in this case for a dict, but could be an array)
was larger so we ended up with a max_array_index that was too large.

psi/iscanbin.c


2019-01-10 13:48:37 +0000
Robin Watts <robin.watts@artifex.com>
deaae0d435112e2fdd9f3f7d1e8eee6e207758f1

Squash a warning in XPS interpreter.

xps/ghostxps.h
xps/xpszip.c


2019-01-10 13:44:13 +0000
Robin Watts <robin.watts@artifex.com>
6236f942b0601772221a910e006c9fa865b4568e

gpdl: Tweak stdin operation to respect gsapi set stdio functions.

Now that gpdl lives entirely under the gsapi API, it should
respect all that API. That means that as people can define
callbacks to be used for stdin/stdout/stderr, we should use
those callbacks if they are set and the program is told to
read from stdin.

Sadly, the only stdin stream implementation we have that supports
this mechanism is the one in the postscript interpreter rather
than the one in the general library, so we can't rely on it being
there (and even if we could, it assumes the presence of an
active PS interpreter instance).

We therefore lift this code out and simplify it to give us a
"callback capable" stdin stream that will be present in all our
builds. This is NOT available using the standard iodev mechanism
so no changes in behaviour can happen for existing programs.

base/lib.mak
base/strmio.c
base/strmio.h
pcl/pl/plmain.c


2019-01-10 21:18:08 +0000
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
4e71598a97bce38f3ba384c055d6ffb852f045fd

Bug 697545 : Prevent SEGV when no graphic state is saved.

Prevent SEGV if memory allocation fails leading to pgs->saved being NULL.

Error created using :-
MEMENTO_FAILAT=351 ./membin/gpcl6 -sDEVICE=pbmraw -dMaxBitmap=2000 -o /dev/null ./tests_private/pcl/pcl5cfts/fts.0270

base/gsdevice.c


2019-01-10 12:19:10 -0500
Steve Phillips <steve.phillips@artifex.com>
2ae1181b33be65478db844e3a330cf31f8dee273

Fix for bug 700042 -- Sanitize out-of-bounds read with fuzzed PDF file.

The test file for this bug was fuzzed in such a way as to generate
Lattice-Form Gouraud shadings with extremely large X coordinates.
This exposed a bug in the code which performs recursive triangle
subdivision. A color cache entry is not the same size as a
patch_color_t so can't be copied directly.

base/gxshade6.c


2019-01-11 14:25:29 +0100
Tor Andersson <tor.andersson@artifex.com>
24281b198d446da47441b132aba2aa09a5c27ba5

Bug 697630: Check ZIP entry sizes for integer overflow.

xps/xpszip.c


2019-01-09 17:55:17 +0000
Robin Watts <robin.watts@artifex.com>
1698937968690ca1ff99e50ae8c1c044718505b8

Fix stdin operation for gpdl/gpcl etc.

pcl/pl/plmain.c


2019-01-09 17:14:13 +0000
Robin Watts <robin.watts@artifex.com>
5b41d5347c1cde4847d8d631aa20e00a6cdb5728

Rename xps language implementation points.

use _impl_ instead of _imp_ to be consistent with the others.

xps/xpstop.c


2019-01-08 18:49:38 +0000
Robin Watts <robin.watts@artifex.com>
0b89bbaf583441e84804201d2e74169b9c7be5de

gpdl: Add -c operation to gpdl.

We gather up all the commands specified by -c and pass them into
the language as a 'prefix' command, to be run just after we have
inited the job. This means they run inside the encapsulation.

The only language that supports prefix commands is postscript,
hence only postscript commands can be used. This is what we want.

gpdl/psi/psitop.c
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


2019-01-09 17:19:22 +0000
Robin Watts <robin.watts@artifex.com>
51196c3b88bf5a865e03907c90ac891ab857f021

Squash a type warning.

psi/imainarg.c


2019-01-08 16:35:51 +0000
Chris Liddell <chris.liddell@artifex.com>
cb07f9786acc2faa85b1f3cce89339b65f99c310

Bug 700460: Fix Freetype Type1 path segment closepath

* src/psaux/psintrp.c: correctly close a contour

All of the Type 1 path building is done with code common to the revised
CFF engine, with the exception of closepath, which was still calling
ps_builder_close_contour(), thus previously cached segments were not
always written to the path, and glyph corruption, or even invalid outlines
were possible.

Switch to calling cf2_glyphpath_closeOpenPath()

Committed upstream:
http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=b75abeb5e6561024d182ccdc0eb36a7d2630310e

freetype/src/psaux/psintrp.c


2019-01-08 14:03:28 -0800
Nancy Durgin <nancy.durgin@artifex.com>
fc8c8630f929cbbe1df01fdc3186f25193b31f75

Undefine internal .presentspecial dictionary

This dictionary contains a bunch of procedures that will no longer be exposed.

Resource/Init/gs_setpd.ps


2019-01-08 11:53:33 -0800
Nancy Durgin <nancy.durgin@artifex.com>
71af04a00d1970be001d043480c07bd336453a73

Rearrange code in gs_setpd.ps so things are defined before used.

This is in preparation for undef'ing .presentspecial dictionary.
I tried to keep the related code together, and I hope I moved the
right comments with the code...

Resource/Init/gs_setpd.ps


2019-01-08 20:05:11 +0000
Robin Watts <robin.watts@artifex.com>
06e9bde4dce776a3afa365bc65b1a1278462c865

Fix Memento squeezing - gs_lib_ctx was using a monitor.

Monitors don't play nice with memento squeezing, so nobble the
code.

base/gslibctx.c


2019-01-08 08:37:55 -0800
Nancy Durgin <nancy.durgin@artifex.com>
cae9c43ecc8eb804022d947f65d60358a7e6094a

Rewrite some code to be able to undef internal .setpagesize

/.setpagesize is used internally by gs_statd.ps, but it was written
to pull the current implementation out of statusdict, so it could use
either a level 2-compatible version that called setpagedevice, or a level 1
version that didn't call setpagedevice.

Since we don't support level 1 postscript anymore, we should always have
setpagedevice, so this can be cleaned up.

Now /.setpagesize is just an internal convenience function that we undef
within gs_statd.ps.

Resource/Init/gs_lev2.ps
Resource/Init/gs_statd.ps


2019-01-07 20:03:02 -0800
Michael Vrhel <michael.vrhel@artifex.com>
6b9a0722a5e4c8083a59fd3ba22b1b572ec7fcd6

Bug 691732 Add support for e-sRGB and ROMMRGB color spaces

JPX images can have an enumerated color space that indicates
e-sRGB or ROMMRGB.

Resource/Init/gs_lev2.ps
Resource/Init/gs_res.ps
Resource/Init/pdf_draw.ps
base/gsicc_manage.h
iccprofiles/esrgb.icc
iccprofiles/rommrgb.icc


2018-12-19 15:03:27 -0800
Ray Johnston <ray.johnston@artifex.com>
c75bd64e30d8ff890cd6495e748b30a4b0dacd32

Bug 699180: Transparency BBox for stroke needs the expanded path.

The simplified test case has an unusually wide line, but since the path
is pure horizontal, pathbbox returns the same coordinate for Ymin and Ymax.
Instead, when painting strokes, use "strokepath pathbbox" to get the actual
area painted (taking width and miter extensions into account).

Resource/Init/pdf_ops.ps


2018-12-23 13:02:22 -0800
Ray Johnston <ray.johnston@artifex.com>
10a630656fadb160ec3e01b934adac3e1ca600f9

Bug 700359: Uniprint device did not set color_info.polarity needed by pdf14

The pdf14 device assumes that if the polarity is ADDITIVE, the colorspace
must be Gray or RGB. The uniprint device did not set the polarity when the
colorspace was changed to CMYK, so the number of components set in the pdf14
compositor was 3, even though the ICC profile for the device expects 4 as
num_components in. This caused a mismatch when reading the clist because
it expected 4 components and only 3 were written. Note that the RGBW, RGBOV,
and RGBNOV modes will probably still fail, but unti we see a case for a device
needing these unusual modes, just leave it as it has been for many years.

Note that other devices with strange colorspaces, such as RGBA may also
trip over this.

devices/gdevupd.c


2018-12-26 13:12:39 -0800
Ray Johnston <ray.johnston@artifex.com>
905d1bf02db12aca93a732dbe5956993e19d2443

Bug 699688: Saving pointer into arg_list string invalid (next arg overwrites)

The 'saved_pages_inital_arg' cannot be a pointer into the argument buffer
(arg_list.cstr) since later long arguments can overwrite past the pointer
saved (12 characters into the buffer). Instead allocate a buffer for the
argument and copy the argument into it.

Thanks to Peter Cherepanov for the analysis and part of the fix.

psi/imain.c
psi/imainarg.c


2018-10-09 23:04:42 -0700
Ray Johnston <ray.johnston@artifex.com>
02fd67bce5cd981282594b1458c4459613559d1b

Remove overprint_mode_alt (overprint mode is the same for stroke and fill)

Also remove effective_overprint_mode_alt.

base/gsstate.c
base/gxgstate.h


2018-07-09 12:05:56 -0700
Ray Johnston <ray.johnston@artifex.com>
0c89f7d14ffdaa3080d996d7502a77f3db949381

Fix for bug 692652: Prevent derefence of NULL if parsed.iodev == NULL

Robin's suggestion seems reasonable to me.

base/gsdevice.c


2018-12-17 11:18:07 +0000
Robin Watts <robin.watts@artifex.com>
e91b67894a28c518b34e0daf75d79715c4aa16e4

Remove some blah_DEFINED cruft.

Now we properly "include what we use" let's sanitise the horrid
blah_DEFINED ifdeffery (i.e. kill it where possible).

Also, we update the .c dependencies in the base/psi makefiles to
be correct.

Unfortunately, this new correct set of dependencies causes nmake
to soil itself and die with an out of memory error. After much
experimentation, I've come to the conclusion that this is because
it copes poorly with given the same file as a dependency multiple
times.

Sadly, our style of declaring dependencies in the following style:

foo_h=$(BLAH)/foo.h $(std_h)
bar_h=$(BLAH)/bar.h $(foo_h) $(std_h)
baz_h=$(BLAH)/baz.h $(foo_h) $(std_h)

means that a .obj file that depends on $(foo_h) $(bar_h) and $(baz_h)
ends up depending on foo.h twice, and std.h three times.

I have therefore changed the style of dependencies used to be more
standard.

We still define:

foo_h=$(BLAH)/foo.h

so each .obj file rule can depend on $(foo_h) etc as required, but the
dependencies between each .h file are expressed in normal rules at the
end of the file in a dedicated "# Dependencies" section that we can now
autogenerate.

base/gdevdevn.c
base/gdevdevn.h
base/gdevmrop.h
base/gdevp14.h
base/gdevprn.h
base/gp.h
base/gsalloc.h
base/gsccolor.h
base/gscdevn.h
base/gschar.h
base/gscicach.h
base/gscie.h
base/gscms.h
base/gscolor2.h
base/gscolor3.h
base/gscrdp.h
base/gscsepr.h
base/gscspace.h
base/gsdcolor.h
base/gsdevice.h
base/gsdsrc.h
base/gsfcmap.h
base/gsfname.h
base/gsfont.h
base/gsfunc.h
base/gsgc.h
base/gsgcache.h
base/gsgdata.h
base/gsgstate.h
base/gsht1.h
base/gsicc_cache.h
base/gsicc_cms.h
base/gsimage.h
base/gsiparam.h
base/gslibctx.h
base/gsmatrix.h
base/gsmemory.h
base/gsmemraw.h
base/gsnamecl.h
base/gsovrc.h
base/gsparam.h
base/gspath.h
base/gspcolor.h
base/gsptype1.h
base/gsptype2.h
base/gsshade.h
base/gsstate.h
base/gsstruct.h
base/gstext.h
base/gstparam.h
base/gstrans.h
base/gstrap.h
base/gstype1.h
base/gsuid.h
base/gxalloc.h
base/gxblend.h
base/gxcdevn.h
base/gxchar.h
base/gxcid.h
base/gxclfile.c
base/gxclipsr.h
base/gxclist.h
base/gxclmem.h
base/gxclthrd.h
base/gxcmap.h
base/gxcolor2.h
base/gxcomp.h
base/gxcpath.h
base/gxcspace.h
base/gxdcolor.h
base/gxdevbuf.h
base/gxdevcli.h
base/gxdevmem.h
base/gxdht.h
base/gxdhtres.h
base/gxdhtserial.h
base/gxdither.h
base/gxfapi.h
base/gxfcache.h
base/gxfcid.h
base/gxfcmap.h
base/gxfill.h
base/gxfont.h
base/gxfont0.h
base/gxfont1.h
base/gxfont42.h
base/gxgetbit.h
base/gxgstate.h
base/gxhintn.h
base/gxhldevc.h
base/gxht.h
base/gxhttile.h
base/gxiclass.h
base/gximage.h
base/gximask.h
base/gxiodev.h
base/gxiparam.h
base/gxmatrix.h
base/gxobj.h
base/gxpaint.h
base/gxpath.h
base/gxpcache.h
base/gxpcolor.h
base/gxrplane.h
base/gxsample.h
base/gxshade.h
base/gxshade4.h
base/gxtext.h
base/gxttfb.h
base/gxtype1.h
base/gzpath.h
base/gzspotan.h
base/lib.mak
base/saes.h
base/sarc4.h
base/scommon.h
base/spprint.h
base/spsdf.h
base/srdline.h
base/std.h
base/strmio.h
base/tiff.mak
base/ttfoutl.h
base/ttobjs.h
base/unixinst.mak
devices/contrib.mak
devices/devs.mak
devices/gdev8bcm.h
devices/gdevbmp.h
devices/gdevdljm.h
devices/gdevdsp2.h
devices/gdevfax.h
devices/gdevmgr.h
devices/gdevpcl.h
devices/gdevplib.h
devices/gdevpsd.c
devices/gdevpsd.h
devices/gdevpxut.h
devices/gdevrinkj.c
devices/gdevtfax.h
devices/gdevxcf.c
devices/gdevxcmp.h
devices/gxfcopy.h
devices/vector/gdevpdfb.h
devices/vector/gdevpdfc.h
devices/vector/gdevpdfg.h
devices/vector/gdevpdfo.h
devices/vector/gdevpdfx.h
devices/vector/gdevpdt.h
devices/vector/gdevpdtb.h
devices/vector/gdevpdtf.h
devices/vector/gdevpdti.h
devices/vector/gdevpdts.h
devices/vector/gdevpdtt.h
devices/vector/gdevpdtw.h
devices/vector/gdevpdtx.h
devices/vector/gdevpsds.h
devices/vector/gdevpsf.h
devices/vector/gdevpsu.h
devices/vector/gdevtxtw.c
gpdl/psi/gpdlpsi.mak
pcl/pcl/pcfontst.h
pcl/pcl/pcl.mak
pcl/pcl/pgstate.h
pcl/pl/pl.mak
pcl/pl/plchar.c
pcl/pl/plfont.h
pcl/pl/pltop.h
pcl/pxl/pxfont.h
pcl/pxl/pxstate.h
psi/files.h
psi/ichar1.h
psi/icid.h
psi/icremap.h
psi/icstate.h
psi/iddstack.h
psi/idebug.h
psi/idict.h
psi/idparam.h
psi/idsdata.h
psi/ifont.h
psi/igc.h
psi/igstate.h
psi/imain.h
psi/imainarg.h
psi/imemory.h
psi/iminst.h
psi/inamedef.h
psi/inames.h
psi/int.mak
psi/interp.h
psi/iplugin.h
psi/iref.h
psi/isave.h
psi/iscan.h
psi/isdata.h
psi/istack.h
psi/itoken.h
psi/iutil.h
toolbin/checkdeps.pl
toolbin/headercompile.pl
windows/ghostpcl.vcproj
windows/ghostscript.vcproj


2019-01-04 17:53:58 +0000
Robin Watts <robin.watts@artifex.com>
763a5f4c3bf94cd7cc3d9fcdcde3d7cac4f38796

Bug 696368: Avoid a garbage collection crash.

The bulk of this analysis and patch is due to Ken.

We can occasionally hit crashes when dealing with patterns. Ken
tracked this down to the 'dirty' pointer in the gx_pattern_trans_t
not being relocated in a garbage collection operation, and hence
ending up pointing to a random address.

His proposed fix was to change the 'dirty' pointer to be a pointer
to the actual pdf14_buf that contained the dirty rectangle, and to
ensure that it was properly enumerated in gc operations. This largely
solved the issues, but left a crash.

This crash was due to pdf14_get_buffer_information returning
a pointer to buf, even when it closed the device and hence freed
buf. This didn't normally affect the caller in as it never accessed
through the pointer, but *did* trip up any garbage collection that
happened while the pointer was extant.

The fix is simply to only have pdf14_get_buffer_information return a
pointer to buf iff buf will actually be around when we return.

base/gdevp14.c
base/gxp1fill.c
base/gxpcmap.c
base/gxpcolor.h


2019-01-07 09:58:36 +0000
Chris Liddell <chris.liddell@artifex.com>
2b0bfd775e43232ec488b8131b8dc014eb09d5aa

Coverity 328396: Correctly handle use cases for register root

There was a logical flaw in the revised iregister_root() implementation that
meant we only handled 2 of the 3 ways of calling it correctly, the third way
would result in a segfault.

Also, add a comment noting those three ways of calling the API.

base/gsalloc.c
base/gsmemory.h


2019-01-03 09:40:01 -0800
Nancy Durgin <nancy.durgin@artifex.com>
4759b642f0f85f61949df18a43179d9cc5c9a91a

Undef internal setpagedevice operators

Had to delay and undef in ps_init.ps:
/.execinstall

Could undefine locally:
/.postinstall
/.copytree
/.defaultdeviceparams
/.makecurrentpagedevice

Resource/Init/gs_init.ps
Resource/Init/gs_setpd.ps


2019-01-01 18:34:45 +0000
Robin Watts <robin.watts@artifex.com>
7fe04b119618b476586e5f5b85c46d72ff05ebfc

Add -I handling to gpdl.

This requires an "add_path" entrypoint be added for each language
(NULL for everything except PS).

This causes the block of memory used for the -I path to be leaked. I
suspect this is the same as in gs. A fix for this is a little involved
so it'll wait for now.

gpdl/psi/psitop.c
pcl/pcl/pctop.c
pcl/pl/pjparsei.c
pcl/pl/plmain.c
pcl/pl/pltop.c
pcl/pl/pltop.h
pcl/pxl/pxtop.c
psi/psapi.c
psi/psapi.h
xps/xpstop.c


2019-01-03 17:07:25 +0000
Robin Watts <robin.watts@artifex.com>
2bc43397c39db60b865ca6afd14c048d9e595359

Avoid leak of lib path blocks.

GS keeps a lib_path postscript array with a list of directories
in. Currently this memory is assumed to be "permanent", and is
never freed by the system. This means that whenever we use -I
we leak a block.

Here, we change the system over so that we copy the different
path components into memory blocks and free them at the end.

This seemingly simple task is made much harder by the way that
gs throws out some of the entries in the libpath at random
points during execution.

Accordingly, I have rejigged the code slightly, and introduced
comments to explain what is going on, in the hopes that the
next person through this code (in another 20 years) will have
an easier time understanding the assumptions baked into it.

psi/imain.c
psi/imainarg.c
psi/iminst.h


2019-01-03 15:14:25 +0000
Robin Watts <robin.watts@artifex.com>
4aadfa18ccc7fd23e3e4e0a262bcda51ef815b3f

Bug 700438: Fix SEGV due to overflowing double->int conversion.

Thanks to Ken for doing most of the investigation on this.

The problem is that we have a double value of 5e9 that won't fit
into an int (and becomes INT_MIN). This huge negative value is then
added to a pointer and we access out of range.

The fix is simply to check for our double values being representable
as ints before we proceed - if not we throw a rangecheck. This is
reasonable as it corresponds to an image being positioned stupidly
far off the page.

The complication with this commit comes in that it collides with
some very suspect old fixes for Bugs 686843 and 687411. The patch
for 686843 makes the same change in 2 places in the code. It looks
like 687411 is reported as the same issue, but the fix for it appears
to be reverting one of the fixes for 686843 - I suspect that the
patch was reversed.

Given that we can't reproduce the original problems that these bugs
were trying to solve any more, I am reverting the code to a saner
form. If the problems recurr, we can reexamine then.

base/gximag3x.c
base/gximage3.c


2019-01-02 14:43:58 -0800
Nancy Durgin <nancy.durgin@artifex.com>
5a1b7b9e67f5b9827338fe65881608c530a89a35

Remove remaining ImageType 2 support, which is now dead code

ImageType 2 was only used for display postscript.

Made make_upath() static, since it is now only used locally by zupath.

base/gsiparm2.h
base/gximage2.c
base/gxiparam.h
base/lib.mak
devices/gdevx.c
psi/zupath.c
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2018-11-18 14:45:00 +0000
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
486f3b4a677180bbef2553114bf13916c76e1884

Bug 697545: Update gx_image_enum_begin to correctly handle error returns.

base/gxi12bit.c
base/gxiclass.h
base/gxicolor.c
base/gxifast.c
base/gximono.c
base/gxipixel.c
base/gxiscale.c


2019-01-02 11:34:52 -0800
Nancy Durgin <nancy.durgin@artifex.com>
0b3e0befdc87323eb518d6233c5fcdf5e006e6dc

Removed has_alpha flag from postscript high-level image functions

The flag was only set to 'true' by the .alphaimage operator, which was
only used by display postscript and has now been removed.

All other callers passed hard-coded 'false', so the argument is now
extraneous.

psi/iimage.h
psi/zimage.c
psi/zimage3.c
psi/ztrans.c


2019-01-02 11:54:21 +0000
Robin Watts <robin.watts@artifex.com>
42646d6c9e264d8f8c34e5e32cde3e02ff83b87d

Pull in fixes from lcms2mt repo.

(This pulls in the latest fixes from mainline lcms2 too).

lcms2mt/README.1ST
lcms2mt/src/cmsopt.c
lcms2mt/src/cmsxform.c
lcms2mt/src/lcms2_internal.h


2019-01-02 10:02:28 +0000
Ken Sharp <ken.sharp@artifex.com>
ef075a44f37f89dcbff03bf0bdcc7e7b6fe17c15

Address compiler warnings

Remove unused variables (x4)

Add include files to fix 'implicit declaration' warnings (x2)

Rewrite a (now) misleading comment.

base/gdevmpla.c
base/gscspace.c
devices/gdevpsd.c
devices/vector/gdevpdft.c
psi/zfont1.c


2019-01-01 13:27:45 +0000
Robin Watts <robin.watts@artifex.com>
11fb2c3140b33f88056d5009b62a98f4ad921109

Fix gpdl --disable-compile-inits build.

Silly typos were preventing chunks 1,2,3 of the romfs being
built.

base/lib.mak


2018-12-29 09:54:09 -0800
Michael Vrhel <michael.vrhel@artifex.com>
416a5ebe1f7435f6dc8894576f40a8f247ed386c

Bug 688210: Add psdcmyk16 and psdrgb16 devices

So the patch that was provided was far from sufficient in making this
work. There was significant work that needed to be done in the
pdf14 device to ensure that the transparency put_image operation
worked correctly. Not sure if the author was paid a bounty but I
question if it was properly tested.

I tested this with some extreme altona files and others and
everything seems to be working well now. Having the psdcmyk16 device
is nice as it is our only device to have full spot color support and
16 bit output precision.

base/gdevmpla.c
base/gdevp14.c
base/gxblend.h
base/gxblend1.c
base/lib.mak
base/unix-gcc.mak
base/unixansi.mak
configure.ac
devices/devs.mak
devices/gdevpsd.c
devices/gdevpsd.h
doc/Devices.htm
psi/msvc.mak


2018-12-28 14:55:14 +0000
Ken Sharp <ken.sharp@artifex.com>
bfecb45e881eee39b2159873b1954f911dcb7fa3

Coverity ID 328395 - check return from ref_stack_push

psi/zdevice.c


2018-12-17 20:16:27 +0000
Robin Watts <robin.watts@artifex.com>
1a61ba8825e80bbd779192950d61474fb7581a26

Remove "device filter stack" as it is long unused.

base/gdevsclass.c
base/gsdfilt.c
base/gsdfilt.h
base/gxgstate.h
windows/ghostscript.vcproj


2018-12-19 09:47:55 -0800
Nancy Durgin <nancy.durgin@artifex.com>
264e3cd12621d8270af08ab645a8aaf2b1b00f7e

Undefine internal functions in gs_dps2.ps

(Note that despite the name, this isn't really display postscript)

.UserObjects
.fixcurrenthalftonescreen
.makehalftoneRGBV
.fixsethalftonescreen
.makestackdict

Resource/Init/gs_dps2.ps


2018-12-20 16:09:26 +0000
Ken Sharp <ken.sharp@artifex.com>
48008d0fbcdb26f1deac44f47eb6b0551e4ea17e

pdfwrite/PDF interpreter/transparency - identify page level groups

Bug #700376 "Color change after reprocessing PDF with Ghostscript"

The problem here lies in identifying the difference between a /Group
entry in the Page dictionary, and a Group encountered as part of an
operation during the course of a Page content stream.

To the rendering code, there is no difference, but pdfwrite needs to
be able to identify Page level groups so that it can attach them to the
Page dictionary when it writes them out.

Previously we've been doing this by detecting the fact that we haven't
started writing anything to the page stream. However, this is simply
not good enough, in the case of this bug report, the first thing that
happens is the file runs a form, which has a Group. Because we haven't
written anything to the page yet, we think its a page level Group and
emit it as such.

The problem is that in the original, we had set a constant alpha of
0.55. When we run the form that is self-contained and uses an alpha of
1, but because its in a form, the result of rendering the form is
composited with the page so far (currently nothing) with teh result that
the form contents are drawn 50% opaque.

When we come to handle this in pdfwrite, the fact that we think the
Group for the Form is at the page level causes us to write the Form
content stream in the page (and the Group for the Form is also put
in the Page dictionary), and we fail to emit a constant alpha, because
the form resets it to 1 before executing any marks. That means we
'optimise out' the change to 0.55 and the form is drawn 100% opaque.

This commit introduces a new transparency compositor operation
'PDF14_BEGIN_TRANS_PAGE_GROUP', the rendering code has been modified
to treat this as exactly equivalent to a 'PDF14_BEGIN_TRANS_GROUP' so
that there are no rendering differences.

The pdfwrite device, however, can use it to identify with certainty
that a given Group is at the Page level and treat it specially.

This results in 5 files in the test suite showing progressions, mostly
subtle, but one quite marked difference. The files are:
Altona_Technical_v20_x4.pdf, Bug691783.pdf, Bug691982.pdf, CATX3146.pdf,
x_-_no_compression_bomb.pdf
*only* when processed through the pdfwrite device.

Resource/Init/pdf_draw.ps
Resource/Init/pdf_main.ps
base/gdevp14.c
base/gstrans.c
base/gstrans.h
devices/vector/gdevpdft.c
psi/ztrans.c
xps/xpsgradient.c
xps/xpsimage.c
xps/xpsopacity.c


2018-12-19 10:09:24 -0800
Nancy Durgin <nancy.durgin@artifex.com>
16b7aba969bc1d607d80ddab5c8d2430bd36b6a0

Remove iimage2.h, zimage2.c (dead code after dps removal)

Remove all the references to these files.

doc/Develop.htm
psi/iimage2.h
psi/int.mak
psi/zimage2.c
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2018-12-19 10:32:40 -0800
Nancy Durgin <nancy.durgin@artifex.com>
fa1c24756797e43dd63d5318c961baf5f99e2428

Cleanup from no-longer-existing .alphaimage operator

Remove <has_alpha> parameter and handling from .colorimage
Remove references to .alphaimage from comments and stuff

Resource/Init/gs_img.ps


2018-12-19 08:53:32 -0800
Michael Vrhel <michael.vrhel@artifex.com>
0466d01e1677c8a4a8e57a191710842c844e5ad4

Bug 698828: Change of TRC in default_gray.icc

Reviewing this bug revealed that out default_gray.icc profile had a gamma
of 1.8. The proper gamma should be the same as that used by default_rgb.icc
which has the sRGB color space TRC. This commit fixes the issue. Unfortunately
this is going to cause a huge number of changed files.

iccprofiles/default_gray.icc


2018-12-18 14:24:34 -0800
Nancy Durgin <nancy.durgin@artifex.com>
3c58541e2dff52bf9d481f7cd385386716e2bdd5

Remove Display Postscript-related cooperative multitasking code and state

The code this was supporting was in zcontext.c, which has already been
deleted.

psi/icontext.c
psi/icstate.h
psi/interp.c
psi/oper.h


2018-12-13 08:57:50 -0800
Nancy Durgin <nancy.durgin@artifex.com>
cc156631163eb9c156e0863387def7368abe5a8b

Change zmisc.c implementation of usertime to start at 0

The Display Postscript implementation in zcontext.c always returns 0
the first time 'usertime' is called, and counts time from there.

Since that implementation is going away, change the one in zmisc.c to
behave the same way. It used to return a value based on the time since the
process started, which would be variable depending on the implementation.

Both implementations increment based on time spent processing.

This change causes vasarely.ps to run the same with and without dps.

psi/icontext.c
psi/icstate.h
psi/zmisc.c


2018-12-12 07:43:13 -0800
Nancy Durgin <nancy.durgin@artifex.com>
0d04beddf3f2b5f5eac46f2ae9d5ab0452e38ada

Removing display postscript and NeXT dps operators.

This only removes operators that are DPS only. They are marked with
a "DPS" in the PLRM. Also removes related internal operators.

(gs_img.ps) Remove img_utils_dict
Dependency on gs_dps.ps is gone. Can just define the utility funcs for use
and then just undef them at end.

(gs_init.ps)
Don't need to undef dps operators anymore, because they won't be defined

(pdf_draw.ps)
Change PDF implementation to call .setscreenphase directly

This used to call it via the dps operator 'sethalftonephase', but that
is going away, so just make .setscreenphase be part of the pdf
implementation directly.

Also move implementation of .setscreenphase to zpdfops.c

(gs_cet.ps)
No longer need to undef 'deviceinfo' for CET because it won't be defined

(gs_btokn.ps)
Replace the DPS operators in .installsystemnames with placeholders

Keeps the length/values in the array the same, just removing dps operators.

(icontext.c)
Needed to modify the no_reschedule() proc to return 0 instead
of an error. I think we can delete a ton of related code, in future commit,
because the code handling the time_slice_proc and reschedule_proc should
no longer be needed.

(lots of changes)
Delete dps-related source files, update makefiles and other files that
reference the deleted files.

Makefile.in
Resource/Init/gs_cet.ps
Resource/Init/gs_dpnxt.ps
Resource/Init/gs_dps.ps
Resource/Init/gs_img.ps
Resource/Init/gs_init.ps
Resource/Init/pdf_draw.ps
base/gs.mak
base/gsdpnext.h
base/gsdps.c
base/gsdps.h
base/lib.mak
base/openvms.mak
base/openvms.mmk
base/unix-gcc.mak
base/unixansi.mak
gpdl/pspcl6_gcc.mak
gpdl/pspcl6_msvc.mak
psi/icontext.c
psi/int.mak
psi/msvc.mak
psi/os2.mak
psi/psromfs.mak
psi/zcontext.c
psi/zdpnext.c
psi/zdps.c
psi/zpdfops.c
toolbin/pre.chk
toolbin/pre.tcl
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2018-12-18 11:41:35 -0800
Michael Vrhel <michael.vrhel@artifex.com>
164c0da6464b3c9da4923ca4827616a85f0f95a9

Bug 699152: gen ordered screen generation

Fix typo in output formatting and clean up a few warnings.

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


2018-12-18 09:34:11 -0800
Michael Vrhel <michael.vrhel@artifex.com>
83224c6384cebe4d7463d7b3d7c240c52ca9030b

Bug 700383: Add support for scRGB

XPS files can define RGB colors with things like

Fill="sc#1, 0.0231533665, 0.08021982, 0.226965874"

This implies that the color space is not sRGB (the standard default in XPS)
but rather scRGB which shares the primaries of sRGB but has a gamma of 1.0.

Lots of progressions in the XPS files expected with this commit.

base/gscspace.c
base/gscspace.h
base/gsicc_manage.c
base/gsicc_manage.h
base/lib.mak
iccprofiles/scrgb.icc
xps/xpstop.c


2018-12-18 10:25:59 +0000
Ken Sharp <ken.sharp@artifex.com>
0996199c8607807f423ebf67d576482f8f2bbadb

XPS interpreter - remove special case for artificial bold with pdfwrite

Bug #700382 "Synthetic bold generation too heav"

There was special case code for handling artificially emboldended text
in xps_flush_text_buffer, when the output device could directly handle
text rendering mode 2 (fill and stroke). This was because the pdfwrite
device, the only device capable of handling this mode, did some nasty
trickery with the CTM.

At some point this trickery has been removed, probably as a result of
the ongoing work to handle stroke+fill as a graphics primitive. The
result is that the hackery is no longer required, and in fact causes
the stroke width to be incorrectly calculated, because we are trying to
reverse a later calculation with the CTM, which is no longer applied.

So simply remove the whole section of code. This shows a very few
differences in the test suite, all at low resolution (72 dpi) where
text is slightly bolder, these appear to be (very minor)
progressions.

xps/xpsglyphs.c


2018-12-15 15:19:14 +0000
Ken Sharp <ken.sharp@artifex.com>
2183d4712847901ddf46989e07bdc4dd94a1197f

pdfwrite - improve h/vmtx table generation for embedded TrueType fonts

Bug 700099 " glyph spacing changed after going through pdfwrite"

This is a difficult one to explain. The primary problem is that the
original PostScript contains multiple EPS files, which contain multiple
embedded subsets of the same font, but all with the same name.

Because these subsets are small, they appear to pdfwrite to be the same
font, the checks we use to check the font do not test every possible
characteristic, because that would be slow.

Now this is not a problem, except that for bug #697376 we did an ugly
hack.

The generation of embedded TrueType fonts badly needs rewritten. Currently
we copy some tables, copy and amend other tables, and generate some tables
from scratch. This has led to numerous problems, on and off.

In the case of bug 697376, we were only writing the hmtx table with
exactly as many metrics as the actual glyphs we put in the output file,
and patched the hhea tale so that it had the correct number of
hLongMetrics entries. But the spec says that every glyph (even those
which are empty in the glyf table!) must have a lsb entry. So Acrobat
Distiller threw an error on encountering our font.

This was solved by copying the hmtx table instead of generating it. Fine
as far as it goes, but in this case we have hit the problem where we are
using glyphs from two different fonts. The hmtx table from the first font
has the wrong metrics for the glyphs in the second font, which leads to
spacing errors.

The only possible solution, until we can find time to rewrite all of this
is to 'pad out' the hmtx table with lsb entries for the glyphs which are
present in the glyf table, but not actually used.

I have a sneaky suspicion that this is still incorrect, we should be
writing the metrics at the correct place (GID) in the table, instead
of as a block, but this works well enough for now.

devices/vector/gdevpsft.c


2018-12-14 13:04:04 -0800
Michael Vrhel <michael.vrhel@artifex.com>
6bcf3eb2fd2bca68eef17a8cfcbf272e22d647d1

Bug 698721 Overprint mode getting used during shading pattern

base/gscspace.c
base/gsstate.c


2018-12-14 09:31:45 -0800
Michael Vrhel <michael.vrhel@artifex.com>
7a9359b06801cea8a7a3c4469c1e7f31564a962c

Add missing index update in pdf14 buffer debug

base/gdevp14.c


2018-12-12 12:48:39 +0000
Robin Watts <robin.watts@artifex.com>
085c795835284d2f0d91ebc87faf5b2da1376bca

Fix header inclusions.

Run a release build on a linux machine to make arch.h etc. Then
run toolbin/headercompile.pl to test compiling each headerfile
by itself.

Resolve all the missing #includes, add missing repeated include
guards and copyright statements.

Also, update all the header dependencies in the makefiles.

It is possible that the object dependencies in the makefiles can be
simplified now, but that's a task for another day.

base/ets.h
base/ets_tm.h
base/gdbflags.h
base/gdebug.h
base/gdevbbox.h
base/gdevdcrd.h
base/gdevddrw.h
base/gdevdevn.h
base/gdevdevnprn.h
base/gdevmem.h
base/gdevmpla.h
base/gdevmplt.h
base/gdevmrop.h
base/gdevp14.h
base/gdevpccm.h
base/gdevplnx.h
base/gdevppla.h
base/gdevprn.c
base/gen_ordered.h
base/gp_mswin.h
base/gp_os2.h
base/gpcheck.h
base/gpmisc.h
base/gs.mak
base/gsalloc.h
base/gsalpha.h
base/gsalphac.c
base/gsalphac.h
base/gsargs.h
base/gsbitops.h
base/gsbittab.h
base/gsccode.h
base/gscedata.h
base/gschar.h
base/gscie.h
base/gsclipsr.h
base/gscms.h
base/gscolor.h
base/gscolor1.h
base/gscolor3.h
base/gscompt.h
base/gscoord.h
base/gscpixel.h
base/gscrypt1.h
base/gscspace.h
base/gsdevice.h
base/gsdfilt.h
base/gsdll.h
base/gsdllwin.h
base/gsdps.h
base/gsequivc.h
base/gsexit.h
base/gsflip.h
base/gsfname.h
base/gsfont.h
base/gsform1.h
base/gsfunc.h
base/gsgc.h
base/gsgcache.h
base/gsgstate.h
base/gshsb.h
base/gsht.h
base/gshtx.h
base/gsicc_cache.h
base/gsicc_profilecache.h
base/gsimage.h
base/gsiparm2.h
base/gslib.h
base/gsline.h
base/gsmatrix.h
base/gsmchunk.h
base/gsmemory.h
base/gsnamecl.h
base/gsovrc.h
base/gspaint.h
base/gsparamx.h
base/gspath.h
base/gspath2.h
base/gspcolor.h
base/gsrect.h
base/gsrefct.h
base/gsrop.h
base/gsroprun1.h
base/gsroprun24.h
base/gsroprun8.h
base/gsropt.h
base/gsserial.h
base/gsstate.h
base/gsstrl.h
base/gstext.h
base/gstiffio.h
base/gstype1.h
base/gstypes.h
base/gsuid.h
base/gsutil.h
base/gsxfont.h
base/gx.h
base/gxband.h
base/gxbitfmt.h
base/gxcdevn.h
base/gxchrout.h
base/gxcindex.h
base/gxclip.h
base/gxclpath.h
base/gxclthrd.h
base/gxcmap.h
base/gxcomp.h
base/gxcoord.h
base/gxcpath.h
base/gxctable.h
base/gxdcconv.h
base/gxdcolor.h
base/gxdda.h
base/gxdevbuf.h
base/gxdevcli.h
base/gxdevmem.h
base/gxdevndi.h
base/gxdevrop.h
base/gxdevsop.h
base/gxdht.h
base/gxdhtserial.h
base/gxdither.h
base/gxdtfill.h
base/gxfapi.h
base/gxfarith.h
base/gxfcache.h
base/gxfill.h
base/gxfillsl.h
base/gxfilltr.h
base/gxfillts.h
base/gxfixed.h
base/gxfont0.h
base/gxfont1.h
base/gxfont42.h
base/gxgetbit.h
base/gxgstate.h
base/gxhintn.h
base/gxhldevc.h
base/gxht_thresh.h
base/gxhttile.h
base/gxiclass.h
base/gxiscale.c
base/gxmatrix.h
base/gxmclip.h
base/gxobj.h
base/gxoprect.h
base/gxp1impl.h
base/gxpaint.h
base/gxpath.h
base/gxpcache.h
base/gxsample.h
base/gxsamplp.h
base/gxshade4.h
base/gxstate.h
base/gxttf.h
base/gxttfb.h
base/gxtype1.h
base/gxxfont.h
base/gzht.h
base/gzline.h
base/jmemcust.c
base/jmemcust.h
base/lib.mak
base/pcwin.mak
base/sa85d.h
base/sbcp.h
base/sbtx.h
base/scanchar.h
base/sdcparam.h
base/sdct.h
base/sfilter.h
base/simscale.h
base/sisparam.h
base/sjpeg.h
base/sjpegc.c
base/slzwx.h
base/smd5.h
base/smtf.h
base/spdiffx.h
base/spngpx.h
base/spprint.h
base/spwgx.h
base/srdline.h
base/srlx.h
base/ssha2.h
base/sstring.h
base/strmio.h
base/szlibx.h
base/tiff.mak
base/ttfinp.h
base/ttfsfnt.h
base/ttload.h
base/ttobjs.h
base/tttype.h
devices/devs.mak
devices/gdevxalt.c
pcl/pcl/pcstate.h
pcl/pcl/pgstate.h
pcl/pl/plchar.c
pcl/pl/pldraw.h
pcl/pl/plht.c
pcl/pl/plmain.h
pcl/pxl/pxgstate.h
psi/bfont.h
psi/btoken.h
psi/dscparse.h
psi/dwdll.h
psi/dwimg.h
psi/files.h
psi/ibnum.h
psi/ichar.h
psi/ichar1.h
psi/icharout.h
psi/icid.h
psi/icie.h
psi/icolor.h
psi/iconf.h
psi/icremap.h
psi/icsmap.h
psi/icstate.h
psi/iddstack.h
psi/idebug.h
psi/idicttpl.h
psi/idisp.h
psi/idosave.h
psi/idparam.h
psi/ifcid.h
psi/ifilter2.h
psi/ifont.h
psi/ifont1.h
psi/ifont2.h
psi/ifont42.h
psi/ifrpred.h
psi/ifunc.h
psi/ifwpred.h
psi/igc.h
psi/igcstr.h
psi/iht.h
psi/iimage.h
psi/iimage2.h
psi/iinit.h
psi/ilevel.h
psi/imain.h
psi/imainarg.h
psi/imemory.h
psi/iminst.h
psi/inames.h
psi/inamestr.h
psi/int.mak
psi/interp.h
psi/iparam.h
psi/iparray.h
psi/ipcolor.h
psi/isave.h
psi/iscan.h
psi/iscanbin.h
psi/iscannum.h
psi/isdata.h
psi/isstate.h
psi/istkparm.h
psi/istream.h
psi/istruct.h
psi/itoken.h
psi/iutil.h
psi/iutil2.h
psi/ivmem2.h
psi/ivmspace.h
psi/oparc.h
psi/opcheck.h
psi/opdef.h
psi/opextern.h
psi/winint.mak
psi/zchar42.h
psi/zcie.h
psi/zcolor.h
psi/zfile.h
psi/zfrsd.h
psi/zfunc.h
psi/zicc.h
toolbin/headercompile.pl
windows/ghostscript.vcproj


2018-12-14 10:38:19 +0000
Ken Sharp <ken.sharp@artifex.com>
9d23c4d9a6c02416341992d8b29226273df07af8

PDF interpreter - preserve stroke colour/space round SMask

Bug #699179 " Chart lines rendered as black when converting from pdf to png or jpg"

Michael ran the problem down to the fact that the stroke colour space
is set before an ExtGState with a Group which has an SMask. The colour
space before the SMask is an ICCBased space and afterwards it is
DeviceGray.

The SMask itself has a Group and that group is defined by a Form XObject
which has (yet another) Group. This Group is defined as having a
DeviceGray space. The problem is that when we executed a SMask in the
interpreter, we saved the fill colour space and values and restored
them at the end (we can't simply use gsave/grestore), but we did not
preserve the stroke colour space and colourants.

This commit saves that as well. This results in a progression with
pdfwrite with one file and three other files showing subtle progressions
with all devices (586_-_missing_images_gs_SMask_not_applied.pdf,
fireworks_with_radial_shading.pdf, x_-_recursive_xobjects_cause_crash.pdf)

Resource/Init/pdf_draw.ps


2018-12-14 08:44:36 +0000
Chris Liddell <chris.liddell@artifex.com>
c7b69c7799c32ec3e895f2053bb6c4a5e2ceb340

Fix array index typo for resolution (-r) parameter

psi/imainarg.c


2018-12-13 16:06:46 +0000
Chris Liddell <chris.liddell@artifex.com>
0a6cf27a94f14234b4edad6d8af851a6ba7144c0

Bug 700361: Explicitly setup color fields in txtwrite

Because txtwrite just uses the default implementations for sampled images
and masks, we want to setup various color related data on initialisation.

This just means setting separable_and_linear appropriately and calling
set_linear_color_bits_mask_shift().

Prevents a divide by zero when trying to use the values from
dev->color_info.comp_bits

devices/vector/gdevtxtw.c


2018-12-11 12:26:12 +0000
Chris Liddell <chris.liddell@artifex.com>
3e4d8a0ab793ddd889acbcd2a521cfe5a30e5525

Add product, copyright and version info to Windows binaries

This appears in the Windows Explorer: Properties -> Details dialogue.

base/gscdef.c
base/gscdefs.h
psi/dwmain.rc
psi/gsdll32.rc
psi/winint.mak


2018-12-03 15:06:12 +0000
Chris Liddell <chris.liddell@artifex.com>
218180b6d38a4641807775c032d8774c165a7657

Add checks for multiple master validity

Validate multiple master fonts at definefont time - this saves checking each
item multiple as we pass them into Freetype (or other font scaler library).

psi/zfapi.c
psi/zfont1.c


2018-12-03 14:59:55 +0000
Chris Liddell <chris.liddell@artifex.com>
85bb44261edbf10552a09c839decc669f63a8142

Add an "r_is_number()" macro

By moving the t_integer and t_real enum values to consecutive positions,
starting on a multiple of 2, we can check for a "number" type in a single step.

Useful for values specced as reals, but which may be integer values, and thus
parsed into integer objects. This means validation can be a single check,
rather than checking for real and integer individually.

Also use the macro in various places.

psi/iref.h
psi/zcolor.c
psi/zfunc.c


2018-11-29 14:03:46 -0800
Nancy Durgin <nancy.durgin@artifex.com>
e280984683a5ca0f2d496a93d0333b4a89ab7f42

Undef internal funcs in gs_setpd.ps
Had to rearrange the order of functions, so there are quite a few diffs from that.

/.selectmedia
/.computemediasize
/.prepareparams
/.trysetparams
/.installpagedevice

(couldn't undef .uninstallpagedevice because it is called from C code)

Resource/Init/gs_setpd.ps


2018-12-12 16:01:29 +0000
Robin Watts <robin.watts@artifex.com>
25205fe4aa9d6dc70dd20da8a2ca5e659823bb0c

Update clusterpush.pl

toolbin/localcluster/clusterpush.pl


2018-12-02 15:55:55 +0000
Robin Watts <Robin.Watts@artifex.com>
a44306a2ed48b3cee8e5246e6db0300eb8113c0d

Improve Claptrap headers.

base/claptrap-impl.h
base/claptrap.h


2018-12-11 09:01:26 +0000
Ken Sharp <ken.sharp@artifex.com>
134b38ac7b8587c9b4bb080b34473ea5e67d48d7

remove unused variable to silence compiler warning

base/gsicc_lcms2mt.c


2018-12-11 09:00:02 +0000
Ken Sharp <ken.sharp@artifex.com>
c6451b921ec9f7bab14977552321a12f6f2a87b8

Add parentheses to silence a compiler warning

base/gdevsclass.c


2018-12-08 07:24:43 -0800
Michael Vrhel <michael.vrhel@artifex.com>
3efb86d5d75240b04bed497426cec3dbef36c304

Bug 699305 Softmask with knockout non-isolated group

We were not considering the softmask for the shape when
doing group composition

base/gxblend.c


2018-12-08 14:51:51 +0000
Ken Sharp <ken.sharp@artifex.com>
68b052d0d704037369352eb3692eb9792361fc81

PDF interpreter - Improve T42 CharStrings creation for non-symbolic fonts

Bug #700158 "ghostscript produces incorrect JPG if SubsetFonts=false"

The problem is not in fact a problem with the pdfwrite device, it is
in fact the poorly documented way that Acrobat deals with TrueType
fonts, the symbolic/non-symbolic flags and Encodings.

When the font has a 3,1 CMAP subtable we use a number of sources of data
to try and build a CharStrings dictionary, which we use to map a glyph
name to a glyph ID:

Encoding CharStrings
character code --------> glyph name -----------> glyh ID

However when the font has no 3,1 CMAP subtable the specification says
we should try to use a 1,0 CMAP instead. For 1,0 tables we were not
using the 'prebuilt_encoding' to generate the CharStrins, which meant
that we making less use of information than we might, and some glyphs
were replaced by the /.notdef when rendering.

This commit adds the prebuilt_encoding to the sources of information
we use to generate Charstrings when using a 1,0 CMAP subtable.

This fixes the problem, and shows a progression with one file in our
test suite.

Resource/Init/gs_ttf.ps


2018-12-07 11:33:18 -0800
Michael Vrhel <michael.vrhel@artifex.com>
78af4f91e7a5958acab262f3e90b5ce2a0768562

Add a profile for a particular RGB color space

iccprofiles/a98.icc


2017-11-17 15:17:03 +0000
Chris Liddell <chris.liddell@artifex.com>
abb742af3affbe00da625a1272d682ac5fd4c964

Commit of gpdl-shared-device branch.

This commit is a squashed version of the gpdl-shared-device
branch. Essentially this is a first version of the new
language switching mechanism.

This does not build as part as "all", but rather as "experimental"
or "gpdl".

Resource/Init/gs_cet.ps
Resource/Init/gs_init.ps
base/gp_mspol.c
base/gs.mak
base/gsalloc.c
base/gsdevice.c
base/gsiodev.c
base/gsiodevs.c
base/gslibctx.c
base/gslibctx.h
base/gsmalloc.c
base/gsmalloc.h
base/gsmchunk.c
base/gsmemory.c
base/gsmemory.h
base/gsmemret.c
base/gsstate.c
base/gsutil.c
base/gxdownscale.c
base/gxdownscale.h
configure.ac
devices/devs.mak
devices/gdevchameleon.c
gpdl/psi/psitop.c
pcl/pcl/pctop.c
pcl/pl/pjparsei.c
pcl/pl/pl.mak
pcl/pl/plapi.c
pcl/pl/plapi.h
pcl/pl/plmain.c
pcl/pl/plmain.h
pcl/pl/pltop.c
pcl/pl/pltop.h
pcl/pl/plwmainc.c
pcl/pl/realmain.c
pcl/pxl/pxtop.c
psi/dwdll.h
psi/dwnodll.c
psi/gsdll2.def
psi/gsdll32.def
psi/gsdll32metro.def
psi/gsdll64.def
psi/gsdll64metro.def
psi/gsdllARM32metro.def
psi/ialloc.c
psi/iapi.c
psi/iapi.h
psi/icstate.h
psi/igc.c
psi/imain.c
psi/imain.h
psi/imainarg.c
psi/imainarg.h
psi/imemory.h
psi/iminst.h
psi/int.mak
psi/interp.c
psi/ireclaim.c
psi/msvc.mak
psi/opextern.h
psi/psapi.c
psi/psapi.h
psi/zdevice.c
psi/zfont.c
psi/ziodevsc.c
windows/ghostscript.vcproj
xps/xpstop.c


2018-12-07 18:53:59 +0000
Ken Sharp <ken.sharp@artifex.com>
eab61428b3fa1e4078e71febefe406dad499814e

txtwrite - allow some slop in zero-width detection

Bug #700322 " Endless loop when converting pdf to text "

While trying to fit text (text format 2 or 3) we do some heuristic
juggling to decide whether or not to use a calculated minimum size.
During this we check to see whether the width is zero, and if it is
we don't try to use it because it would result in an infinite loop.

We actually need to allow a little 'slop' around zero, in case floating
point errors result in a very small, but not quite zero, width.

The loop resuling in the bug isn't endless, but it is very lengthy.

devices/vector/gdevtxtw.c


2018-12-05 10:40:43 -0800
Ray Johnston <ray.johnston@artifex.com>
74723f099067f6b14f61f0cbf816c0b8536931a2

Improve gx_get_bits_copy determination of depth.

For devices that are separable, (GX_CINFO_SEP_LIN), it is better to use
the comp_bits to determine the depth of a plane. Seen with the display
device in spot color mode where dest_depth calculation from the depth
divided by num_components is not correct.

base/gdevdgbr.c


2018-12-04 21:31:31 +0000
Ken Sharp <ken.sharp@artifex.com>
fae21f1668d2b44b18b84cf0923a1d5f3008a696

subclassing devices - fix put_image method

The subclassing devices need to change the 'memory device' parameter to
be the child device, when its the same as the subclassing device.

Otherwise we end up trying to access the child device's memory pointers
in the subclassing device, which may not contain valid copies of
those pointers.

base/gdevsclass.c


2018-12-03 14:40:37 +0000
Ken Sharp <ken.sharp@artifex.com>
2e68cc460dbe349f68b81082ff7344db48eb4820

pdfwrite - don't try and apply transfer functions when converting colours

Bug #700052 "pdfwrite device grayscale conversion looses significant quality on gradients

The problem is that the file contains considerable spurious (ie has no
effect) transparency operatiosns. in this particular case a number of
objects are drawn with an SMask and the SMask uses a transfer function
to invert the single component colour space (The gray objects are in
fact described in a DeviceN [/Black] colour space, presumabkly to
still further pointlessly increase teh complexity).

When converting colour space we were altering the transfer function
from 'Presever' to 'Apply', but we can't actually apply the transfer
function to the SMask in this case.

So leave this as 'preserve for now', note that transfer functions are
deprecated, and not permitted in PDF 2.0.

devices/vector/gdevpdfp.c


2018-12-01 10:04:09 +0000
Ken Sharp <ken.sharp@artifex.com>
86ed59a3b47bc4b57fbd9c76681558c300d1471b

pdfwrite - conform to Acrobat limitations for PDF 1.4 to conform to PDF/A-1

Never noticed before, but PDF/A-1 mandates sticking to the architectural
limits of Acrobat described in the PDF 1.4 specification (Note, these
are not *PDF* Limitations, they are limitations of the Adobe
implementation).

It was possible for us to emit co-ordinate movements which are in real
numbers, but exceed 32767, which is outside the Acrobat limitation.

This commit alters that, and in fact uses the older limitation of
Acrobat 3 and 4, which limits co-ordinates to +/- 16K.

devices/vector/gdevpdts.c


2018-12-01 10:01:18 +0000
Ken Sharp <ken.sharp@artifex.com>
fb9d383dd90bb430e18bd9c039300f0cff589323

pdfwrite - PDF/A-1 must set Compatibility Level of 1.4

Noticed while working on a different bug. Its correct for PDF/A-2 to be
PDF 1.7, but not for PDF/A-1 we must conform to PDF 1.4.

devices/vector/gdevpdfp.c


2018-11-29 12:30:10 -0800
Nancy Durgin <nancy.durgin@artifex.com>
7eaa19df8086579009552162814b34c651f8d0d4

Fix .vmused undef to work properly

Had to both use an immediate reference and make it an operator.
(commit 2ff600a3c4fc169e7c6c1e83874a6bf63a6fb42b made .vmused an operator)

This test was failing and wasn't detected by cluster test:
debugbin/gs -DDELAYBIND -IResource/Init -sDEVICE=ppmraw -dSAFER

If I don't make it an operator, then this fails (cluster test detects):
debugbin/gs -Z: -o out.bin -IResource/Init -sDEVICE=ppmraw -sDEFAULTPAPERSIZE=letter -dNOPAUSE -dBATCH -K2000000 -dClusterJob -dJOBSERVER -dCETMODE %rom%Resource/Init/gs_cet.ps ~/work/samples/tests_private/ps/ps3cet/36-01.PS

Resource/Init/gs_res.ps


2018-11-28 10:09:01 -0800
Nancy Durgin <nancy.durgin@artifex.com>
932f4106a00e99e4ee32dcc02e57d3636f383ea1

Undef internal functions from level2dict

Resource/Init/gs_lev2.ps


2018-11-29 16:07:17 +0000
Robin Watts <robin.watts@artifex.com>
dce2ab5aead0028de39293da8cf835c76b00a7cf

Remove nasty type check in gs_fapi_finish_render.

This is a left over from when show and text enumerators were
significantly different. The only requirement now is that
text enumerators should set penum->cc to be NULL. We update
gs_text_enum_init_dynamic (and hence gs_text_enum_init) to
do this.

base/gstext.c
base/gxfapi.c


2018-11-29 11:48:25 +0000
Robin Watts <robin.watts@artifex.com>
3bd37e9686f93dabb7121406bf36e59941db8e59

Remove unnecessary checks on object types from gxfapi.c

These are no longer required as the enumerators are the same.

base/gxfapi.c


2018-11-29 17:32:30 +0000
Ken Sharp <ken.sharp@artifex.com>
66df699e2d7f19d87542c76e9d96167f2125e654

pdfwrite - add a check to ensure we don't create an invalid PDF file

related to bug #700291 The PDF file in that bug report was created by
Ghostscript and pdfwrite. The xref table is invalid because it has an
entry with an offset of 11 digits, which is illegal (the file exceeds
10GB in size)

Add a check when writing the xref table to see if any offset is greater
that 10 digits, and throw an error if it is. We can't check any earlier
because we don't know the offset of any object in the file until it is
read from its stored temporary file and written to the main output
file.

devices/vector/gdevpdf.c


2018-11-29 16:22:41 +0000
Chris Liddell <chris.liddell@artifex.com>
c0682e5dd674ecfedcb92ba114ce5c43306f270a

Only use FT weight vector API if FT is new enough

So strictly later than 2.9.1 or when using our patched sources (SHARE_FT==0)

Makefile.in
base/fapi_ft.c


2018-11-28 17:12:08 +0000
Chris Liddell <chris.liddell@artifex.com>
2756f0efae1d3966989b15a6526c5d80848b5015

Bug 700290: Fix problems with DELAYBIND and font substitution

Judicious use of immediate evaluation for .setnativefontmapbuilt and
.putgstringcopy to avoid problems with DELAYBIND

Resource/Init/gs_fonts.ps


2018-11-29 11:47:42 +0000
Robin Watts <robin.watts@artifex.com>
680b49775bf27fcfe3bcdbe7049abbba544f3329

Remove unnecessary checks on type of pgs.

No longer required since pgs and pis were merged.

base/gxchar.c
devices/vector/gdevtxtw.c


2018-11-29 11:33:20 +0000
Robin Watts <robin.watts@artifex.com>
6da179927d5aeaf936ebc81eb9d430f7edc0397a

Remove antiquated check in pdf_shift_text_currentpoint.

pdf_shift_text_currentpoint tests to see that the graphics state
it is passed is really a graphics state. We believe this is a
hangover from having graphics states and imager states.

Firstly, the check is wrong, as it uses penum->dev->memory when
it should be using penum->pgs->memory. Fixing this is enough to
solve the problem where this was seen (gpdl pdfwriting files).

Secondly, however the check is no longer needed, so the nicer fix
is to remove it completely.

devices/vector/gdevpdte.c


2018-11-29 10:55:32 +0000
Ken Sharp <ken.sharp@artifex.com>
cb77559a6825f6fa4b23c1d5efb981eadc7f948f

Source fixup, remove trailing whitespace

base/strmio.c


2018-11-14 16:56:43 -0800
Ray Johnston <ray.johnston@artifex.com>
f0ca2c929171a025e846a2eddd51f767e04c8e23

Bug 695813. Reduce memory usage for ICC profiles. Example AIX361DC_Save.pdf

The same ICC profiles and colorspace were used many times (in the example
the cited PDF_1.7_ATS file) which could result in memory usage growth and
performance impact associated with loading the same profile many times.
There was a icc_profile_cache in the gstate, but it was not being used for
ICCBased colorspaces, only for CIEBased* spaces.

Adding logic to cache ICCBased colorspaces and change ICCBased space to
be in stable memory so it can exist in the cache. This results in a
reduction of the RAM needed for the cited file from 1.0Gb down to 44Mb
and reduced the parse time from 29.4s down to 24.4s (overall time from
94.5s to 91.3s) for ppmraw 600 dpi.

Note that this optimization results in many fewer CS/cs operations being
emitted by pdfwrite, but this also can result in text being emitted as
TJ operations (glyphs with positioning) which can result in single pixel
shifts in glyphs. Sometimes this looks better, sometimes not, but the
reduction in size/complexity of the resulting PDF is worth it.

Resource/Init/pdf_draw.ps
base/gsicc_profilecache.c
psi/zicc.c


2018-11-28 14:04:23 +0000
Robin Watts <robin.watts@artifex.com>
34bb42a7bcd649675d618a62c9f8a3a673598787

Ensure that gs_cet.ps is not squashed in romfs.

This causes us to misinterpret it as being PCL, and defeats the
'skip if read more than once' test.

psi/psromfs.mak


2018-11-28 19:13:16 +0000
Robin Watts <robin.watts@artifex.com>
8d462b070127d3541402b4fda670e0b20c6a61a4

LCMS2MT: Planar data fix.

The PrecalculatedXFORMIdentity case was failing to allow for planar
data. Fix that here.

Also, optimise the src = dst case.

lcms2mt/src/cmsxform.c


2018-11-27 13:11:15 -0800
Nancy Durgin <nancy.durgin@artifex.com>
87ec442bc2b0bfa6607c5fb7d085dd85f24e1416

Undefine internal .findcategory

Resource/Init/gs_init.ps
Resource/Init/gs_ll3.ps
Resource/Init/gs_res.ps


2018-11-27 12:36:14 -0800
Nancy Durgin <nancy.durgin@artifex.com>
2ff600a3c4fc169e7c6c1e83874a6bf63a6fb42b

Undef a bunch of internal things in gs_res.ps

Resource/Init/gs_res.ps
Resource/Init/gs_resmp.ps


2018-11-14 22:30:43 +0000
Chris Liddell <chris.liddell@artifex.com>
a6da4c97bb99159269468d95daacdf11ab336187

Use the new Freetype FT_Set/Get_MM_WightVector API

Being able to set the weight vector in an existing FT font object avoids the
need to recreate the font every time the weightvector changes in Postscript.

Creating an FT font is a time consuming operation, so this can save considerable
time in jobs that make heavy use of multiple master fonts

base/fapi_ft.c
base/gxfapi.c


2018-11-14 22:29:24 +0000
Chris Liddell <chris.liddell@artifex.com>
bfddf70400bb1fd4b3f7bfd72f333ad09a0b6cba

Add a setweightvector analogue in Freetype

Avoids the need to recreate the FT font everytime the weightvector changes.

These Freetype changes have been accepted upstream:
http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=78a1e69517ca067224d6e33beffd25e2ec8361d2

freetype/include/freetype/ftmm.h
freetype/include/freetype/internal/services/svmm.h
freetype/src/base/ftmm.c
freetype/src/cff/cffdrivr.c
freetype/src/truetype/ttdriver.c
freetype/src/type1/t1driver.c
freetype/src/type1/t1load.c
freetype/src/type1/t1load.h


2018-11-27 19:43:29 +0000
Robin Watts <robin.watts@artifex.com>
3f93e079aa448a202329fd08a350485c3504b9dd

Fix typo in previous commit.

I failed dismally at checking the depth.

base/gdevdflt.c
devices/gdevbit.c


2018-11-27 17:24:38 +0000
Robin Watts <robin.watts@artifex.com>
c80766f966d2801a8608e72a1dea6dcb4bec4248

Bug 700278: Fix inverted colors in jpegcmyk output.

It seems that in the transform pixel region code, I know that
colours are in the right space, and therefore assume that there
will be a 1:1 mapping from the raw bytes into the device memory.

Sadly the jpegcmyk device inverts everything, so my assumption
was wrong.

Accordingly I've added a gxdso to tell me if the encoding is
direct. I've added this to the obvious devices - more may be
required in future.

If this is unimplemented, then we'll take the slower route
and look up colors.

base/gdevdflt.c
base/gdevp14.c
base/gxcmap.c
base/gxdevsop.h
devices/gdevbit.c


2018-11-26 18:01:25 +0000
Chris Liddell <chris.liddell@artifex.com>
779664d79f0dca77dbdd66b753679bfd12dcbbad

Have gs_cet.ps run from gs_init.ps

Previously gs_cet.ps was run on the command line, to set up the interpreter
state so our output more closely matches the example output for the QL CET
tests.

Allow a -dCETMODE command line switch, which will cause gs_init.ps to run the
file directly.

This works better for gpdl as it means the changes are made in the intial
interpreter state, rather than after initialisation is complete.

This also means adding a definition of the default procedure for black
generation and under color removal (rather it being defined in-line in
.setdefaultbgucr

Also, add a check so gs_cet.ps only runs once - if we try to run it a second
time, we'll just skip over the file, flushing through to the end.

Resource/Init/gs_cet.ps
Resource/Init/gs_init.ps


2018-11-21 13:43:50 -0800
Nancy Durgin <nancy.durgin@artifex.com>
5d967e5d2c0b63a3c7d67a08a53ff657d36f0d18

Undef some internal level3 implementation details

Also moved some undef's from gs_init.ps to gs_ll3.ps because they are
for things defined and used only in this file (or some are defined in
the C code, but still only used here).

Resource/Init/gs_init.ps
Resource/Init/gs_ll3.ps


2018-11-20 14:32:20 -0800
Nancy Durgin <nancy.durgin@artifex.com>
f1206fa3834b5a8ff798e08d9cfcbb27bb9bdd41

Remove dead code from gs_cspace.ps

These are dead code, apparently:
/..includecolorspace
/cs_substitute_generic
/cs_substitute_DeviceRGB_for_PDFX_or_PDFA

This one is called from C code (zcolor.c) and can't be undef'd
Added comment about how to trigger it.
/..nosubstdevicetest

Resource/Init/gs_cspace.ps


2018-11-20 12:47:40 -0800
Nancy Durgin <nancy.durgin@artifex.com>
d6630dfe7a2d44aec9193950acc34836a32f97e2

Undef'd things used locally in gs_btokn.ps (binary tokens)

/.objectprinttest
/.bosheader
/.cntobj
/.writeobject
/.writeobjects

Resource/Init/gs_btokn.ps


2018-11-20 12:19:28 -0800
Nancy Durgin <nancy.durgin@artifex.com>
c548ed1dca42cb77572b2a7f8448aad2ce98918c

Fix some previously attempted undef's

/.setdevicecolorrendering1 needs to be undef'd from both systemdict
and level2dict

/.ProcessICCcomment was misspelled

/.setpagesize is actually in statusdict and haven't successfully undef'd yet

Resource/Init/gs_icc.ps
Resource/Init/gs_init.ps


2018-11-27 14:08:33 +0000
Ken Sharp <ken.sharp@artifex.com>
de8b6458abaeb9d0b14f02377f3e617f2854e647

PS interpreter - fix EPSFitPage (again)

Bug #700279 "On square EPS files -dFitPage incorrectly rotates output"

The commit to fix bug #698555 altered the action of EPSFitPage so that
it set the media size form the BoundingBox (using EPSCrop) and then
relied on the usual PostScript page fitting.

However, as noted at the time, this does cause square pages to rotate.
This isn't actually incorrect, there is no specification for this its a
Ghostscript feature, and we're free to implement it any way we like.
However it is a change form the previous behaviour.

This commit reinstates the EPSFitPage code (in EPSBoundingBoxFitPage
in gs_epsf.ps) and fixes the calculations in that code when the content
is rotated onto the media (because it fits better that way) so that it
correctly scales and translates the content onto the new media.

because we are no longer using the PostScript page fitting code, this
no longer rotates square media.

Resource/Init/gs_epsf.ps
Resource/Init/gs_init.ps


2018-11-26 08:20:19 +0000
Ken Sharp <ken.sharp@artifex.com>
96c381cce28c27eac182549441a6c5025b0dcdd6

ps2write - move the page level save/restore wrapper

Bug #700232 "A5 duplex to duplex-capable Postscript printer prints single-sided"

Commit 0f6067d2531298060392d0e25fa759d320e03021 for bug #697245
removed a duplicate definition of pagesave, because it transpires that
Adobe interpreters don't free save objects when they are no longer
referenced. Previously we had defined /pagesave in both the page
content stream, and the code for altering page size.

The problem is that we alter media size as part of processing the
'stream' keyword, which is after we have defined /pagesave. Previously
we would then have redefined it if we needed to alter the media size.

When we got to the end of the page (after the showpage) we would then
restore the save object. Because we had defined the save object after we
had altered the media size the media would remain unchanged. With the
commit above, however, the media size would be restored back to the
original.

When we process page 2, the media size would then need to he altered
again, requiring a setpagedevice to be executed. The action of
setpagedevice, when Duplex is true, is to eject any unpaired pages and
start again with the first side.

Thus Duplex was working entirely correctly, simply not as desired.

This commit moves the pagesave and restore into the 'stream' and
'endstream' processing, so that is taken care of after any media size
changes.

devices/vector/gdevpdf.c
devices/vector/opdfread.ps


2018-11-26 15:19:35 -0800
Michael Vrhel <michael.vrhel@artifex.com>
2ceb01328c4270386299ef55dbdc06d1f26d63c8

Remove unneeded check for planar during color conversion

base/gsicc_lcms2mt.c


2018-11-26 12:14:21 -0800
Michael Vrhel <michael.vrhel@artifex.com>
56b4298a22c3253206615bc6fda34f74aaa72800

Avoid allocations when color transforming planar data

base/gsicc_lcms2mt.c


2018-11-14 14:27:26 -0800
Ray Johnston <ray.johnston@artifex.com>
461cdaa4287edac9bfd0caebf3e8291e0539a0fd

Fix some missing type checking and use check_read_type consistently

Some places checked with code, some places used the check__type
macro (which doesn't check for read access) and some places used
check_read_type. Also add check for CIEdict1 in hashcieaspace.

psi/zcolor.c


2018-11-14 14:19:42 -0800
Ray Johnston <ray.johnston@artifex.com>
e45b35ede042259ff9fbf36fa714e874fc5483db

Change hash key for the icc_profile_cache to uint64_t

This was ulong in some places and int64_t in another, but ulong on a
Windows build is only 32-bits. Make it consistent (and more bytes on
Windows).

base/gscms.h
base/gsicc_profilecache.c
base/gsicc_profilecache.h
psi/zcie.c
psi/zcie.h
psi/zcolor.c


2018-11-09 14:26:27 -0800
Ray Johnston <ray.johnston@artifex.com>
410a192c093c22ca1dbfc1764659faa6a48198a8

Fix infinite loop freeze running all PDF ATS files.

The infinite loop was caused by bumping the ref_count on a cache link
entry too early so that anytime we reached ICC_CACHE_MAXLINKS links in
the cache, we would loop forever.

This simplifies the code, removes a function that was only used once,
and also protects the clist multi-threading from potential lock up due
to more threads than slots in the icc_link_cache.

Add a semaphore when the link_cache is full (no zero ref_count entries)
to let other threads run and finish up with the links that are in the
cache.

No bug opened, but occurred with:
gs -r600 -sDEVICE=ppmraw -o /dev/null PDF_1.7_ATS/*.pdf
NB: This requires skipping AC8ZD1CC_Save.pdf since that needs a password.

base/gpsync.h
base/gscms.h
base/gsicc_cache.c
base/gxclthrd.c


2018-11-26 16:17:51 +0000
Robin Watts <robin.watts@artifex.com>
2501816e229ae98e1c0d9a91f8bf00b380301b55

Fix comment typo.

psi/zdevice.c


2018-11-23 16:24:43 +0000
Robin Watts <robin.watts@artifex.com>
f73fb86fb40d092b4b9a39f43a374bd70eac0d41

Remove more macros from iscan.c

psi/iscan.c


2018-11-26 15:14:12 +0000
Robin Watts <robin.watts@artifex.com>
9a364553aa4d0738ec763aa2c262af6fc82b088d

Make sfclose accept NULL.

All destructors should accept NULL. Anything else is insanity.

base/strmio.c


2018-10-22 18:47:40 +0100
Robin Watts <robin.watts@artifex.com>
40dc5b409c6262b18b4bf5386b5482ead4c511e3

Remove gpdl from the "all" Makefile targets.

Add it to a new "experimental" target that is what "all" used to
be.

Makefile.in
base/gs.mak
psi/msvc.mak


2018-09-14 14:00:40 +0100
Robin Watts <robin.watts@artifex.com>
b43a9362c8614182e77b89a3ff8d8c56a6628260

iscan.c: Remove some scan macros.

psi/iscan.c


2018-09-14 13:56:21 +0100
Robin Watts <robin.watts@artifex.com>
9e99c4ab4135f735091d4b3ffe26851604507db5

iscan.c: Demacro: ssarray

psi/iscan.c


2018-11-22 19:17:28 +0000
Robin Watts <robin.watts@artifex.com>
0718e9a4fdc1c107d772d1aff37566c73d5958f8

Remove ziodevs.c from MSVC project.

windows/ghostscript.vcproj


2018-11-19 17:38:11 +0000
Robin Watts <robin.watts@artifex.com>
edbad08f9c91c994ac8f8df45e0cbf37ca377104

Remove macro bletcherisms from stream code.

base/gsioram.c
base/gsiorom.c
base/sfxfd.c
base/sfxstdio.c
base/stream.c
base/stream.h
psi/zfilter.c
psi/zfrsd.c


2018-11-22 18:18:03 +0000
Robin Watts <robin.watts@artifex.com>
e1eecc89c943d20145a887c64193fb0bfb44c250

Squash warnings.

base/gdevdrop.c
base/gsicc_cache.c
base/gxclist.c
devices/gdevxcmp.c
pcl/pcl/pcfont.c
psi/ilocate.c
psi/zvmem.c


2018-11-22 16:30:49 +0000
Robin Watts <robin.watts@artifex.com>
8fe6187ace91d49c3ca07ab850bc1fe50da3409e

Remove STDIO_IMPLEMENTATION logic from Makefiles.

This has fallen out of usage to the degree where the non-C callbacks
based version hasn't even built for years (since at least 2006, by
my git archaeology). Just strip it out completely.

Makefile.in
base/gs.mak
base/msvclib.mak
base/openvms.mak
base/ugcclib.mak
base/unix-dll.mak
base/unix-gcc.mak
base/unixansi.mak
psi/int.mak
psi/msvc.mak
psi/os2.mak
psi/ziodevs.c
psi/ziodevsc.c


2018-11-07 16:03:59 +0000
Chris Liddell <chris.liddell@artifex.com>
07b4a67404479dfa3ae55835f05b6cc8699c9adc

Bring master up to date with 9.26 release branch

Docs, dates etc

Dates, change log, etc for 9.26 rc1

Dates, changelog, etc for 9.26 release

base/version.mak
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gs-vms.hlp
doc/sample_downscale_device.htm
doc/subclass.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


2018-11-14 21:11:43 +0000
Robin Watts <robin.watts@artifex.com>
4b50d93dfe0b539d2cbbf80b3db8c89362abb265

Add gpdlmemento target.

Also add "mementovg" targets for building memento with knowledge of
valgrind. Can't make this the default as then we'd not be able to
build memento on machines without valgrind installed.

base/unix-end.mak


2018-11-20 18:43:20 +0000
Chris Liddell <chris.liddell@artifex.com>
690bc91e0fff4314128becb98e27b8bdd182c194

Tweak gs_cet.ps papersize handling.

This file has always removed all but the default papersizes from
InputAttributes. Here, also ensure that we make that the current
page size to avoid problems with setpagedevice later on.

Resource/Init/gs_cet.ps


2018-11-20 13:44:22 +0000
Robin Watts <robin.watts@artifex.com>
bca00a68a20b4022ce6138d647daa0b6b7989c9a

Remove pl_top_cursor_t and move to using streams.

pcl/pl/pl.mak
pcl/pl/plcursor.c
pcl/pl/plcursor.h
pcl/pl/plmain.c
windows/ghostpcl.vcproj


2018-11-15 15:38:37 -0800
Nancy Durgin <nancy.durgin@artifex.com>
93e0445e2c9980a3e5eb066d61682e84716972bb

Delete gs_l2img.ps, and all references in makefiles and docs.

This is dead code that apparently hasn't been used for years. It was
defining some things in systemdict (.colorspaceimage, .csinextbits)
that are now also gone.

Resource/Init/gs_l2img.ps
doc/Develop.htm
doc/Psfiles.htm
psi/int.mak
psi/psromfs.mak
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2018-11-15 15:01:48 -0800
Nancy Durgin <nancy.durgin@artifex.com>
9a270eea5080ec418202dcb778c1215839123555

Undef a bunch of image-related things

If we get rid of display postscript, this simplifies to just getting rid of
the img_utils_dict, which contains all the things I have undefined.

Resource/Init/gs_img.ps


2018-11-15 09:23:55 -0800
Nancy Durgin <nancy.durgin@artifex.com>
e06edfb35e09d7e34d4c0c0a31931e28c4cd944d

Undefine a bunch of functions

undef .ProcessICCComment from gs_icc.ps

Undef .rewriteTempMapsNotDef in gs_cmap.ps

These are implemented in C code, so not associated with a particular ps file.

/.currentmatrix /.setmatrix /.setdevicecolorrendering1
/.setlinecap /.setlinejoin /.sizeimagebox /.systemvmcheck

Resource/Init/gs_cmap.ps
Resource/Init/gs_icc.ps
Resource/Init/gs_init.ps


2018-11-20 12:59:06 +0000
Robin Watts <robin.watts@artifex.com>
b7ee393b7afb0d584528173d98fe0509d1ea09ff

Remove needless macros in plmain.c

pcl/pl/plmain.c


2018-11-19 17:23:02 +0000
Ken Sharp <ken.sharp@artifex.com>
c0de6c578f685c03d21c2a5d934734081265d10e

Function cleanup - NULL pointers after free

The PostScript code seems to get away with this, but for the PDF
interpreter we need the object pointed to by the various 'params'
structure members to be NULL after they are freed, so that we don't
try to free memory which has already been freed.

base/gsfunc.c
base/gsfunc0.c
base/gsfunc3.c
base/gsfunc4.c


2018-11-19 09:28:41 +0000
Chris Liddell <chris.liddell@artifex.com>
af39fde7b765ea5550a857290d68f58468086a8c

Coverity CIDs: 326829, 326828 and 326827

Check return values for gdev_prn_open_printer()

contrib/gdevgdi.c
contrib/japanese/gdevrpdl.c
devices/gdevdjet.c


2018-11-19 09:00:54 +0000
Ken Sharp <ken.sharp@artifex.com>
4d98293c72cc5b5fe456065a3252d39e9ab28e4d

Coverity ID 327264 - move pointer NULL check

Due to recent changes in this code, the pointer was being dereferenced
before we checked it to see if it was NULL. Moe the check so that we
check for NULL before dereferencing.

The 'pvalue' of the operand can be NULL, even if the object is a t_device
type, because invalidate_stack_devices traverses the operand stack
looking for devices, and sets their pvalue member to NULL in order to
invalidate them so that they cannot be used.

psi/zdevice.c


2018-11-17 11:20:08 +0000
Ken Sharp <ken.sharp@artifex.com>
867deb44ce59102b3c817b8228d9cbfd9d9b1fde

Check structure types when using the r_ptr macro

Two more places where we were using the r_ptr macro to cast a PostScript
ref object into a structure without thoroughly checking that the object
was in fact a structure of the correct type.

One case did a partial check, but this is more robust.

base/gsfcid2.c
base/gsfcmap.c
psi/zdscpars.c
psi/zfcmap.c


2018-11-17 10:00:32 +0000
Ken Sharp <ken.sharp@artifex.com>
aba438b1835c4c0f4c2b0aee5b7d8430d7e58251

Coverity ID 94865

This had already been tackled, but it turns out there were a couple
more places where tempnames wasn't freed, but Coverity only seems to
flag them one at a time.

psi/imain.c


2018-11-17 09:37:07 +0000
Ken Sharp <ken.sharp@artifex.com>
5cfe86c6f37f4838746d7cc7e9e6125538af6e84

Coverity ID 323322

The new 'transform_pixel_region' method default for forwarding devices
tests the target device to see if its NULL (some forwarding devices are
not always forwarding devices, eg bbox), and if it is NULL then instead
of passing the call to the target device it calls the graphics library
default.

Unfortunately it was passing the target device as an argument, and this
is now certain to be NULL. In gx_default_transform_pixel_region_begin()
we then dereference the pointer which would cause a crash.

So instead, pass the device itself when its not actually a forwarding
device.

Also, some white space changes.

base/gdevnfwd.c


2018-11-16 17:56:46 +0000
Robin Watts <robin.watts@artifex.com>
79a6bb7c5e33e0acf281bf7f34e6c6cc20c2549c

Bug 700205: Bring jbig2dec's copy of memento up to date.

jbig2dec/memento.c
jbig2dec/memento.h


2017-07-03 13:07:29 +0100
Robin Watts <Robin.Watts@artifex.com>
bd6af85222da668b56a1815fefc374b2096029b5

Sync Memento from MuPDF.

* pointer checking functions.

Add some helpful functions for doing quick checks on pointer validity.
Use these in the reference counting functions.

* make ref counting advance events.

* misc sizeof fixes.

base/memento.c
base/memento.h


2018-09-19 17:27:11 +0100
Robin Watts <robin.watts@artifex.com>
7750a48097a387a006577a02e20e2673a77fc82f

Update language recognition mechanism.

Rather than each language implementation offering a single string
to be matched, they now offer a function to match the given
string.

This allows us to have the PJL recognising routine accept a
single <CR><LF> at the top of a PJL block.

Technically, this is against the spec, which very clearly says
that any UEL must be followed instantly by "@PJL" rather than
there being any whitespace there. Sadly, the file from bug 693269
sends UEL<CR><LF>@PJL... and so outputs a page of PJL in the
middle of the job without this fix.

Tests on Henry's HP printer show that his printer at least matches
this behaviour.

It is hard to see that there can be that many real world files out
there that will be adversely affected by this fix.

This means we now behave the same on bug 693269 as we did prior to
making our language switching actually switching languages.

gpdl/psi/psitop.c
pcl/pcl/pctop.c
pcl/pl/pjparse.c
pcl/pl/pjparsei.c
pcl/pl/plmain.c
pcl/pl/pltop.c
pcl/pl/pltop.h
pcl/pxl/pxtop.c
xps/xpstop.c


2018-11-15 15:24:10 +0000
Ken Sharp <ken.sharp@artifex.com>
46d3a9a658f3b92e554cffc3c2ace8c140118155

PS interpreter - check infinite result on exp, where possible

Bug #700181 "using exp with 0 as base" (again)

The reporter for the bug failed to mention this condition in the
original report. Technically we don't always have isinf() available
(I suspect all real compilers do these days) but where we do we can
check the result. Where we don't, we're stuck. This mimics the
behaviour of other math operations in Ghostscript.

psi/zmath.c


2018-11-15 14:18:17 +0000
Ken Sharp <ken.sharp@artifex.com>
1218b59561ba950e212ad4e585bd7b0612eb2102

PDF interpreter - use Appearance streams for highlight annotations

We were previously never using the Appearance stream for a highlight
annotation, which is documented as incorrect in the PDF 2.0 spec.

The reason we were not using it is because a very few PDF files render
differently if we do. This is because Acrobat 'sometimes', and I cannot
figure out the conditions for htis, ignores a perfectly valid Appearance
and generates a new one.

In this case a customer produced a file where the QuadPoints entry is
incorrect. If we use the Appearance stream (as Acrobat does) then the
rendering is correct. If we generate an appearance then, because the
QuadPoints are incorrect, the rendering is incorrect.

Since the PDF 2.0 specification now makes it clear that we should be
using a supplied Appearance stream, I've chosen to change the behaviour
so that we do.

I've also made the text for an appearance stream slightly more robust
and general.

This does produce a few diffs, because of the afore-mentioned files. In
my opinion Acrobat is incorrect in how it treats these files. Our new
rendering is correct.

Resource/Init/pdf_draw.ps


2018-11-14 21:04:46 +0000
Chris Liddell <chris.liddell@artifex.com>
ea1b3ef437f39e45874f821c06bd953196625ac5

Bug 700176: Use the actual output device for both devices in setdevice

Also fixes bug 700189.

The pdf14 compositor device, despite being a forwarding device, does not forward
all spec_ops to it's target, only a select few are special cased for that.
gxdso_current_output_device needs to be included in those special cases.

The original commit (661e8d8fb8248) changed the code to use the spec_op to
retrieve the output device, checking that for LockSafetyParams. If
LockSafetyParams is set, it returns an invalidaccess error if the new device
differs from the current device.

When we do the comparison between the two devices, we need to check the
output device in both cases.

This is complicated by the fact that the new device may not have ever been set
(and thus fully initialised), and may not have a spec_op method available at
that point.

base/gdevp14.c
psi/zdevice.c


2018-11-13 14:23:41 -0800
Nancy Durgin <nancy.durgin@artifex.com>
fe4c47d8e25d6366ecbb5ff487348148b908a89e

Undefine some level2-related operators

These are only a partial set. Undefine them in both the level2dict and
systemdict. They are undef'd in gs_init.ps because they are used outside
the scope of just gs_lev2.ps

/.execform1
/.getdevparams
/.setuserparams2
/.startjob
/.checkFilePermitparams
/.checksetparams
/.copyparam
/.setpagesize

Rename .dict1 to .pair2dict and use immediate reference.

Undef these at end of gs_lev2.ps (should never make it into systemdict):
/.pair2dict
/.checkprocesscomment

Resource/Init/gs_init.ps
Resource/Init/gs_lev2.ps


2018-11-14 17:37:02 +0000
Robin Watts <robin.watts@artifex.com>
66a273de3ca0560bd41a2448b264d78f9316ba6a

Fix PCL handling of slightly malformed PJL.

We parse the PJL lines in, and if we find a terminator character
other than '\n', we ignore the line. What is worse, we eat the
character that we trip over, so that if it (say) happened to be
an ESC, we then don't process the next command correctly.

pcl/pl/pjparse.c


2018-11-14 16:01:51 +0000
Ken Sharp <ken.sharp@artifex.com>
965a557a4cdc8f45ff962616b884c281abd6c72c

PS interpreter - in seticcspace, ensure the ICC dictionary is a dict

From a review of dict_find_string, that function does not check to see
if the object it is passed as an argument is a dictionary, so its
essential to make sure the argument is checked before calling.

This is the only remaining case I could find.

psi/zcolor.c


2018-11-13 04:18:21 +0100
Sebastian Rasmussen <sebras@gmail.com>
f1756124f0f3c542bd6c2a9b325dea6bf860fc61

jbig2dec: Only print repeated error/warning messages once.

base/sjbig2.c
base/sjbig2.h
jbig2dec/jbig2dec.c


2018-11-14 14:28:48 +0000
Ken Sharp <ken.sharp@artifex.com>
bcb605e49dbe306ba881818466f8be591510a9ab

PS interpreter - Throw error from exp when base is 0 and -ve exponent

Bug #700181 "using exp with 0 as base"

If base is 0, and exp is negative, then the result of exp is undefined
we should throw an error instead of pushing #INF.0 on the stack.

psi/zmath.c


2018-11-14 13:32:43 +0000
Robin Watts <robin.watts@artifex.com>
9a982079dabc985bbd26d69322f517495158e882

Update .gitattributes file.

Stolen largely from MuPDF's file. This should keep the tabs in
Makefiles from confusing things.

.gitattributes


2018-11-14 13:15:11 +0000
Robin Watts <robin.watts@artifex.com>
fa3ac5d4cfea23ddc4eed64fd6f552013019ad1a

MSVC: Remove #define for fstat from unistd.h

We already define it in stat_.h, which seems like a much more sensible
place.

base/unistd_.h


2018-11-14 09:50:08 +0000
Chris Liddell <chris.liddell@artifex.com>
661e8d8fb8248c38d67958beda32f3a5876d0c3f

Bug 700176: check the *output* device for LockSafetyParams

When calling .setdevice we were checking if LockSafetyParams was set, and if so
throwing an invalidaccess error.

The problem is, if another device, for example the pdf14 compositor is the 'top'
device, that does not (and cannot) honour LockSafetyParams.

To solve this, we'll now use the (relatively new) gxdso_current_output_device
spec_op to retrieve the *actual* output device, and check the LockSafetyParams
flag in that.

psi/zdevice.c


2018-11-14 09:31:10 +0000
Ken Sharp <ken.sharp@artifex.com>
9a1b3ac61761094713f44dedfce56013308a3b1d

PS interpreter - add some type checking

These were 'probably' safe anyway, since they mostly treat the objects
as integers without checking, which at least can't result in a crash.

Nevertheless, we ought to check.

The return from comparedictkeys could be wrong if one of the keys had
a value which was not an array, it could incorrectly decide the two
were in fact the same.

psi/zbfont.c
psi/zcolor.c
psi/zcrd.c
psi/zfjpx.c
psi/zfont.c
psi/zfont0.c
psi/zimage3.c
psi/ztrans.c


2018-11-14 09:27:00 +0000
Ken Sharp <ken.sharp@artifex.com>
606a22e77e7f081781e99e44644cd0119f559e03

Bug #700168 - add a type check

Bug #700168 "Type confusion in JBIG2Decode"

The code was assuming that .jbig2globalctx was a structure allocated
by the graphics library, without checking.

Add a check to see that it is a structure and that its the correct
type of structure.

psi/zfjbig2.c


2018-11-14 09:25:13 +0000
Ken Sharp <ken.sharp@artifex.com>
434753adbe8be5534bfb9b7d91746023e8073d16

Bug #700169 - unchecked type

Bug #700169 "Type confusion in setcolorspace"

In seticc() we extract "Name" from a dictionary, if it succeeds we then
use it as a string, without checking the type to see if it is in fact
a string.

Add a check on the type, and add a couple to check that 'N' is an integer
in a few places too.

psi/zicc.c


2018-11-07 15:03:48 -0800
Nancy Durgin <nancy.durgin@artifex.com>
4f168df2845e15e5f87232317472d09ad1b2f1a3

Move a bunch of existing undef's up to the array with the others.

Resource/Init/gs_init.ps


2018-11-08 15:34:38 -0800
Nancy Durgin <nancy.durgin@artifex.com>
b7e7a76098c33e04e22464b6278c68a02b3d39b0

Undefined a bunch of EPS things

Resource/Init/gs_epsf.ps


2018-11-07 15:00:27 -0800
Nancy Durgin <nancy.durgin@artifex.com>
6f8b9869b38909700dcf906332d8825a6c390765

Remove .endjob, which is not used anywhere

Resource/Init/gs_lev2.ps


2018-11-12 17:21:33 +0000
Chris Liddell <chris.liddell@artifex.com>
aeea342904978c9fe17d85f4906a0f6fcce2d315

Bug 700153: restore: always check available stack

Previously, we were checking there was enough stack space available when the
restore operation required a device change, but since we have to use
Postscript to reset the userparams (ick!), we need the stack check even when
not changing the device.

psi/zdevice2.c


2018-11-07 12:22:59 +0000
Chris Liddell <chris.liddell@artifex.com>
2dceb0400c5a571f23070891b8a8028d04926de1

Contrib devices: Check for error return opening output file

09-59.PS cycles through every available device, attempting to open each one.

For many devices this results in an invalid configuration (mainly a lack of
output file).

These devices, on being shutdown, ignored the lack of output file, and attempted
to write their final bytes out anyway (attempting to write data to a null
FILE * pointer), causing a segfault.

We now check the return value of gdev_prn_open_printer() and only write those
final bytes if gdev_prn_open_printer() completed successfully.

contrib/japanese/gdevespg.c
contrib/japanese/gdevnpdl.c
contrib/lips4/gdevl4r.c


2018-11-08 14:43:32 +0000
Ken Sharp <ken.sharp@artifex.com>
693baf02152119af6e6afd30bb8ec76d14f84bbf

PS interpreter - check the Implementation of a Pattern before use

Bug #700141 "Type confusion in setpattern"

As the bug thread says, we were not checking that the Implementation
of a pattern dictionary was a structure type, leading to a crash when
we tried to treat it as one.

Here we make the st_pattern1_instance and st_pattern2_instance
structures public definitions and in zsetcolor we check the object
stored under the Implementation key in the supplied dictionary to see if
its a t_struct or t_astruct type, and if it is that its a
st_pattern1_instance or st_pattern2_instance structure.

If either check fails we throw a typecheck error.

We need to make the st_pattern1_instance and st_pattern2_instance
definitions public as they are defined in the graphics library and we
need to check in the interpreter.

base/gsptype1.c
base/gsptype2.c
base/gsptype2.h
base/gxcolor2.h
psi/zcolor.c


2018-11-08 12:58:28 +0000
Robin Watts <robin.watts@artifex.com>
81f3d1e7247b9a8e29a388677b01959e612a28c7

Fix missing images due to transform_pixel_region and pattern_accumulator.

The pattern_accumulator was defaulting to the forwarding version
of transform_pixel_region, which was only dealing with the image
plane, not the mask. Accordingly nothing was being plotted.

Instead, use the default, which devolves to copy_color (for the
image data) and fill_rectangle (for the mask).

base/gxpcmap.c


2018-11-07 15:59:32 +0000
Chris Liddell <chris.liddell@artifex.com>
5a4fec2a34af925993192e197ab666fe542b79d3

Bump version number for release

Resource/Init/gs_init.ps
base/version.mak


2018-11-20 09:51:17 +0000
Chris Liddell <chris.liddell@artifex.com>
8efbedbab72687cb51e3c353d5665d00120eed4a

Dates, changelog, etc for 9.26 release

base/gscdef.c
base/version.mak
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gs-vms.hlp
doc/sample_downscale_device.htm
doc/subclass.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


2018-11-19 09:28:41 +0000
Chris Liddell <chris.liddell@artifex.com>
e5978ae6d1e4f3dee0a2838ed580b0373e102613

Coverity CIDs: 326829, 326828 and 326827

Check return values for gdev_prn_open_printer()

contrib/gdevgdi.c
contrib/japanese/gdevrpdl.c
devices/gdevdjet.c


2018-11-19 09:00:54 +0000
Ken Sharp <ken.sharp@artifex.com>
a4228a0d8d657fca3bb3becb93a43fae061beae8

Coverity ID 327264 - move pointer NULL check

Due to recent changes in this code, the pointer was being dereferenced
before we checked it to see if it was NULL. Moe the check so that we
check for NULL before dereferencing.

The 'pvalue' of the operand can be NULL, even if the object is a t_device
type, because invalidate_stack_devices traverses the operand stack
looking for devices, and sets their pvalue member to NULL in order to
invalidate them so that they cannot be used.

psi/zdevice.c


2018-11-17 11:20:08 +0000
Ken Sharp <ken.sharp@artifex.com>
c796ccb512ac581f5ac492fda8807d41769c47e8

Check structure types when using the r_ptr macro

Two more places where we were using the r_ptr macro to cast a PostScript
ref object into a structure without thoroughly checking that the object
was in fact a structure of the correct type.

One case did a partial check, but this is more robust.

base/gsfcid2.c
base/gsfcmap.c
psi/zdscpars.c
psi/zfcmap.c


2018-11-17 10:00:32 +0000
Ken Sharp <ken.sharp@artifex.com>
cb9bb72643e95383bcacd88ab718565f3df9a510

Coverity ID 94865

This had already been tackled, but it turns out there were a couple
more places where tempnames wasn't freed, but Coverity only seems to
flag them one at a time.

psi/imain.c


2018-11-17 09:37:07 +0000
Ken Sharp <ken.sharp@artifex.com>
c69827c308b608719d786fc14c8518af4dd6b335

Coverity ID 323322

The new 'transform_pixel_region' method default for forwarding devices
tests the target device to see if its NULL (some forwarding devices are
not always forwarding devices, eg bbox), and if it is NULL then instead
of passing the call to the target device it calls the graphics library
default.

Unfortunately it was passing the target device as an argument, and this
is now certain to be NULL. In gx_default_transform_pixel_region_begin()
we then dereference the pointer which would cause a crash.

So instead, pass the device itself when its not actually a forwarding
device.

Also, some white space changes.

base/gdevnfwd.c


2018-11-15 15:24:10 +0000
Ken Sharp <ken.sharp@artifex.com>
4548ceaf5ada7f7a4c4da5907e27fec62c1ce63d

PS interpreter - check infinite result on exp, where possible

Bug #700181 "using exp with 0 as base" (again)

The reporter for the bug failed to mention this condition in the
original report. Technically we don't always have isinf() available
(I suspect all real compilers do these days) but where we do we can
check the result. Where we don't, we're stuck. This mimics the
behaviour of other math operations in Ghostscript.

psi/zmath.c


2018-11-15 14:18:17 +0000
Ken Sharp <ken.sharp@artifex.com>
a4e3cb230bfdbf9cb5a0d30763889e58f8215ed1

PDF interpreter - use Appearance streams for highlight annotations

We were previously never using the Appearance stream for a highlight
annotation, which is documented as incorrect in the PDF 2.0 spec.

The reason we were not using it is because a very few PDF files render
differently if we do. This is because Acrobat 'sometimes', and I cannot
figure out the conditions for htis, ignores a perfectly valid Appearance
and generates a new one.

In this case a customer produced a file where the QuadPoints entry is
incorrect. If we use the Appearance stream (as Acrobat does) then the
rendering is correct. If we generate an appearance then, because the
QuadPoints are incorrect, the rendering is incorrect.

Since the PDF 2.0 specification now makes it clear that we should be
using a supplied Appearance stream, I've chosen to change the behaviour
so that we do.

I've also made the text for an appearance stream slightly more robust
and general.

This does produce a few diffs, because of the afore-mentioned files. In
my opinion Acrobat is incorrect in how it treats these files. Our new
rendering is correct.

Resource/Init/pdf_draw.ps


2018-11-14 21:04:46 +0000
Chris Liddell <chris.liddell@artifex.com>
e8be28b49c6a43db1861119288933b5a8fdbef73

Bug 700176: Use the actual output device for both devices in setdevice

Also fixes bug 700189.

The pdf14 compositor device, despite being a forwarding device, does not forward
all spec_ops to it's target, only a select few are special cased for that.
gxdso_current_output_device needs to be included in those special cases.

The original commit (661e8d8fb8248) changed the code to use the spec_op to
retrieve the output device, checking that for LockSafetyParams. If
LockSafetyParams is set, it returns an invalidaccess error if the new device
differs from the current device.

When we do the comparison between the two devices, we need to check the
output device in both cases.

This is complicated by the fact that the new device may not have ever been set
(and thus fully initialised), and may not have a spec_op method available at
that point.

base/gdevp14.c
psi/zdevice.c


2018-11-14 16:01:51 +0000
Ken Sharp <ken.sharp@artifex.com>
5db929cf393fa330bf916da37f5d2a5954a3b0c3

PS interpreter - in seticcspace, ensure the ICC dictionary is a dict

From a review of dict_find_string, that function does not check to see
if the object it is passed as an argument is a dictionary, so its
essential to make sure the argument is checked before calling.

This is the only remaining case I could find.

psi/zcolor.c


2018-11-13 04:18:21 +0100
Sebastian Rasmussen <sebras@gmail.com>
a92e38603902b22c5b20fecefa5da3d2a233516c

jbig2dec: Only print repeated error/warning messages once.

base/sjbig2.c
base/sjbig2.h
jbig2dec/jbig2dec.c


2018-11-14 14:28:48 +0000
Ken Sharp <ken.sharp@artifex.com>
3bb28e08002ef4a90bddb05aa6cd06a256153663

PS interpreter - Throw error from exp when base is 0 and -ve exponent

Bug #700181 "using exp with 0 as base"

If base is 0, and exp is negative, then the result of exp is undefined
we should throw an error instead of pushing #INF.0 on the stack.

psi/zmath.c


2018-11-14 09:50:08 +0000
Chris Liddell <chris.liddell@artifex.com>
35766ceb3b28aad95bd63655b1d621a82d3a5b06

Bug 700176: check the *output* device for LockSafetyParams

When calling .setdevice we were checking if LockSafetyParams was set, and if so
throwing an invalidaccess error.

The problem is, if another device, for example the pdf14 compositor is the 'top'
device, that does not (and cannot) honour LockSafetyParams.

To solve this, we'll now use the (relatively new) gxdso_current_output_device
spec_op to retrieve the *actual* output device, and check the LockSafetyParams
flag in that.

psi/zdevice.c


2018-11-14 09:31:10 +0000
Ken Sharp <ken.sharp@artifex.com>
548bb434e81dadcc9f71adf891a3ef5bea8e2b4e

PS interpreter - add some type checking

These were 'probably' safe anyway, since they mostly treat the objects
as integers without checking, which at least can't result in a crash.

Nevertheless, we ought to check.

The return from comparedictkeys could be wrong if one of the keys had
a value which was not an array, it could incorrectly decide the two
were in fact the same.

psi/zbfont.c
psi/zcolor.c
psi/zcrd.c
psi/zfjpx.c
psi/zfont.c
psi/zfont0.c
psi/zimage3.c
psi/ztrans.c


2018-11-14 09:27:00 +0000
Ken Sharp <ken.sharp@artifex.com>
ef252e7dc214bcbd9a2539216aab9202848602bb

Bug #700168 - add a type check

Bug #700168 "Type confusion in JBIG2Decode"

The code was assuming that .jbig2globalctx was a structure allocated
by the graphics library, without checking.

Add a check to see that it is a structure and that its the correct
type of structure.

psi/zfjbig2.c


2018-11-14 09:25:13 +0000
Ken Sharp <ken.sharp@artifex.com>
67d760ab775dae4efe803b5944b0439aa3c0b04a

Bug #700169 - unchecked type

Bug #700169 "Type confusion in setcolorspace"

In seticc() we extract "Name" from a dictionary, if it succeeds we then
use it as a string, without checking the type to see if it is in fact
a string.

Add a check on the type, and add a couple to check that 'N' is an integer
in a few places too.

psi/zicc.c


2018-11-12 17:21:33 +0000
Chris Liddell <chris.liddell@artifex.com>
3005fcb9bb160af199e761e03bc70a9f249a987e

Bug 700153: restore: always check available stack

Previously, we were checking there was enough stack space available when the
restore operation required a device change, but since we have to use
Postscript to reset the userparams (ick!), we need the stack check even when
not changing the device.

psi/zdevice2.c


2018-11-07 12:22:59 +0000
Chris Liddell <chris.liddell@artifex.com>
2f99c138cf60d75621eb03ae924453b968274694

Contrib devices: Check for error return opening output file

09-59.PS cycles through every available device, attempting to open each one.

For many devices this results in an invalid configuration (mainly a lack of
output file).

These devices, on being shutdown, ignored the lack of output file, and attempted
to write their final bytes out anyway (attempting to write data to a null
FILE * pointer), causing a segfault.

We now check the return value of gdev_prn_open_printer() and only write those
final bytes if gdev_prn_open_printer() completed successfully.

contrib/japanese/gdevespg.c
contrib/japanese/gdevnpdl.c
contrib/lips4/gdevl4r.c


2018-11-08 14:43:32 +0000
Ken Sharp <ken.sharp@artifex.com>
7c8f85a23db24031945af3cacb2c0b4740e67072

PS interpreter - check the Implementation of a Pattern before use

Bug #700141 "Type confusion in setpattern"

As the bug thread says, we were not checking that the Implementation
of a pattern dictionary was a structure type, leading to a crash when
we tried to treat it as one.

Here we make the st_pattern1_instance and st_pattern2_instance
structures public definitions and in zsetcolor we check the object
stored under the Implementation key in the supplied dictionary to see if
its a t_struct or t_astruct type, and if it is that its a
st_pattern1_instance or st_pattern2_instance structure.

If either check fails we throw a typecheck error.

We need to make the st_pattern1_instance and st_pattern2_instance
definitions public as they are defined in the graphics library and we
need to check in the interpreter.

base/gsptype1.c
base/gsptype2.c
base/gsptype2.h
base/gxcolor2.h
psi/zcolor.c


2018-11-08 12:58:28 +0000
Robin Watts <robin.watts@artifex.com>
4d6e2125d402033d9073bae3ccde1d95eb3ebc22

Fix missing images due to transform_pixel_region and pattern_accumulator.

The pattern_accumulator was defaulting to the forwarding version
of transform_pixel_region, which was only dealing with the image
plane, not the mask. Accordingly nothing was being plotted.

Instead, use the default, which devolves to copy_color (for the
image data) and fill_rectangle (for the mask).

base/gxpcmap.c


2018-11-07 16:03:59 +0000
Chris Liddell <chris.liddell@artifex.com>
e477875e170d738d7ea1497e1489a6d344c3ef29

Dates, change log, etc for 9.26 rc1

base/gscdef.c
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gs-vms.hlp
doc/sample_downscale_device.htm
doc/subclass.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



Version 9.26 (2018-11-20)

Highlights in this release include:

  • Security issues have been the primary focus of this release, including solving several (well publicised) real and potential exploits.

    PLEASE NOTE: We strongly urge users to upgrade to this latest release to avoid these issues.

  • IMPORTANT: We are in the process of forking LittleCMS. LCMS2 is not thread safe, and cannot be made thread safe without breaking the ABI. Our fork will be thread safe, and include performance enhancements (these changes have all be been offered and rejected upstream). We will maintain compatibility between Ghostscript and LCMS2 for a time, but not in perpetuity. Our fork will be available as its own package separately from Ghostscript (and MuPDF).

  • Thanks to Man Yue Mo of Semmle Security Research Team, Jens Müller of Ruhr-Universität Bochum and Tavis Ormandy of Google's Project Zero for their help to identify specific security issues.

  • The usual round of bug fixes, compatibility changes, and incremental improvements.

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

Incompatible changes

  • None

Changelog

2018-11-20 09:51:17 +0000
Chris Liddell <chris.liddell@artifex.com>
d66acfae372e39e8cbc4ce6395b4451cac72516e

Dates etc for 9.26 release

base/gscdef.c
base/version.mak
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gs-vms.hlp
doc/sample_downscale_device.htm
doc/subclass.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


2018-11-19 09:28:41 +0000
Chris Liddell <chris.liddell@artifex.com>
e5978ae6d1e4f3dee0a2838ed580b0373e102613

Coverity CIDs: 326829, 326828 and 326827

Check return values for gdev_prn_open_printer()

contrib/gdevgdi.c
contrib/japanese/gdevrpdl.c
devices/gdevdjet.c


2018-11-19 09:00:54 +0000
Ken Sharp <ken.sharp@artifex.com>
a4228a0d8d657fca3bb3becb93a43fae061beae8

Coverity ID 327264 - move pointer NULL check

Due to recent changes in this code, the pointer was being dereferenced
before we checked it to see if it was NULL. Moe the check so that we
check for NULL before dereferencing.

The 'pvalue' of the operand can be NULL, even if the object is a t_device
type, because invalidate_stack_devices traverses the operand stack
looking for devices, and sets their pvalue member to NULL in order to
invalidate them so that they cannot be used.

psi/zdevice.c


2018-11-17 11:20:08 +0000
Ken Sharp <ken.sharp@artifex.com>
c796ccb512ac581f5ac492fda8807d41769c47e8

Check structure types when using the r_ptr macro

Two more places where we were using the r_ptr macro to cast a PostScript
ref object into a structure without thoroughly checking that the object
was in fact a structure of the correct type.

One case did a partial check, but this is more robust.

base/gsfcid2.c
base/gsfcmap.c
psi/zdscpars.c
psi/zfcmap.c


2018-11-17 10:00:32 +0000
Ken Sharp <ken.sharp@artifex.com>
cb9bb72643e95383bcacd88ab718565f3df9a510

Coverity ID 94865

This had already been tackled, but it turns out there were a couple
more places where tempnames wasn't freed, but Coverity only seems to
flag them one at a time.

psi/imain.c


2018-11-17 09:37:07 +0000
Ken Sharp <ken.sharp@artifex.com>
c69827c308b608719d786fc14c8518af4dd6b335

Coverity ID 323322

The new 'transform_pixel_region' method default for forwarding devices
tests the target device to see if its NULL (some forwarding devices are
not always forwarding devices, eg bbox), and if it is NULL then instead
of passing the call to the target device it calls the graphics library
default.

Unfortunately it was passing the target device as an argument, and this
is now certain to be NULL. In gx_default_transform_pixel_region_begin()
we then dereference the pointer which would cause a crash.

So instead, pass the device itself when its not actually a forwarding
device.

Also, some white space changes.

base/gdevnfwd.c


2018-11-15 15:24:10 +0000
Ken Sharp <ken.sharp@artifex.com>
4548ceaf5ada7f7a4c4da5907e27fec62c1ce63d

PS interpreter - check infinite result on exp, where possible

Bug #700181 "using exp with 0 as base" (again)

The reporter for the bug failed to mention this condition in the
original report. Technically we don't always have isinf() available
(I suspect all real compilers do these days) but where we do we can
check the result. Where we don't, we're stuck. This mimics the
behaviour of other math operations in Ghostscript.

psi/zmath.c


2018-11-15 14:18:17 +0000
Ken Sharp <ken.sharp@artifex.com>
a4e3cb230bfdbf9cb5a0d30763889e58f8215ed1

PDF interpreter - use Appearance streams for highlight annotations

We were previously never using the Appearance stream for a highlight
annotation, which is documented as incorrect in the PDF 2.0 spec.

The reason we were not using it is because a very few PDF files render
differently if we do. This is because Acrobat 'sometimes', and I cannot
figure out the conditions for htis, ignores a perfectly valid Appearance
and generates a new one.

In this case a customer produced a file where the QuadPoints entry is
incorrect. If we use the Appearance stream (as Acrobat does) then the
rendering is correct. If we generate an appearance then, because the
QuadPoints are incorrect, the rendering is incorrect.

Since the PDF 2.0 specification now makes it clear that we should be
using a supplied Appearance stream, I've chosen to change the behaviour
so that we do.

I've also made the text for an appearance stream slightly more robust
and general.

This does produce a few diffs, because of the afore-mentioned files. In
my opinion Acrobat is incorrect in how it treats these files. Our new
rendering is correct.

Resource/Init/pdf_draw.ps


2018-11-14 21:04:46 +0000
Chris Liddell <chris.liddell@artifex.com>
e8be28b49c6a43db1861119288933b5a8fdbef73

Bug 700176: Use the actual output device for both devices in setdevice

Also fixes bug 700189.

The pdf14 compositor device, despite being a forwarding device, does not forward
all spec_ops to it's target, only a select few are special cased for that.
gxdso_current_output_device needs to be included in those special cases.

The original commit (661e8d8fb8248) changed the code to use the spec_op to
retrieve the output device, checking that for LockSafetyParams. If
LockSafetyParams is set, it returns an invalidaccess error if the new device
differs from the current device.

When we do the comparison between the two devices, we need to check the
output device in both cases.

This is complicated by the fact that the new device may not have ever been set
(and thus fully initialised), and may not have a spec_op method available at
that point.

base/gdevp14.c
psi/zdevice.c


2018-11-14 16:01:51 +0000
Ken Sharp <ken.sharp@artifex.com>
5db929cf393fa330bf916da37f5d2a5954a3b0c3

PS interpreter - in seticcspace, ensure the ICC dictionary is a dict

From a review of dict_find_string, that function does not check to see
if the object it is passed as an argument is a dictionary, so its
essential to make sure the argument is checked before calling.

This is the only remaining case I could find.

psi/zcolor.c


2018-11-13 04:18:21 +0100
Sebastian Rasmussen <sebras@gmail.com>
a92e38603902b22c5b20fecefa5da3d2a233516c

jbig2dec: Only print repeated error/warning messages once.

base/sjbig2.c
base/sjbig2.h
jbig2dec/jbig2dec.c


2018-11-14 14:28:48 +0000
Ken Sharp <ken.sharp@artifex.com>
3bb28e08002ef4a90bddb05aa6cd06a256153663

PS interpreter - Throw error from exp when base is 0 and -ve exponent

Bug #700181 "using exp with 0 as base"

If base is 0, and exp is negative, then the result of exp is undefined
we should throw an error instead of pushing #INF.0 on the stack.

psi/zmath.c


2018-11-14 09:50:08 +0000
Chris Liddell <chris.liddell@artifex.com>
35766ceb3b28aad95bd63655b1d621a82d3a5b06

Bug 700176: check the *output* device for LockSafetyParams

When calling .setdevice we were checking if LockSafetyParams was set, and if so
throwing an invalidaccess error.

The problem is, if another device, for example the pdf14 compositor is the 'top'
device, that does not (and cannot) honour LockSafetyParams.

To solve this, we'll now use the (relatively new) gxdso_current_output_device
spec_op to retrieve the *actual* output device, and check the LockSafetyParams
flag in that.

psi/zdevice.c


2018-11-14 09:31:10 +0000
Ken Sharp <ken.sharp@artifex.com>
548bb434e81dadcc9f71adf891a3ef5bea8e2b4e

PS interpreter - add some type checking

These were 'probably' safe anyway, since they mostly treat the objects
as integers without checking, which at least can't result in a crash.

Nevertheless, we ought to check.

The return from comparedictkeys could be wrong if one of the keys had
a value which was not an array, it could incorrectly decide the two
were in fact the same.

psi/zbfont.c
psi/zcolor.c
psi/zcrd.c
psi/zfjpx.c
psi/zfont.c
psi/zfont0.c
psi/zimage3.c
psi/ztrans.c


2018-11-14 09:27:00 +0000
Ken Sharp <ken.sharp@artifex.com>
ef252e7dc214bcbd9a2539216aab9202848602bb

Bug #700168 - add a type check

Bug #700168 "Type confusion in JBIG2Decode"

The code was assuming that .jbig2globalctx was a structure allocated
by the graphics library, without checking.

Add a check to see that it is a structure and that its the correct
type of structure.

psi/zfjbig2.c


2018-11-14 09:25:13 +0000
Ken Sharp <ken.sharp@artifex.com>
67d760ab775dae4efe803b5944b0439aa3c0b04a

Bug #700169 - unchecked type

Bug #700169 "Type confusion in setcolorspace"

In seticc() we extract "Name" from a dictionary, if it succeeds we then
use it as a string, without checking the type to see if it is in fact
a string.

Add a check on the type, and add a couple to check that 'N' is an integer
in a few places too.

psi/zicc.c


2018-11-12 17:21:33 +0000
Chris Liddell <chris.liddell@artifex.com>
3005fcb9bb160af199e761e03bc70a9f249a987e

Bug 700153: restore: always check available stack

Previously, we were checking there was enough stack space available when the
restore operation required a device change, but since we have to use
Postscript to reset the userparams (ick!), we need the stack check even when
not changing the device.

psi/zdevice2.c


2018-11-07 12:22:59 +0000
Chris Liddell <chris.liddell@artifex.com>
2f99c138cf60d75621eb03ae924453b968274694

Contrib devices: Check for error return opening output file

09-59.PS cycles through every available device, attempting to open each one.

For many devices this results in an invalid configuration (mainly a lack of
output file).

These devices, on being shutdown, ignored the lack of output file, and attempted
to write their final bytes out anyway (attempting to write data to a null
FILE * pointer), causing a segfault.

We now check the return value of gdev_prn_open_printer() and only write those
final bytes if gdev_prn_open_printer() completed successfully.

contrib/japanese/gdevespg.c
contrib/japanese/gdevnpdl.c
contrib/lips4/gdevl4r.c


2018-11-07 16:03:59 +0000
Chris Liddell <chris.liddell@artifex.com>
ba84a01d19a60a8a9a3e834331621bb37cb44a6c

Dates, etc for 9.26 rc1

base/gscdef.c
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gs-vms.hlp
doc/sample_downscale_device.htm
doc/subclass.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


2018-11-07 00:32:29 +0000
Robin Watts <robin.watts@artifex.com>
8747f40646ad2da5c405bab5a1e85fba9b71b85b

Add nasty workaround for PXL stroking.

Filter paths to be filled to remove 1 dimensional sections.

base/gxpath.h
base/gxpcopy.c
pcl/pxl/pxpaint.c


2018-11-06 16:46:02 +0000
Chris Liddell <chris.liddell@artifex.com>
6dd9131bfa9bd2d723e745839e4bc8e5fdc817b7

Ensure stream and string persist as long as required

When we create an ICC based color space from a string source, we create a stream
object, with the stream data coming from that string.

Because the life of the ICC related objects created by the graphics library
is not dictated by the save/restore operations in the Postscript world, we
need to ensure that the stream and the string it references persist as long
as the graphics library needs.

To do this, we move the string data, and the stream object allocation into
"system VM", that is, garbage collected, but *not* save/restore memory.

psi/zcolor.c


2018-11-06 08:48:58 -0800
Ray Johnston <ray.johnston@artifex.com>
30ef5d0b5b14d3f4eaf7929b81aec2279933e1cc

Fix Bug 699806: Incorrect file size from "status" on Windows.

With commit afe8e546, I missed the use of _wstat and _stat in gp_mswin.c
for the "status" operator. Change to use _wstat64 and _stat64 and all
works. Tested with VS 2005 32-bit build and with VS 2015 32 and 64 bit
builds. Note the file size reported is correct for large files even on
a 32-bit build.

base/gp_mswin.c


2018-11-06 12:46:38 +0000
Robin Watts <robin.watts@artifex.com>
9bb753e22cad9e4a20570267cf8bd54e5910f7f2

Fix pattern clist data being freed with wrong memory_t.

gx_pattern_accum_alloc was allocating the pattern clist memory
using storage_memory->non_gc_memory. It was then being freed in
clist_close using cdev->bandlist_memory. The two are not the
same.

Change the allocation to use target->memory->non_gc_memory,
as cdev->bandlist_memory is set to that.

base/gxpcmap.c


2018-11-06 09:51:56 +0000
Chris Liddell <chris.liddell@artifex.com>
0b0825432e04cbb95731aeb22f3db75886a4e6d8

Bug 700133: handle out of range CIDs in CMap parsing

Implementation Limits sections of both PLRM and PDFRM limit the size of a CID
value to unsigned two byte values (max 65535). Acrobat and various other
consumers seem to silently ignore values outside this range in CMaps embedded
in PDF files.

We now limit the CID value to no more than 65535 when parsing a CMap from a
PDF file (and emit a warning), and *only* from a PDF file: CMap files read
from disk, and CMaps embedded in Postscript jobs will still throw an error.

Resource/Init/pdf_font.ps


2018-11-05 20:07:50 +0000
Robin Watts <robin.watts@artifex.com>
2b42541db28423c49cbf47549551a27e9399fd23

Fix dev spec op warning/handling.

My previous fiddling in this area wasn't quite right.

Originally, the code here didn't allow any device to provide
their own dev spec op (and the warning was hence never hit).

In lifting that restriction, the first commit allowed devices to
provide their own one. They then ran into the warning message.

The second commit fixed the warning message in this case, but
sadly left the warning message going off in many 'default' cases
(and what is more, failed to put the prn one in).

This one hopefully gets everything right. As the comments say
this does feel like a hack.

base/gdevprn.c


2018-11-05 15:32:46 +0000
Robin Watts <robin.watts@artifex.com>
d1d59a332b8c560e8949976006424439933c9c64

Scan converter: Fix pngalpha with zero height rectangles.

Because of the banding hack in pngalpha, zero height rectangles
aren't always the lowest scanline in the edgebuffer.

base/gxscanc.c


2018-11-05 14:02:51 +0000
Ken Sharp <ken.sharp@artifex.com>
85e6fd4df9bb51d5c36e7811a2bac4c52898b08c

pdfwrite - add a performance enhancing heuristic for text processing

Bug #700124 "pdfwrite device over 800% performance loss between 9.25 and 9.23"

This is a heuristic attempt to resolve the reduction in performance. The
code originally used the FontBBox to try and determine if a glven
glyph was completely clipped out, or was at least partially drawn.

For efficiency reasons we don't include glyphs which are clipper out
in the pdfwrite output, reducing the PDF size.

However in bug #699454 and bug #699571 we saw EPS files produced from
OneVision EPSExport which include fonts with a wildly inaccurate
FontBBox. Two commits; 6a4202691c4317a698fa23c5309ad8974fe2b003 and
3bf4f3ea45f0022b6cd36415f095f1bfc119fb73 resolved this.

The initial fix considered the advance width in addition to the glyph
width, but this proved to be insufficient with the second file which
drew the same glyph multiple times, with an advance width of 0. The
commit logs note that the only solution is to determine the glyph width
accurately, which means processing the glyph program for each glyph,
which has performance implications (ie its slower).

In order to try and alleviate this where possible, this commit looks at
the number of integer co-ordinates in font space by scaling the
FontBBox by the FontMatrix. If the resulting design space is small (an
arbitrary value of 0.1, 1e 100x100 was chosen as 'small') then we do
not use the FontBBox, but instead use the slower accurate method.

This may need some adjustment, and its entirely possible that it may,
in the long term, prove unreliable and have to be removed.

devices/vector/gdevpdte.c


2018-11-01 12:31:55 +0000
Robin Watts <robin.watts@artifex.com>
b4f29851a33ff04979bb2eb3a32ab62000c6f19c

Avoid misleading warning message.

If a printer device provides its own dev_spec_op parameter, the
system prints a warning. This warning is intended to ensure that
devices remember to call down to the default printer one, but
appears irrespective of whether they do or not. This means it will
confuse most users.

Instead, introduce a debug only dso that we can use to check that
printer devices do indeed forward properly, and use that to print
the warning only when required.

base/gdevprn.c
base/gxdevsop.h


2018-11-01 08:53:01 +0000
Robin Watts <robin.watts@artifex.com>
897dc2afc509fc331e66be43fbae2b20ded142c6

Avoid trampling on dev_spec_op when opening printer device.

base/gdevprn.c


2018-11-01 18:24:58 +0000
Robin Watts <robin.watts@artifex.com>
1303a9a45124fdea7c4f29858ff900d2d3393c76

Scan converter: Zero height rectangles hack.

Spot zero height rectangles, and arrange for them to be rendered.

base/gxscanc.c


2018-11-03 16:54:27 +0000
Robin Watts <robin.watts@artifex.com>
045239d2d00d8febf1804703019c15eb99ac1cfd

Scan converter: Reduce bbox size.

In some cases (specifically, the "centre of pixel" cases) we could
have constructed the bbox to be larger than it should have been.
Fix this here.

This produces diffs (mainly in banded files), because the skipping
calculations for scanlines below/above the edgebuffer can round
very slightly differently. These diffs are all 1 pixel things.

base/gxscanc.c


2018-11-03 14:58:05 +0000
Ken Sharp <ken.sharp@artifex.com>
d03f6e773d0c58c7799ca8f49de6298be59b4e0e

PDF interpreter - work around type 3 fonts with no FirstChar/LastChar

Bug #700130 "Invalid PDF file renders blank pages"

The file (and the customer original file) has a type 3 font with a
/Widths array, but neither of the required FirstChar or LastChar
entries.

With 9.25 and below this was leading to blank pages, where current code
continued. I think because the previous code left garbage on the stack.

This commit sets FirstChar to 0 and LastChar to the length of the
/Widths array if either is missing.

Resource/Init/pdf_font.ps


2018-11-03 10:40:38 +0000
Ken Sharp <ken.sharp@artifex.com>
d850ebc85cd49dd6445f7fd90f504c28c594aa32

Fix commit 71e99

Change dlmprintf to dmlprintf so it'll work.

I blame the reviewer myself.

base/gdebug.h


2018-11-03 09:29:24 +0000
Chris Liddell <chris.liddell@artifex.com>
71e99487758e464a077c6781893ce9c6eb4134df

Add debug only printing macros

Despite what one might think, dmprintf and co are not exclusing to debug builds
but are always present, and functional.

Generally, only the print macros for the -Z style debugging output are exluded
from debug builds.

This adds a dbgprintf and dbgmprintf family of macros which don't rely on a -Z
option to activate them, but are only present when DEBUG is defined.

Additionally, (in line with convention) the dbgprintf variants (rather than
dbgmprintf) are exluded when GS_THREADSAFE is defined, since we don't have
to a context (via a memory pointer) to ensure correct operation of stdout/stderr
in multithreaded environments.

base/gdebug.h


2018-11-02 13:53:55 +0000
Chris Liddell <chris.liddell@artifex.com>
5f1c1cbf68fe1f25b2a325b275992338d4d4e449

Bug 700126: Ensure JPEG passthrough gets shuts down on error

When an ioerror occurs, ensure we wind up the JPEG passthrough state, to
prevent dangling pointer(s) in pdfwrite.

base/sdct.h
base/sdctc.c
base/sdctd.c
base/sjpegd.c


2018-10-23 17:19:31 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
d0abc92713b2e84eb32c67839ddec2d160b3af8d

Bug 697545 : Prevent SEGV by propagating error code in af_loader_load_glyph.

Propagate error by checking for return code.

Error created using :-
MEMENTO_FAILAT=31598 ./membin/gpcl6 -sDEVICE=pbmraw -dMaxBitmap=2000 -o /dev/null ./tests_private/pcl/pcl5cfts/fts.0270

freetype/src/autofit/afloader.c


2018-10-31 15:30:22 +0000
Ken Sharp <ken.sharp@artifex.com>
ece5cbbd9979cd35737b00e68267762d72feb2ea

PDF interpreter - Don't allow page stream fonts to be used for Annotations

Bug #700096 "Poorly constructed PDF file can inappropriately reuse a Font"

The file has a page stream which uses a Helvetica font which is embedded
and subset, but does not have a subset prefix on the name.

A later annotation uses Helvetica, but does not embed it. So we load
the Helvetica from the font cache. Unfortunately, this is the subset
font, and its Encoding is incompatible (as well as missing many glyphs)
so we get a lot of .notdefs.

Here we put a save and restore pair around the page contents, so that
when we come to the annotation rendering, we have restored the font
cache to an 'empty' state, so that we won't try to load any fonts that
were defined in the page stream to satisfy annotation requests.

For some peculiar reason one broken Sumatra file renders slightly
differently with this in place, and another was wrong before, differently
wrong now.

Resource/Init/pdf_main.ps


2018-10-31 15:38:52 -0700
Ray Johnston <ray.johnston@artifex.com>
1ef5f08f2c2e27efa978f0010669ff22355c385f

Fix display device DisplayFormat=16#a0800 (Separation mode) broken by f2cf6829

The ICC profile checking needs to be told that the device supports_devn, so
add a spec_op proc to return true when in separation mode, and add a proc for
fill_rectangle_hl_color so that fillpage will work in Separation mode.

This was fixed for other devices in commit 250b5e83, but the display device
was not fixed then.

devices/gdevdsp.c


2018-10-31 15:30:05 -0700
Ray Johnston <ray.johnston@artifex.com>
ffcfd8d291d0bc4729a4959580befe4faef48b8f

Remove duplicate comment.

base/gxcmap.c


2018-10-30 17:13:57 +0000
Robin Watts <robin.watts@artifex.com>
8718be6504d227b925d1015d289f13209152c286

Scan converter fix.

Fix 'unevenness' seen in the bottom edge of strokes in:

tests/pdf/Bug6901014_CImg_flyer.pdf.ppmraw.300.1

This is part of the bug tail from the "barcode" fixes where
cursor positions at (y&255) == 0 are 'special'.

base/gxscanc.c


2018-10-30 17:13:59 +0100
Sebastian Rasmussen <sebras@gmail.com>
73d4e5d0ac7d697d74bf31ddaed944643f0543a1

Bug 700056: openjpeg allocator must return NULL if size too large.

Previously if an allocation larger than ARCH_MAX_UINT was requested
the size value was truncated and supplied to the gs allocator. Depending
on the values involved an allocation of this truncated value may
actually succeed. This allocation was then passed back to the openjpeg
library as claiming that the larger, initial allocation request was
satisfied, even though the allocation itself was actually smaller.
This resulted in segmentation faults.

base/sjpx_openjpeg.c


2018-09-20 20:24:47 +0800
Sebastian Rasmussen <sebras@gmail.com>
53163da329e2019e27a8876f6b2363628de2ae0f

jbig2dec: Fix signed/unsigned mismatches.

jbig2dec/jbig2_generic.c
jbig2dec/jbig2_halftone.c


2018-10-29 11:12:44 -0700
Ray Johnston <ray.johnston@artifex.com>
ecb88d9bd6f6cc1ea8b4dee9f2df50da04429135

Fix debug print in clist code -- index value was incorrect.

base/gxclrast.c


2018-10-26 16:47:23 +0100
Robin Watts <robin.watts@artifex.com>
2be9c4dfc343adafa49c3bbce5f205f771280851

Update mkromfs to allow for splitting data into chunks.

Call this in the pdlromfs builds to keep the chunk size
small enough to avoid out of memory errors during the
build (on plancks especially).

base/lib.mak
base/mkromfs.c
base/unixlink.mak
psi/msvc.mak


2018-10-29 16:17:50 +0000
Robin Watts <robin.watts@artifex.com>
a359d37fa7c1ba7e3910b83e8672ac9a4b110518

Add gs_font_dir_free.

This extracts some code from pdfwrite and makes it available to
other callers.

base/gsfont.c
base/gsfont.h
devices/vector/gdevpdf.c
pcl/pcl/pcfont.c
pcl/pxl/pxstate.c


2018-10-25 19:46:30 +0100
Chris Liddell <chris.liddell@artifex.com>
17262b11330552fb393bbd2907a9672d0d7eee48

Add a security policy link, and remove gsview.com link

The link for the security policy replaces the original 'team' link.

doc/API.htm
doc/C-style.htm
doc/Commprod.htm
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/sample_downscale_device.htm
doc/subclass.htm
doc/thirdparty.htm


2018-10-25 14:30:08 +0100
Ken Sharp <ken.sharp@artifex.com>
04333a6f1344df6b5069880cafe7b190d0984601

Fix pngalpha device with device subclassing

Bug #699815 "Segmentation fault for pdf input to pngalpha driver"

The pngalpha device, in pngalpha_create_buf_device() first creates an
in-memory rendering device (image32) and then overrides two of the
device methods with its own versions.

This doesn't work at all when we have subclassing devices loaded, because
the device that gets handed as the 'target' device is the head of the
chain of devices, and the pngalpha device simply pulls the methods
directly from that device. Note that this also wouldn't work if a
forwarding device were present.

We can work around it by descending the chain of devices, and pulling
the methods from the last device in the chain instead of using the
'target' directly. This still feels wrong but it should at least work.

devices/gdevpng.c


2018-10-25 09:22:14 +0100
Ken Sharp <ken.sharp@artifex.com>
ffac21a73b74c8ce01cbae406f7dd3bfd0a7ef65

Include gsstate.h to avoid a compiler warning

Has the definition of gs_currentcpsimode().

psi/ztype.c


2018-10-24 13:46:14 +0100
Ken Sharp <ken.sharp@artifex.com>
be2c93dca70926069df25467a724eb787497c6f7

Allow cvrs to operate on 64-bit integers

Bug #700011 "cvrs may truncate integers"

zcvrs() cast the PostScript intval to an unsigned int internally, which
truncates 64-bit values to 32-bit values. Other similar operators are
capable of handling 64-bit values.

This commit casts the result to a ps_uint (PostScript unsigned int)
which varies in size depending on the platform. If a 64-bit integer
data type is available it will be 64-bit otherwise it will be 32-bit.

Additionally, check CPSI mode and if it is set, cast the ps_int to an
unsigned int in order to explicitly truncate to a 32-bit value. We use
CPSI compatibility mode in our internal testing, and if we don't do this
then two of the Quality Logic CET files throw errors.

Finally add some words to Use.htm regarding the word size of platforms
and some of the implications regarding 64-bit values in PostScript.

doc/Use.htm
psi/ztype.c


2018-10-23 13:40:14 +0100
Chris Liddell <chris.liddell@artifex.com>
73f7c6eb92596087a1e30123ba0cdf701f8d6006

Bug 700023: Fix cups get/put_params LeadingEdge logic

Custom device LeadingEdge logic in complicated as it potentially requires
equivalent changes to changing the page size.

For a device like cups which merely wants the LeadingEdge value stored in its
own place it makes much more sense to allow the Ghostscript 'core' to handle
all the logic (which it has to do anyway to ensure the rendering is correct),
and then just copy the value into the cups specific place.

This saves the problem, as in this case, of unexpectedly ending up with two
LeadingEdge parameters being included in a call to put_params.

cups/gdevcups.c


2018-10-19 13:14:24 +0100
Chris Liddell <chris.liddell@artifex.com>
8e18fcdaa2e2247363c4cc8f851f3096cc5756fa

"Hide" a final use of a .force* operator

There was one use of .forceput remaining that was in a regular procedure
rather than being "hidden" behind an operator.

In this case, it's buried in the resource machinery, and hard to access (I
would not be confident in claiming it was impossible). This ensures it's
not accessible.

Resource/Init/gs_res.ps


2018-09-07 14:23:06 +0100
Chris Liddell <chris.liddell@artifex.com>
f6b11ea745395193f4f1fc8a7b09dda9913dbe72

Bug 699740: Better handle failing to set the nulldevice

When pushing the nulldevice, if gs_setdevice_no_erase() failed, that *could*
mean we end up freeing the device referenced in the graphics state.

If that happens, search back through the saved gstates to find the initial
graphics state, and pull the initial device from there.

This allows us to return a Fatal error code, and exit cleanly.

base/gsdevice.c
psi/zdevice.c


2018-10-18 14:11:45 -0600
Henry Stiles <henry.stiles@artifex.com>
09e6af81cccb5547a18baace0a792f22bc9ea927

Fix bug# 699969 - inverted colors and misplaced graphics.

Our testing of HP printers indicate that monochrome printers clear the
seed row for delta row compression for each each block of adaptive
compression data but color devices leave the row intact.

pcl/pcl/rtraster.c


2018-10-18 13:31:08 -0600
Henry Stiles <henry.stiles@artifex.com>
635dad8721def9da27e13b849ba8e37023703501

Remove unnecessary gs_opendevice() calls

For reasons unknown the target device was being opened prior to the
languages setting and opening the device with gs_setdevice_no_erase().
This is unnecessary and apparently wrong, gs_opendevice() does not
properly fill in the the device procedures (gx_device_fill_in_procs()).

pcl/pl/plmain.c
pcl/pxl/pxtop.c
xps/xpstop.c


2018-10-18 17:26:09 +0100
Robin Watts <robin.watts@artifex.com>
eb473839eed3eeaf9acc7db4d88a3a0a8ca5f432

Tweak htmldiff.pl to ignore empty lines without a confusing error.

toolbin/htmldiff.pl


2018-05-07 14:51:54 +0100
Robin Watts <robin.watts@artifex.com>
e29b99f71c5bdb766e7ee57363ce37cfdcab3621

Update transform_pixel_region with "direct 1:1" methods for memory devs.

base/gdevdrop.c
base/gxcmap.c
base/gxcmap.h


2018-05-07 11:32:44 +0100
Robin Watts <robin.watts@artifex.com>
852295de5b37409b51970cb9329227f1cf573a7b

Attempt transform_pixel_region acceleration for memory devices using templating.

base/gdevdrop.c


2018-05-04 19:37:24 +0100
Robin Watts <robin.watts@artifex.com>
1e926e47d349d0c962c6c64c64804d18c20bf9ba

Update clip device to be smarter about transform_pixel_region.

When the clip device is for a single rectangle (a very common case)
we can avoid resorting to the default transform_pixel_region routine,
and still use the device's (possibly) optimised one.

base/gxclip.c


2018-05-02 17:40:21 +0100
Robin Watts <robin.watts@artifex.com>
eefae1a50eb451584c2e17600933b723dbc68a0e

Implement transform_pixel_region for memory devices.

base/gdevdrop.c
base/gdevmem.h


2018-04-19 12:45:14 +0100
Robin Watts <robin.watts@artifex.com>
3b8f34c00e6ed1f7b4847a55d48b8027c0b0b946

Add "transform_pixel_region" device function.

Use this for handling image type 4 rendering.

The default version of this goes to rectangles. It also knows how to
send portrait images of 8bps to copy_color.

Next step is to write versions of this for the memory mapped devices
to know how to go direct.

Essentially we are copying the guts of the
image_render_color_icc_{portrait,landscape,skew} into a default
device method, and making the code that called those functions
call the device method instead.

base/gdevdflt.c
base/gdevepo.c
base/gdevflp.c
base/gdevmplt.c
base/gdevnfwd.c
base/gdevoflt.c
base/gdevsclass.c
base/gdevsclass.h
base/gxclip.c
base/gxclipm.c
base/gxclist.c
base/gxcmap.c
base/gxcmap.h
base/gxdevcli.h
base/gxdevice.h
base/gxi12bit.c
base/gxicolor.c
base/gxidata.c
base/gximage.h
devices/vector/gdevpdfd.c
devices/vector/gdevpdfx.h
doc/Drivers.htm
windows/ghostscript.vcproj


2018-04-23 16:02:10 +0100
Robin Watts <robin.watts@artifex.com>
29113956bb0599209ca81698ab36736e373f054a

Use copy_color for some image plotting cases.

Avoid dropping to fill_rectangle where possible. We should be
careful, because in some cases copy_color ends up doing
fill_rectangle!

base/gxicolor.c


2018-04-26 15:18:20 +0100
Robin Watts <robin.watts@artifex.com>
3d2e9a3b7b633db23b2b0f7bfdff522c48c1d4be

Add gxdso_copy_color_is_fast.

Default implementation returns 1 if copy_color is not the default
(as the default drops to copy_rects).

Also the lcvd device (as used by pdfwrite and ps2write) returns 0
to stop us calling it in this case. The lcvd device lies about
the width/height, and so clipping goes wrong.

base/gdevdflt.c
base/gxdevsop.h
devices/vector/gdevpdfd.c


2018-10-18 12:50:55 +0100
Robin Watts <robin.watts@artifex.com>
a366c6a1f2dc882e9b3a4baf79bf7ba253bd9165

Update htmldiff.pl

Now properly takes formats from the input test list (though
this can be overridden).

toolbin/htmldiff.pl


2018-10-17 19:32:08 +0100
Robin Watts <robin.watts@artifex.com>
23c3e1dd980ec503f5d1f593557d6ebdb5a2173e

VS solution for bmpcmp.

toolbin/bmpcmp.sln
toolbin/bmpcmp.vcproj


2018-10-16 16:52:25 +0100
Ken Sharp <ken.sharp@artifex.com>
1d2a714c9ac3f5cbca0015dbfbfa2fbcb5620fbe

Remove debug code accidentally left in growPDFobjects

Resource/Init/pdf_base.ps


2018-10-16 11:32:28 +0100
Chris Liddell <chris.liddell@artifex.com>
00f48edb588188dc9f10c4a84abdb336725769bd

Don't push the EPO device in front of the nulldevice

There are no bad effects from this, just pointless.

base/gdevepo.c


2018-10-16 15:10:41 +0100
Ken Sharp <ken.sharp@artifex.com>
0bbf2de242801bdf7001db7f85c5fb3b4016e9e1

PDF interpreter - bug in growPDFobjects when repairing PDF file

Bug #699970 "bug in PDF repair"

The function growPDFobjects is used to increase the size of the Objects,
ObjectStream, Generations and IsGlobal records when the number of
objects being recorded exceeds the size of the current record.

The problem was that the code assumes Generations is a string, which it
normally is. However when we are repairing a PDF file, we turn the
string into an array, and if we need to increase the size of the
record we need to make a larger array, not a larger string.

This commit checks the current type of the Generations record and either
creates a large string or larger array, working from the type of the
existing record.

Resource/Init/pdf_base.ps


2018-10-16 11:21:22 +0100
Chris Liddell <chris.liddell@artifex.com>
3c218c1463b9c2ff39b1ea514824815fde4853a7

Bug 699962: Ensure device survives Postscript "callout"

In shutting down the interpreter, we run Postscript code to remove the 'real'
device from the graphics state (replacing it with the nulldevice). That means
we can shutdown and free the device in the C code, without impacting the
remaining interpreter shutdown.

There is, however, a very small chance that, whilst running the Postcript code,
the interpreter will trigger a garbage collection - if that happens *after*
the device reference has been removed from the graphics state, there is no
'link' to the device object for the garbager to follow. Thus the device can
be freed before control returns from executing the Postscript.

Register the device as a garbage collector 'root': thus it is implicitly marked
and won't be freed before control returns.

psi/imain.c


2018-10-15 13:35:15 +0100
Ken Sharp <ken.sharp@artifex.com>
30cd347f37bfb293ffdc407397d1023628400b81

font parsing - prevent SEGV in .cffparse

Bug #699961 "currentcolortransfer procs crash .parsecff"

zparsecff checked the operand for being an array (and not a packed
array) but the returned procedures from the default currentcolortransfer
are arrays, not packed arrays. This led to the code trying to
dereference a NULL pointer.

Add a specific check for the 'refs' pointer being NULL before we try
to use it.

Additionally, make the StartData procedure in the CFF Font Resource
executeonly to prevent pulling the hidden .parsecff operator out and
using it. Finally, extend this to other resource types.

Resource/Init/gs_cff.ps
Resource/Init/gs_cidcm.ps
Resource/Init/gs_ciddc.ps
Resource/Init/gs_cmap.ps
Resource/Init/gs_res.ps
psi/zfont2.c


2018-10-15 11:28:28 +0100
Ken Sharp <ken.sharp@artifex.com>
8d19fdf63f91f50466b08f23e2d93d37a4c5ea0b

Make .forceput unavailable from '.policyprocs' helper dictionary

Bug #69963 "1Policy is a dangerous operator, any callers should be odef"

Leaving the .policyprocs dictionary with a procedure which is a simple
wrapper for .forceput effectively leaves .forceput available.

It seems that the only reason to have .policyprocs is to minimise the
code in .applypolicies, so we can remove the dictionary and put the
code straight into .applypolicies, which we can then bind and make
executeonly, which hides the .forceput. Also, since we don't need
.applypolicies after startup, we can undefine that from systemdict too.

While we're here, review all the uses of .force* to make certain that
there are no other similar cases. This showed a few places where we
hadn't made a function executeonly, so do that too. Its probably not
required, since I'm reasonably sure its impossible to load those
functions as packed arrays (they are all defined as operators), but lets
have a belt and braces approach, the additional time cost is negligible.

Resource/Init/gs_diskn.ps
Resource/Init/gs_dps.ps
Resource/Init/gs_epsf.ps
Resource/Init/gs_fonts.ps
Resource/Init/gs_init.ps
Resource/Init/gs_setpd.ps


2018-10-14 00:06:46 +0100
Robin Watts <robin.watts@artifex.com>
90b8faa80a4746f7f1e0966d6c56a687d2f8d333

Pull in newly merged and updated LCMS2MT from MuPDF thirdparty repo.

The MuPDF repo should be considered canonical, as that is
the one that can pull in updates from upstream lcms2 easily.

base/gsicc_lcms2mt.c
lcms2mt/AUTHORS
lcms2mt/ChangeLog
lcms2mt/Projects/VC2010/jpegicc/jpegicc.vcxproj
lcms2mt/Projects/VC2010/lcms2mt.rc
lcms2mt/Projects/VC2010/lcms2mt.sln
lcms2mt/Projects/VC2010/lcms2mt_DLL/lcms2mt_DLL.vcxproj
lcms2mt/Projects/VC2010/lcms2mt_DLL/lcms2mt_DLL.vcxproj.filters
lcms2mt/Projects/VC2010/lcms2mt_static/lcms2mt_static.vcxproj
lcms2mt/Projects/VC2010/lcms2mt_static/lcms2mt_static.vcxproj.filters
lcms2mt/Projects/VC2010/linkicc/linkicc.vcxproj
lcms2mt/Projects/VC2010/psicc/psicc.vcxproj
lcms2mt/Projects/VC2010/testbed/testbed.vcxproj
lcms2mt/Projects/VC2010/tiffdiff/tiffdiff.vcxproj
lcms2mt/Projects/VC2010/tifficc/tifficc.vcxproj
lcms2mt/Projects/VC2010/transicc/transicc.vcxproj
lcms2mt/Projects/VC2012/jpegicc/jpegicc.vcxproj
lcms2mt/Projects/VC2012/lcms2mt_DLL/lcms2mt_DLL.vcxproj
lcms2mt/Projects/VC2012/lcms2mt_DLL/lcms2mt_DLL.vcxproj.filters
lcms2mt/Projects/VC2012/lcms2mt_static/lcms2mt_static.vcxproj
lcms2mt/Projects/VC2012/lcms2mt_static/lcms2mt_static.vcxproj.filters
lcms2mt/Projects/VC2012/linkicc/linkicc.vcxproj
lcms2mt/Projects/VC2012/psicc/psicc.vcxproj
lcms2mt/Projects/VC2012/testbed/testbed.vcxproj
lcms2mt/Projects/VC2012/tiffdiff/tiffdiff.vcxproj
lcms2mt/Projects/VC2012/tifficc/tifficc.vcxproj
lcms2mt/Projects/VC2012/transicc/transicc.vcxproj
lcms2mt/Projects/VC2013/jpegicc/jpegicc.vcxproj
lcms2mt/Projects/VC2013/lcms2mt.sln
lcms2mt/Projects/VC2013/lcms2mt_DLL/lcms2mt_DLL.vcxproj
lcms2mt/Projects/VC2013/lcms2mt_DLL/lcms2mt_DLL.vcxproj.filters
lcms2mt/Projects/VC2013/lcms2mt_static/lcms2mt_static.vcxproj
lcms2mt/Projects/VC2013/lcms2mt_static/lcms2mt_static.vcxproj.filters
lcms2mt/Projects/VC2013/linkicc/linkicc.vcxproj
lcms2mt/Projects/VC2013/psicc/psicc.vcxproj
lcms2mt/Projects/VC2013/testbed/testbed.vcxproj
lcms2mt/Projects/VC2013/tiffdiff/tiffdiff.vcxproj
lcms2mt/Projects/VC2013/tifficc/tifficc.vcxproj
lcms2mt/Projects/VC2013/transicc/transicc.vcxproj
lcms2mt/Projects/VC2015/jpegicc/jpegicc.vcxproj
lcms2mt/Projects/VC2015/lcms2mt.sln
lcms2mt/Projects/VC2015/linkicc/linkicc.vcxproj
lcms2mt/Projects/VC2015/psicc/psicc.vcxproj
lcms2mt/Projects/VC2015/testbed/testbed.vcxproj
lcms2mt/Projects/VC2015/tiffdiff/tiffdiff.vcxproj
lcms2mt/Projects/VC2015/tifficc/tifficc.vcxproj
lcms2mt/Projects/VC2015/transicc/transicc.vcxproj
lcms2mt/Projects/VC2017/jpegicc/jpegicc.vcxproj
lcms2mt/Projects/VC2017/lcms2mt.sln
lcms2mt/Projects/VC2017/lcms2mt_DLL/lcms2mt_DLL.vcxproj
lcms2mt/Projects/VC2017/lcms2mt_static/lcms2mt_static.vcxproj
lcms2mt/Projects/VC2017/linkicc/linkicc.vcxproj
lcms2mt/Projects/VC2017/psicc/psicc.vcxproj
lcms2mt/Projects/VC2017/testbed/testbed.vcxproj
lcms2mt/Projects/VC2017/tiffdiff/tiffdiff.vcxproj
lcms2mt/Projects/VC2017/tifficc/tifficc.vcxproj
lcms2mt/Projects/VC2017/transicc/transicc.vcxproj
lcms2mt/config.guess
lcms2mt/doc/WhyThisFork.txt
lcms2mt/include/lcms2mt.h
lcms2mt/include/lcms2mt_plugin.h
lcms2mt/ltmain.sh
lcms2mt/src/cmsalpha.c
lcms2mt/src/cmscgats.c
lcms2mt/src/cmscnvrt.c
lcms2mt/src/cmserr.c
lcms2mt/src/cmsgamma.c
lcms2mt/src/cmsgmt.c
lcms2mt/src/cmshalf.c
lcms2mt/src/cmsintrp.c
lcms2mt/src/cmsio0.c
lcms2mt/src/cmsio1.c
lcms2mt/src/cmslut.c
lcms2mt/src/cmsmd5.c
lcms2mt/src/cmsnamed.c
lcms2mt/src/cmsopt.c
lcms2mt/src/cmspack.c
lcms2mt/src/cmsplugin.c
lcms2mt/src/cmsps2.c
lcms2mt/src/cmssamp.c
lcms2mt/src/cmssm.c
lcms2mt/src/cmstypes.c
lcms2mt/src/cmsvirt.c
lcms2mt/src/cmsxform.c
lcms2mt/src/extra_xform.h
lcms2mt/src/lcms2_internal.h
lcms2mt/src/lcms2mt.def
lcms2mt/testbed/Makefile.am
lcms2mt/testbed/Makefile.in
lcms2mt/testbed/testcms2.c
lcms2mt/testbed/testcms2.h
lcms2mt/testbed/testplugin.c
lcms2mt/testbed/zoo_icc.c
lcms2mt/utils/common/utils.h
lcms2mt/utils/common/vprf.c
lcms2mt/utils/delphi/lcms2dll.pas
lcms2mt/utils/jpgicc/jpgicc.c
lcms2mt/utils/linkicc/linkicc.c
lcms2mt/utils/psicc/Makefile.am
lcms2mt/utils/psicc/psicc.c
lcms2mt/utils/samples/itufax.c
lcms2mt/utils/samples/roundtrip.c
lcms2mt/utils/tificc/tifdiff.c
lcms2mt/utils/tificc/tificc.c
lcms2mt/utils/transicc/Makefile.am
lcms2mt/utils/transicc/transicc.c


2018-10-14 18:00:24 +0100
Robin Watts <robin.watts@artifex.com>
fc61ee05129b7cafb22dbce5b93c9a80d30433f7

Enable Trapping by default.

base/gxdownscale.c
doc/Devices.htm


2018-10-12 10:54:09 -0700
Ray Johnston <ray.johnston@artifex.com>
45b1d1079b563fc1722ebfb2037b80567b9932ff

Bug 699935: Change to allow GSView 5 to work with current Ghostscript.

In 2016, a change was made to consult the ProcessColorModel in order to
determine if PDF needed special Overprint Transparency handling, but for
some reason, the GSView display device doesn't have this paramemter in
the pagedevice dictionary. Change to rely on the /Colors parameter being
less than 4 for devices that don't need special Overprint trans handling.

Resource/Init/pdf_main.ps


2018-10-11 15:21:30 +0100
Robin Watts <robin.watts@artifex.com>
45450eb49522afc5ed177d93c142d0c049a864e0

Bug 699800: Fix the previous scan converter fix

There were cases where we still weren't handling the cursor
being on the edge of a pixel correctly, leading to asserts
and spurious horizontal lines on images.

base/gxscanc.c


2018-10-08 18:24:23 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
612d81e94ed0249a8e6fd15e33f409207904ecba

Bug 697545 : Prevent SEGV by propagating error code in tt_find_table.

Propagate error code by checking for return code from access function call.
Prevent SEGV during pcl_text by checking if a font file is loaded before
trying to use a font.

Error created using :-
MEMENTO_FAILAT=19130 ./membin/gpcl6 -sDEVICE=pbmraw -dMaxBitmap=2000 -o /dev/null ./tests_private/pcl/pcl5cfts/fts.0210

pcl/pcl/pcpage.c
pcl/pcl/pctext.c
pcl/pcl/pcursor.c
pcl/pcl/pcursor.h
pcl/pl/plchar.c


2018-10-10 23:25:51 +0100
Chris Liddell <chris.liddell@artifex.com>
a5a9bf8c6a63aa4ac6874234fe8cd63e72077291

Bug 699938: .loadfontloop must be an operator

In the fix for Bug 699816, I omitted to make .loadfontloop into an operator, to
better hide .forceundef and .putgstringcopy.

Resource/Init/gs_fonts.ps


2018-10-11 12:22:54 +0100
Ken Sharp <ken.sharp@artifex.com>
262f94222e6965e639e92b920951ff75c2d8f081

Fix mswinpr2 device with subclassing

Bug # 699934 "mswinpr2 creates empty print jobs (with some printer drivers)"

The mswinpr2 device has a bizarre check in it, to see if the device is a
copy produced by copydevice. Its not clear to me why it does this, and
the code is very old. It looks to me like this should fail if the device
*is* a copy produced by copydevice, for the same reason it does with
subclassing, the Windows-specific parts are set to NULL.

I can't seem to provoke the device to go through this path in normal
operation, so I'm not going to try and remove it. Instead I've added
to the test a check to see if the device has been subclassed. If it has
we no longer reset the Windows-specific parts of the device, but carry
on using what we have.

While we are here, remove the annoying wdev macro which simply makes
it hard to debug. Especially when the macro has different definitions
in different parts of the source file!

devices/gdevwpr2.c


2018-10-10 16:24:38 +0100
Chris Liddell <chris.liddell@artifex.com>
bf9f3f1536487b4d67643ac3d8bddd149a2b3fa0

Close a device before any other 'finalize' actions

Previously, when a device object was being finalized, we were calling the
device's own finalize method, and (possibly) freeing the reference counted
icc data before calling gs_closedevice() to ensure the device is genuinely
closed.

Reorder the operations so closing the device is the *first* thing we do.

base/gdevsclass.c
base/gsdevice.c


2018-10-10 15:48:33 +0100
Chris Liddell <chris.liddell@artifex.com>
b7e8af4ce9f3352631c0e1efaee9b92f9bc43bb3

Fix a memory leak with subclassed devices (stype)

A dynamic stype in a subclass device wasn't being free with the device - likely
an oversight from adding the subclass device specific finalize method (rather
than using the generic device finalize).

If a subclassed device has a 'dynamic' stype,

base/gdevsclass.c


2018-10-10 15:38:10 +0100
Chris Liddell <chris.liddell@artifex.com>
34cc326eb2c5695833361887fe0b32e8d987741c

Bug 699927: don't include operator arrays in execstack output

When we transfer the contents of the execution stack into the array, take the
extra step of replacing any operator arrays on the stack with the operator
that reference them.

This prevents the contents of Postscript defined, internal only operators (those
created with .makeoperator) being exposed via execstack (and thus, via error
handling).

This necessitates a change in the resource remapping 'resource', which contains
a procedure which relies on the contents of the operators arrays being present.
As we already had internal-only variants of countexecstack and execstack
(.countexecstack and .execstack) - using those, and leaving thier operation
including the operator arrays means the procedure continues to work correctly.

Both .countexecstack and .execstack are undefined after initialization.

Also, when we store the execstack (or part thereof) for an execstackoverflow
error, make the same oparray/operator substitution as above for execstack.

Resource/Init/gs_init.ps
Resource/Init/gs_resmp.ps
psi/int.mak
psi/interp.c
psi/interp.h
psi/zcontrol.c


2018-10-10 17:12:01 +0100
Ken Sharp <ken.sharp@artifex.com>
04a517f39cc3e25a7aec9766b45aeb2144718ee6

PDF interpreter - don't use CIDFonts from the PDF file for missing ones

Bug #699937 "Poorly constructed PDF file can inappropriately reuse a CIDFont"

If we find a CIDFont is not defined (the FontDescriptor has no FontFile
entry) then we need to find a substitute. Normally this means going
to disk and either loading an explicit (user supplied) substitute, or
using a fallback CIDFont.

However, if the PDF file had defined a CIDFont with the same name
previously, we could use that instead. If the CIDFont was a complete
font this should be absolutely fine. However in this the CIDFont is a
*subset* font, but not identified as such. Using that font leads to
missing text....

This commit continues to use resourcestatus to locate a substitute
CIDFont, but it checks the 'status' flag. If its 0 then that means we
created it via an explicit defineresource, which means (I believe and
testing seems to confirm) that we created it from the PDF file. If its
1 or 2, then it was loaded from disk as a substitute (or is available
but not in VM, ie its on disk).

So if status is 0, don't use this CIDFont, it might not be reliable,
instead force an excursion to disk and load a substitute from there.

Tested with an explicit substitution defined in cidfmap to make sure
that this does not break at the same time. NB! If a PDF file does
define a CIDFont of the same name, then we won't (I believe) be able
to load the explicit CIDFont resource, we will always fall back to the
default.

Resource/Init/pdf_font.ps


2018-10-09 19:42:34 +0100
Robin Watts <robin.watts@artifex.com>
7f26bbdc84818f5ecf32c726ff8c15dbb6a94485

Add avx2 option to clusterpush.pl

toolbin/localcluster/clusterpush.pl


2018-10-09 15:34:59 +0100
Chris Liddell <chris.liddell@artifex.com>
f1a078763387dde6972b30ee55a4b985d4d130bb

Explicitly exclude /unknownerror from the SAFERERRORLIST

Since we remove /unknownerror from errordict, we want to exclude it from the
list we copy to gserrordict for SAFERERRORS

Resource/Init/gs_init.ps


2018-10-08 18:52:39 +0100
Chris Liddell <chris.liddell@artifex.com>
7df67ad89e59e1c93684eb48cef2b907076e19bc

Ensure 'token' errors are reported correctly.

Previously, any error that occurred during the actual token scanning part of
'token' would actually report an error against the internal operator:
'%token_continue'.

This commit ensures that such errors are reported against 'token'.

psi/ztoken.c


2018-10-02 16:02:58 +0100
Chris Liddell <chris.liddell@artifex.com>
a6807394bd94b708be24758287b606154daaaed9

For hidden operators, pass a name object to error handler.

In normal operation, Postscript error handlers are passed the object which
triggered the error: this is invariably an operator object.

The issue arises when an error is triggered by an operator which is for internal
use only, and that operator is then passed to the error handler, meaning it
becomes visible to the error handler code.

By converting to a name object, the error message is still valid, but we no
longer expose internal use only operators.

The change in gs_dps1.ps is related to the above: previously an error in
scheck would throw an error against .gcheck, but as .gcheck is now a hidden
operator, it resulted in a name object being passed to the error handler. As
scheck is a 'real' operator, it's better to use the real operator, rather than
the name of an internal, hidden one.

Resource/Init/gs_dps1.ps
psi/interp.c


2018-10-04 10:42:13 +0100
Chris Liddell <chris.liddell@artifex.com>
1778db6bc10a8d60dfe986b22d2300326733ddd6

Bug 699832: add control over hiding error handlers.

With a previous commit changing error handling in SAFER so the handler gets
passed a name object (rather than executable object), it is less critical to
hide the error handlers.

This introduces a -dSAFERERRORS option to force only use of the default error
handlers.

It also adds a .setsafererrors Postscript call, meaning a caller, without
-dSAFERERRORS, can create their own default error handlers (in errordict, as
normal), and then call .setsafererrors meaning their own handlers are always
called.

With -dSAFERERRORS or after a call to .setsafererrors, .setsafererrors is
removed.

Resource/Init/gs_init.ps
psi/interp.c


2018-09-29 15:34:55 +0100
Chris Liddell <chris.liddell@artifex.com>
a54c9e61e7d02bbc620bcba9b1c208462a876afb

Bug 699816: Improve hiding of security critical custom operators

Make procedures that use .forceput/.forcedef/.forceundef into operators.

The result of this is that errors get reported against the "top" operator,
rather than the "called" operator within the procedure.

For example:
/myproc
{
myop
} bind def

If 'myop' throws an error, the error handler will be passed the 'myop'
operator. Promoting 'myproc' to a operator means the error handler will be
passed 'myproc'.

Resource/Init/gs_diskn.ps
Resource/Init/gs_dps.ps
Resource/Init/gs_fntem.ps
Resource/Init/gs_fonts.ps
Resource/Init/gs_lev2.ps
Resource/Init/gs_pdfwr.ps
Resource/Init/gs_setpd.ps
Resource/Init/gs_typ32.ps
Resource/Init/gs_type1.ps
Resource/Init/pdf_base.ps
Resource/Init/pdf_draw.ps
Resource/Init/pdf_font.ps
Resource/Init/pdf_main.ps
Resource/Init/pdf_ops.ps


2018-09-26 20:42:32 +0100
Robin Watts <robin.watts@artifex.com>
702f6982b63fca353d9106d2dbb6bb21f826c2e6

Bug 699800: Fix scan converter problem seen with barcodes.

The new scan converter is incorrectly counting a pixel as being
touched if a line moves horizontally across the bottom edge of
that pixel.

This means that paths (for example) carefully constructed to cover
exactly a single pixel, such as:

0 0 moveto 1 0 lineto 1 1 lineto 0 1 lineto closepath fill

(when rendered at 72dpi) will fill 2 pixels, rather than 1.

The fix is rather more involved that you'd like, as we need to
treat the cursor being on this vertical edge as a special case.
We flush and "null" the cursor when we arrive on such an edge,
and ignore horizontal motion across such edges.

The identical fixes are required both for trap and rect filling.

base/gxscanc.c


2018-10-08 09:24:22 +0100
Chris Liddell <chris.liddell@artifex.com>
a73071b87a61acf1237da5ad9da59bae9316fb8c

Bug 699907: Reinstate GTK+ 2.x.x code.

The fix (from March 2018) for deprecated API calls in the GTK+ 3.x.x API
didn't account for the new, supported methods not being available in
GTK+ 2.x.x. Handle both cases, as we do elsewhere.

psi/dxmain.c


2018-10-03 17:47:06 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
0269a72336f210c1736efbf0916a41be4d808d5d

Bug 697545 : Prevent SEGV after calling gs_image_class_1_simple.

Prevent SEGV if memory allocation fails leading to penum being freed but then
used again later.

Error created using :-
MEMENTO_FAILAT=20913 ./membin/gpcl6 -sDEVICE=pbmraw -dMaxBitmap=2000 -o /dev/null ./tests_private/pcl/pcl5cfts/fts.0100

base/gxifast.c


2018-09-25 22:25:26 +0100
Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
52a37b63bb49e221c3f1b5d1ee11b63ce69da1f0

Bug 697545 : Prevent SEGV in gs_setdevice_no_erase.

Prevent SEGV if gsicc_init_iccmanager fails.

Error created using :-
MEMENTO_FAILAT=350 ./membin/gpcl6 -sDEVICE=pbmraw -dMaxBitmap=2000 -o /dev/null ./tests_private/pcl/pcl5cfts/fts.0070

base/gsdevice.c


2018-10-03 17:00:28 +0100
Ken Sharp <ken.sharp@artifex.com>
0a7e5a1c309fa0911b892fa40996a7d55d90bace

PDF interpreter - limit page tree recusrsion checking

Bug #699856 "Attempting to open a carefully crafted PDF file results in long-running computation"

A sufficiently bad page tree can lead to us taking significant amounts
of time when checking the tree for recursion.

We can limit this by noting the number of pages in the root node
(given by /Count) and stopping the recursion check when we have
encountered that many leaf nodes.

Our other recursion checks work by reading the resources from the page
nodes and so are unaffected by this.

Resource/Init/pdf_main.ps


2018-10-03 14:48:48 +0100
Chris Liddell <chris.liddell@artifex.com>
d06af15c447f821309cabb0dba5ff97ce1ea4c99

Bug 699857: don't push userdict in preparation for Type 1 fonts

Apparently, Fontographer fonts require a writable dictionary on the
dict stack. For some reason lost in mists of time, we pushed userdict for that
purpose - the problem is, that leaves any random redefinition of operators in
place when we interpret the font file.

Instead, we now push an empty, temporary dictionary for those Fontographer
fonts. As we already explicitly push systemdict (before the writable dictionary)
that ensures a consistent environment for the interpretation of Type 1 fonts.

Resource/Init/gs_type1.ps


2018-09-30 22:57:33 +0100
Ken Sharp <ken.sharp@artifex.com>
cbdc54055b7db024951daf3dcb3cafe0af458e47

Change device put_image method to match the other methods in the API

The put_image device method was unique in that the device parameter
passed to the method was not a pointer to a device structure of the
device implementing the method, but was a pointer to a device
structure describing a memory device.

This allowed the memory device to use code from the underlying device,
which knows how its page buffer is laid out, but data from the memory
device which rendered the composited transparent operations.

However, this doesn't work at all if we have a chain of devices because
the device method which we pull from the device at the head of the
chain, is not the method used to actually rendeer to the page buffer
of the terminating deevice in the chain.

This commit alters the prorotype to take two device pointers, one for
the 'terget' device, and one for the memory device which executed the
put_image. This allows the final device in the chain to use its own
code to format the buffer pointers from the memory device, while
allowing intermediate devices to simply pass on the call.

Note that previously a few places checked the put_image method against
gx_default_put_image (before the device API rationalisation this was a
check against NULL) and only called put_image if it was not the default.

Now that we have a default implementation (which returns an error), and
knowing that the existing device methods return an error if they do not
implment some aspect of the memory layout, we can avoid the test
altogether; simply call the put_image, the code is already prepared
to deal with an error return whether that be because the device does not
implement the method or becuase the device cannot cope with some aspect
of the layout.

base/gdevdflt.c
base/gdevepo.c
base/gdevflp.c
base/gdevmem.c
base/gdevmpla.c
base/gdevnfwd.c
base/gdevoflt.c
base/gdevp14.c
base/gdevsclass.c
base/gxblend1.c
base/gxdevcli.h
base/gxdevice.h
devices/gdevbit.c
devices/gdevpng.c


2018-09-27 10:31:03 +0100
Ken Sharp <ken.sharp@artifex.com>
9565f4ca4aab712f411420fa4c8cae79a2cf88ed

Bug 699813 "filenameforall calls bad iodev with insufficent scratch"

This was a regression introduced with commit
65a9046ded8e9edd5d33bc812a9e94ae29607a1e

I hadn't realised the cleanup procedure was expected to be called in the
case of both the success *and* error conditions.

psi/zfile.c


2018-09-25 15:38:14 +0100
Chris Liddell <chris.liddell@artifex.com>
f8ccc7dfb990336b1ca55f65f2e1a8ecdcb76adf

Bug 699793: Hide the .needinput operator

This removes the .needinput operator from systemdict, ensuring it can only
be used in the initialization code, and not called erroneously from random
Postscript.

Resource/Init/gs_init.ps


2018-09-25 21:50:49 +0100
Robin Watts <robin.watts@artifex.com>
043e3d9058f414607ed8454783175db57e7e6524

Always set the tag, even if the device won't encode it.

Intended to sort an issue encountered while debugging bug 699809,
namely that tag dependent ICC handling only works for devices that
actually encode tags.

base/gxgstate.h


2018-09-25 13:57:54 -0400
Robin Watts <Robin.Watts@artifex.com>
efe6d83852b131852550de948e7d0869c01c31f8

Bug 699809: Fix uninitialised value for render_cond.

gsicc_get_srcprofile doesn't return a render_cond value in
all cases. This leads to an undefined value being read, and
this can lead to a SEGV.

base/gsicc_cache.c


2018-09-25 07:23:07 -0400
Robin Watts <Robin.Watts@artifex.com>
0bfd5394bc1ed6ef9e887071dc14391923e69ebf

Bug 699809: Avoid overrunning non terminated string buffer.

Don't call strlen on something that doesn't have a terminator.
Use the stored length instead.

base/gsicc_manage.c


2018-09-25 11:57:12 +0100
Chris Liddell <chris.liddell@artifex.com>
677da1c0ac20020760b372a0c8aa5546d0a30429

Bug 699810: Explicitly set stroke color for PDF Type 3 glyphs

When we render a cache-viable Type 3 glyphs (i.e. one that uses 'd1' rather
than 'd0'), ensure we set the stroke color to match the fill color.

This is necessary because if we do cache the glyph, we'll render to a mask, and
fill the mask. On the other hand, if we have to render the glyph uncached,
we have to ensure that the entire glyph is drawn with the same (fill) color, as
it would be when drawn cached.

Resource/Init/pdf_font.ps


2018-09-21 12:03:20 -0700
Ray Johnston <ray.johnston@artifex.com>
db606d2ffd204e89c812408773a15ef183ebd4b6

Fix Bug 699794 -- device subclass open_device call must return child code

Even with changes to detect and clean up from errors in setpagedevice (b5)
and .bigstring, the segfault was still possible because the error return
code from the child was being ignored, and the device is_open was set true
when the child device was NOT open. Attempt to 'fillpage' on a clist device
that is not open is what caused the SEGV.

base/gdevsclass.c


2018-09-21 12:00:50 -0700
Ray Johnston <ray.johnston@artifex.com>
c29ec2fff76e45bbf9cd767ff541556c5d064be4

Add parameter checking in setresolution

Found in sequence for bug 699794

Resource/Init/gs_lev2.ps


2018-09-21 11:42:19 -0700
Ray Johnston <ray.johnston@artifex.com>
379be67a6a198766e976f1e5daf43e0c0e97522a

Add parameter type checking on .bigstring

If the parameter is not an integer, this would leave 65400 on the stack.
Also, if there is no argument, signal stackunderflow.
Seen with the PS sequence of bug 699794.

Resource/Init/gs_ll3.ps


2018-09-21 11:37:38 -0700
Ray Johnston <ray.johnston@artifex.com>
9d6ac20d9b2efdabb631a0ff9b0b0fd5c32f5e75

Catch errors and cleanup stack on statusdict page size definitions

This was also found with the sequence from Bug 699794, if .setpagesize
fails, we need to clean up the two integers (page width, height) then
signal the error. Since some definitions "load" another (e.g. b5 loads
isob5) the command name in the error won't be correct for those, but
it will be close. If anybody cares, we could fix it.

Resource/Init/gs_statd.ps


2018-09-21 11:16:18 -0700
Ray Johnston <ray.johnston@artifex.com>
95aa78beae9489d5c9f898fe2032aa23f860867d

Catch errors in setpagesize, .setpagesize and setpagedevice and cleanup

Bug 699794 showed that attempt to change page size in SAFER mode when the
nulldevice was the currentdevice would leave 'false' on the stack. Run
.setdevice in stopped and clean up, and also clean up .setpagesize

Resource/Init/gs_lev2.ps
Resource/Init/gs_setpd.ps
Resource/Init/gs_statd.ps


2018-09-23 16:08:23 +0100
Ken Sharp <ken.sharp@artifex.com>
863b370ba7d791720b97ae10deb211fde8bdbd0a

pdfwrite - permit Mod and CreDate pdfmarks in PDF 2.0

Bug 699807 "-dCompatibilityLevel=2.0` prevents all metadata from being set"

PDF 2.0 has deprecated The Document Info dictionary, so we prevented
pdfmarks from modifying the data in it, as a prelude to removing it
potentially when later versions of the PDF spec are approved.

However, as the report says, the Creation Date and Modification Date
are still required for documents with PieceInfo (only), so for now we
will permit those two values (only) to be set.

devices/vector/gdevpdfm.c


2018-09-22 14:09:17 +0100
Ken Sharp <ken.sharp@artifex.com>
0fdbf706be847198be202eefd3e20fc95d60cbcb

device subclassing - fix use of put_image in memory devices

Bug 699799 "gswin64c.exe has stopped working"

The cause of this is truly ugly. It seems that the put_image device
method, uniquely, expects that the device parameter it is passed is not
the device for which it was intended, but is instead a 'memory'
device.

All the implementations of put_image start by casting the gx_device *
to a gx_device_memory *

This is problematic, because it completely disrupts any attempt at a
device chain. There's no way to have a device's method check to see if
it has a child device, if its not given its owe device to work with.

This commit hacks around the problem by descending to the terminating
device, and copying the put_image call from there into the memory device
which is what the pdf14 compositor will then use.

This needs fixing properly.

base/gdevmem.c


2017-11-30 18:39:07 -0500
Robin Watts <Robin.Watts@artifex.com>
08fb5ddb928cfc7c4cd5f348f28862d97e53d07a

Squash warnings in gen_ordered.c

Use ints instead of doubles, because the values only hold ints!

base/gen_ordered.c


2018-09-21 15:28:15 +0100
Ken Sharp <ken.sharp@artifex.com>
f31702b38fba21153e26c3417c838618e7cfd16f

pdfwrite - fix DSC comment parsing

This may affect other DSC parsing utilities. For some reason double
comment (%%) marks are being interpreted 'sometimes' in gs_init.ps
as DSC comments. This only happens when reading the init files from disk
becuase the ROM file system strips comments.

Passing these to pdfwrite causes it to drop later DSC comments, such
as %%Title: and %%Creator: which meant the information wasn't being
embedded in the document information dictionary.

Fix by converting double %% to single % comments, document this in the
header of gs_init.ps.

Resource/Init/gs_init.ps


2018-09-21 13:02:56 +0100
Ken Sharp <ken.sharp@artifex.com>
fac7eb144135f3ed8fbb0028ab1f33ce4dcc1985

Check all uses of dict_find* to ensure 0 return properly handled

dict_find and friends have the surprising quirk of returning < 0 for
an error and > 0 for no error. But they can also return 0 which means
'not found' without it being an error.

From bug 699801, if the code assumes the usual case where 0 is a success
then an attempt might be made to use the empty dictionary slot returned
by dict_find*, which can lead to seg faults, and certainly won't have
the expected result.

psi/icontext.c
psi/zcid.c
psi/zfapi.c
psi/zfcid0.c
psi/zfcid1.c
psi/zicc.c
psi/zpdf_r6.c
psi/ztoken.c


2018-09-21 09:49:58 +0100
Ken Sharp <ken.sharp@artifex.com>
7ee525fd0010a4f0bb507417860e9faa058c6315

Bug #699801 "zparse_dsc_comments can crash with invalid dsc_state"

Although zparse_dsc_comments() does check the types of its operands, it
wasn't checking the return value from dict_find_string properly. It was
effectively assuming that the dictionary parameter was the *correct*
dictionary and would contain the key/value pair it needed.

Here we check to see if the key has not been found and throw an error
if so.

psi/zdscpars.c


2018-09-21 08:45:35 +0100
Chris Liddell <chris.liddell@artifex.com>
2118711d122aeb170031ab7eb80e5a9269055772

Bug 699802: add object type check for AES key

Make sure the key string is a string.

psi/zfaes.c


2018-09-20 17:08:08 +0100
Ken Sharp <ken.sharp@artifex.com>
8ed08cb9904bc718ad57e0b4884a81a9227ce3ea

Bug 699797 "setundercolorremoval memory corruption"

What is happening is that we are not properly reference counting a
structure.

For setblackgeneration and setundercolorremoval we need to use a
continuation procedure, which samples the supplied PostScript function
and then stores the sample map.

As part of this we create an internal structure to hold the map, and we
make this the current undercolorremoval/blackgeneration entry in the
graphics state. We *also* push a reference to it onto the exec stack,
so that the continuation procedure can use it from there. However we
don't increment the reference count.

When we execute the 'grestore' in the function we reset the values in
the graphics state, and because the reference count is one we count it
down and then discard the structure.

When we then throw an error we try to copy data off the exec stack into
an array, when we hit the reference to the freed strcuture we potentially
are pointing to invalid memory, leading to a seg fault.

To fix this, increment the reference count of the object when we put
it on the exec stack, and decrement it when we remove it from the exec
stack.

psi/zcolor.c


2018-09-19 18:21:02 -0700
Nancy Durgin <nancy.durgin@artifex.com>
18e8a06bd34bb51c08760b7ebdbab68ab45712c1

Bug 699793: Fix handling of .needinput if used from interpreter

.needinput is meant as an internal function, but it is exposed
to the user. I couldn't see an easy way to undefine it.

But if user calls it, it returns gs_error_Fatal in a place that the
code wasn't expecting, and basically puts things in an undefined
state. This change returns a Fatal error at this point, instead.

psi/imain.c


2018-09-19 09:14:02 -0700
Nancy Durgin <nancy.durgin@artifex.com>
caa8b4c279a078419ee9c002106a84703c090d5d

Cleanups for FAPI functions

Fix .FAPIAvailable to check for stack underflow

Undefine FAPI functions at end of gs_fapi.ps
(.FAPIavailable, .FAPIpassfont, .FAPIrebuildfont)

The rendering functions, .FAPIBuildGlyph, .FAPIBuildChar, .FAPIBuildGlyph9,
are still defined. I noticed similar rendering funcs for other fonts are also
exposed -- not sure if this is fixable or not.

Resource/Init/gs_fapi.ps
Resource/Init/gs_init.ps
psi/zfapi.c


2018-09-20 16:35:28 +0100
Chris Liddell <chris.liddell@artifex.com>
b0222e5e39712999f22084996a6b85a120b9389e

Bug 699795: add operand checking to .setnativefontmapbuilt

.setnativefontmapbuilt .forceputs a value into systemdict - it is intended
to be a boolean, but in this case was being called with a compound object
(a dictionary). Such an object, in local VM, being forced into systemdict
would then confuse the garbager, since it could be restored away with the
reference remaining.

This adds operand checking, so .setnativefontmapbuilt will simply ignore
anything other than a boolean value, and also removes the definition of
.setnativefontmapbuilt after use, since it is only used in two, closely
related places.

Resource/Init/gs_fonts.ps


2018-09-20 14:23:29 +0100
Chris Liddell <chris.liddell@artifex.com>
78ed0a8f0339dba1674285b0aa1f460a59b0c3ee

Ensure all errors are included from initialization

Previously only Level 1 errors were added during init.

Resource/Init/gs_init.ps


2018-09-20 10:09:37 +0100
Ken Sharp <ken.sharp@artifex.com>
90e8f8d32b64bae015e19e85e693988daaea54f4

Bug #699796 "copydevice fails after stack device copies invalidated"

This isn't anything to do with .fill_identity_cmap. A simpler example
is:

.distillerdevice
nulldevice
copydevice

The problem is that when we execute nulldevice we need to invalidate any
copies, stored on the operand stack, of the device that was current
before the nulldevice was installed.

We do that by setting the pdevice member of the device structure to NULL.
However the fact that a device can be invalidated has clearly passed
by a number of developers in the intervening years, and a number of
places in the code do check the type of the operand is a device, but
they don't check to see if the device has been invalidated.

Add validation checks where required.

psi/idisp.c
psi/zdevice.c


2018-09-18 14:15:55 -0700
Nancy Durgin <nancy.durgin@artifex.com>
c1657e3b874261e254d4e132499355b22f3dd46a

Change "executeonly" to throw typecheck on gstatetype and devicetype objects

PS doesn't really have a "devicetype", but it is not listed as an
acceptable argument type to "executeonly", so we probably should not
accept it.

"gstate executeonly" throws typecheck in Acrobat, so we should do the same.

Tested the other "access related" functions (noaccess, readonly,
rcheck, wcheck, xcheck) and all of these accept "gstate" as an
argument, even though the PLRM says they should not. Also our initialization
code does things with wcheck and readonly on devices and gstates.

So, this fix is only for "executeonly".

psi/ztype.c


2018-09-19 13:17:45 +0100
Chris Liddell <chris.liddell@artifex.com>
476f6d039fadc33be09068ec09e55824ce089759

Fix commit 93d13545f90c37327bf3ca7ac75c9549d7b52f6f

The original fix was passing the px_state_t into px_process_init(), where what
it takes is actually a px_parser_state_t.

Fixes segfault spotted on the 32bit weekly cluster test.

pcl/pxl/pxsessio.c
pcl/pxl/pxtop.c


2018-09-18 21:10:33 -0600
Henry Stiles <henry.stiles@artifex.com>
93d13545f90c37327bf3ca7ac75c9549d7b52f6f

Reset the PXL parser along with state cleanup.

pcl/pxl/pxsessio.c


2018-09-18 11:54:58 -0700
Nancy Durgin <nancy.durgin@artifex.com>
c76bf1cb7cc419534006631ea139ae20801fd824

Undefine some additional internal operators.

.type, .writecvs, .setSMask, .currentSMask

These don't seem to be referenced anywhere outside of the initialization code,
which binds their usages. Passes cluster if they are removed.

Resource/Init/gs_init.ps


2018-09-13 13:06:01 -0700
Nancy Durgin <nancy.durgin@artifex.com>
29d8ed33d90bea26b24995c43ad53119a943f2d6

Fixed a bunch of incorrect parameter counts

(Note that these were basically harmless, but they make a nice hint to the
programmers, so it's nice if the hint is correct...)

psi/zcolor.c
psi/zdevice.c
psi/zfile1.c
psi/zform.c
psi/zmisc.c
psi/zvmem2.c


2018-09-17 14:06:12 +0100
Chris Liddell <chris.liddell@artifex.com>
7c3e7eee829cc3d2582e4aa7ae1fd495ca72cef1

Implement .currentoutputdevice operator

The currentdevice operator returns the device currently installed in the
graphics state. This can be the output/page device, but also could be a
forwarding device (bbox device), compositor (pdf14) or subclass device
(erasepage optimisation, First/Last page etc).

In certain circumstances (for example during a setpagedevice) we want to be
sure we're retrieving the *actual* output/page device.

The new .currentoutputdevice operator uses the spec_op device method to traverse
any chain of devices and retrieve the final device in the chain, which
should always be the output/page device.

Resource/Init/gs_init.ps
Resource/Init/gs_setpd.ps
base/gdevdflt.c
base/gxdevsop.h
psi/zdevice.c


2018-09-17 10:18:16 +0100
Chris Liddell <chris.liddell@artifex.com>
8bc783cb586231da2916f423bf5793e194092679

Bug 699778: Fix doc/* file list in base/unixinst.mak

base/unixinst.mak


2018-09-18 08:12:00 +0100
Ken Sharp <ken.sharp@artifex.com>
442b5608a6384358e26014c8dec81c169145461e

Documentation - fix a couple of typos

doc/VectorDevices.htm


2018-09-17 12:14:36 +0100
Ken Sharp <ken.sharp@artifex.com>
1535333e85a2901cc873c2694c5ee8508cffd992

Bug 699777 " -dFILTERIMAGE often loses text"

The pdfwrite device's implementation of transparency relies upon the
image for a Softmask being run, and pushing a clip, which increments the
viewer state. However if we have -dFILTERIMAGE in place, then we won't
do this (its in the pdfwrite implementation of begin_typed_image).

When we close the transparency mask, this then leads to the viewer state
stack being out by one.

There's no easy way to address this, so when we go to restore the viewer
state, if it would fall off the bottom then check to see if FILTERIMAGE
is true. If it is, then just don't return an error.

This is a rare condition, it relies upon the transparency being nested
quite deeply in groups (in this case the SoftMask is nested about four
layers deep in spurious transparency).

devices/vector/gdevpdfg.c


2018-09-11 18:47:10 +0100
Robin Watts <robin.watts@artifex.com>
fb887f9e8a318628b2b82120e1e825343264e42c

Remove unnecessary struct entry from pcl_interp_instance_s.

We no longer extend the instance from the implementation.

pcl/pcl/pctop.c
pcl/pxl/pxtop.c


2018-09-13 15:18:03 +0100
Robin Watts <robin.watts@artifex.com>
da0910fe776cf6f28391558d01bea8953235f1f7

VS Project: Add some missing files.

windows/ghostpcl.vcproj


2018-09-06 19:33:06 +0100
Robin Watts <robin.watts@artifex.com>
68b679df65f8d9ffbbb4acdc2662105e440778df

Fix "ambiguous else" warning.

pcl/pl/plmain.c


2018-09-12 15:34:50 -0600
Henry Stiles <henry.stiles@artifex.com>
96ab2635885c40a81d6146d1f3363a019d8af93a

Fix bug #699564 - pageside different from HP.

The pageside should be updated only if the page is marked. Also
refactor and simplify the Page Side Select routine.

Thanks to Norbert Janssen for identifying and analyzing this problem.

pcl/pcl/pcjob.c


2018-09-13 16:09:56 +0100
Chris Liddell <chris.liddell@artifex.com>
687e9a482e40d5e2fc6ac7aa66fb4791afccb949

Tweak examples/transparency_example.ps

So it prints a warning and runs to completion, rather than erroring out
when -dSAFER is set.

examples/transparency_example.ps


2018-09-10 09:25:22 +0100
Chris Liddell <chris.liddell@artifex.com>
c7b6473b425445c6d6c0637f42fdbf5536244198

Bring master up to date with 9.25 release branch

base/version.mak
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gs-vms.hlp
doc/sample_downscale_device.htm
doc/subclass.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


2018-09-11 10:59:24 +0100
Chris Liddell <chris.liddell@artifex.com>
ba8eda9d8c62e34ce3fed2d22647797e29494eb7

Bug 699757: disable epo device for x11 devices

The epo device interferes with the operation of the x11 devices when those
are integrating with an existing X application (i.e. xv, or other application
that relies on the 'GHOSTVIEW' functionality).

Disable epo by adding an x11 specific fillpage method.

devices/gdevx.c


2018-09-11 11:12:13 +0100
Ken Sharp <ken.sharp@artifex.com>
b7c4003f6855b2e11cdda32cdf259c7005dce38b

PDF interpreter - work around GSView 5 and PAGELABEL pdfmarks

We added the ability to process PDF page labels as pdfmarks, instead of
using the .pagelabels operator (as used by pdfwrite) for the benefit of
DejaVu.

Unfortunately, GSView 5 redefines the pdfmark operator, and attempts
to process the information itself. This is a problem when it doesn't
recognise the pdfmark in question, which it does not with PAGELABEL.

There's no way for us to fix GSView 5, and we don't want to revert the
enhancement for DejaVu because that is still being actively maintained.

This commit is a rather ugly hack which relies upon the presence of a
specific named dictionary in userdict when GSView is executing. If that
dictionary is present then we don't create PAGELABEL pdfmarks, thus
avoiding confusing GSView 5.

Resource/Init/pdf_main.ps


2018-09-10 09:21:26 +0100
Chris Liddell <chris.liddell@artifex.com>
7fee37d18e9cbcbc99c3e0e5048a7de78f9be58e

Move pre-release version to 9.26

Resource/Init/gs_init.ps
base/version.mak


2018-09-10 17:05:47 +0100
Chris Liddell <chris.liddell@artifex.com>
57c41b4d49ff949503f7d29a0f3dea0504b9e45e

Bug 699753: Windows uninstall: remove all installed files etc

This was partly caused by a subtlety of the nsis installer syntax which means
the '/r' option for the 'File' operation will match and install all
files/directories in the file heirarchy that match the search term, unless they
are explicitly excluded.

For example:
File /r doc

will end up matching:
doc/
something/doc
another/thing/doc

So, ensure we exclude subtrees so we no longer accidentally include files we
don't intend.

Also, add the missing removals, so we do remove eveything we intended to
install.

Lastly add in (and include removal of!) the Resource/* tree, and the iccprofiles
directories - both of which users have asked to be included.

psi/nsisinst.nsi


2018-09-10 07:42:13 -0700
Ray Johnston <ray.johnston@artifex.com>
eb1d28f6937f3692facc2f09ce540f5aa313380b

Correct getdeviceprops documentation

doc/Language.htm


2018-09-13 10:54:33 +0100
Chris Liddell <chris.liddell@artifex.com>
070358777b534c600c522da8541690022102b7a6

Dates, product string, changelog, etc for 9.25 release

base/gscdef.c
base/version.mak
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gs-vms.hlp
doc/sample_downscale_device.htm
doc/subclass.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


2018-09-11 10:59:24 +0100
Chris Liddell <chris.liddell@artifex.com>
4b3fbf2bca24b2833322985be390fc739d237f7d

Bug 699757: disable epo device for x11 devices

The epo device interferes with the operation of the x11 devices when those
are integrating with an existing X application (i.e. xv, or other application
that relies on the 'GHOSTVIEW' functionality).

Disable epo by adding an x11 specific fillpage method.

devices/gdevx.c


2018-09-11 11:12:13 +0100
Ken Sharp <ken.sharp@artifex.com>
5ac63e47077e0e7d02e99e247e0c47c4737e0cb8

PDF interpreter - work around GSView 5 and PAGELABEL pdfmarks

We added the ability to process PDF page labels as pdfmarks, instead of
using the .pagelabels operator (as used by pdfwrite) for the benefit of
DejaVu.

Unfortunately, GSView 5 redefines the pdfmark operator, and attempts
to process the information itself. This is a problem when it doesn't
recognise the pdfmark in question, which it does not with PAGELABEL.

There's no way for us to fix GSView 5, and we don't want to revert the
enhancement for DejaVu because that is still being actively maintained.

This commit is a rather ugly hack which relies upon the presence of a
specific named dictionary in userdict when GSView is executing. If that
dictionary is present then we don't create PAGELABEL pdfmarks, thus
avoiding confusing GSView 5.

Resource/Init/pdf_main.ps


2018-09-10 17:05:47 +0100
Chris Liddell <chris.liddell@artifex.com>
b3974730243cb449299524768fc810ad7bac4f73

Bug 699753: Windows uninstall: remove all installed files etc

This was partly caused by a subtlety of the nsis installer syntax which means
the '/r' option for the 'File' operation will match and install all
files/directories in the file heirarchy that match the search term, unless they
are explicitly excluded.

For example:
File /r doc

will end up matching:
doc/
something/doc
another/thing/doc

So, ensure we exclude subtrees so we no longer accidentally include files we
don't intend.

Also, add the missing removals, so we do remove eveything we intended to
install.

Lastly add in (and include removal of!) the Resource/* tree, and the iccprofiles
directories - both of which users have asked to be included.

psi/nsisinst.nsi


2018-09-10 07:42:13 -0700
Ray Johnston <ray.johnston@artifex.com>
7738ffa5136549dd0cdcdf89974e339187246998

Correct getdeviceprops documentation

doc/Language.htm


2018-09-10 09:54:14 +0100
Chris Liddell <chris.liddell@artifex.com>
7146378240f90bf4171ae7a2a00cc9d46eaec86d

Add a note about unSAFERness of ps2epsi

doc/History9.htm
doc/News.htm


2018-09-10 09:25:22 +0100
Chris Liddell <chris.liddell@artifex.com>
4cfee19351e36543927b78b97dbf2e600daa9bfe

Dates/news/history for 9.25 release candidate 1

base/gscdef.c
base/version.mak
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gs-vms.hlp
doc/sample_downscale_device.htm
doc/subclass.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



Version 9.25 (2018-09-13)

Highlights in this release include:

  • This release fixes problems with argument handling, some unintended results of the security fixes to the SAFER file access restrictions (specifically accessing ICC profile files), and some additional security issues over the recent 9.24 release.

  • Security issues have been the primary focus of this release, including solving several (well publicised) real and potential exploits.

    PLEASE NOTE: We strongly urge users to upgrade to this latest release to avoid these issues.

  • As well as Ghostscript itself, jbig2dec has had a significant amount of work improving its robustness in the face of out specification files.

  • IMPORTANT: We are in the process of forking LittleCMS. LCMS2 is not thread safe, and cannot be made thread safe without breaking the ABI. Our fork will be thread safe, and include performance enhancements (these changes have all be been offered and rejected upstream). We will maintain compatibility between Ghostscript and LCMS2 for a time, but not in perpetuity. Our fork will be available as its own package separately from Ghostscript (and MuPDF).

  • The usual round of bug fixes, compatibility changes, and incremental improvements.

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

Incompatible changes

  • None

Changelog

2018-09-13 10:54:33 +0100
Chris Liddell <chris.liddell@artifex.com>
2f00215a28bcc43bb5857081378a6d956ef8b9d5

Dates, product string, etc for 9.25 release

base/gscdef.c
base/version.mak
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gs-vms.hlp
doc/sample_downscale_device.htm
doc/subclass.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


2018-09-11 10:59:24 +0100
Chris Liddell <chris.liddell@artifex.com>
4b3fbf2bca24b2833322985be390fc739d237f7d

Bug 699757: disable epo device for x11 devices

The epo device interferes with the operation of the x11 devices when those
are integrating with an existing X application (i.e. xv, or other application
that relies on the 'GHOSTVIEW' functionality).

Disable epo by adding an x11 specific fillpage method.

devices/gdevx.c


2018-09-11 11:12:13 +0100
Ken Sharp <ken.sharp@artifex.com>
5ac63e47077e0e7d02e99e247e0c47c4737e0cb8

PDF interpreter - work around GSView 5 and PAGELABEL pdfmarks

We added the ability to process PDF page labels as pdfmarks, instead of
using the .pagelabels operator (as used by pdfwrite) for the benefit of
DejaVu.

Unfortunately, GSView 5 redefines the pdfmark operator, and attempts
to process the information itself. This is a problem when it doesn't
recognise the pdfmark in question, which it does not with PAGELABEL.

There's no way for us to fix GSView 5, and we don't want to revert the
enhancement for DejaVu because that is still being actively maintained.

This commit is a rather ugly hack which relies upon the presence of a
specific named dictionary in userdict when GSView is executing. If that
dictionary is present then we don't create PAGELABEL pdfmarks, thus
avoiding confusing GSView 5.

Resource/Init/pdf_main.ps


2018-09-10 17:05:47 +0100
Chris Liddell <chris.liddell@artifex.com>
b3974730243cb449299524768fc810ad7bac4f73

Bug 699753: Windows uninstall: remove all installed files etc

This was partly caused by a subtlety of the nsis installer syntax which means
the '/r' option for the 'File' operation will match and install all
files/directories in the file heirarchy that match the search term, unless they
are explicitly excluded.

For example:
File /r doc

will end up matching:
doc/
something/doc
another/thing/doc

So, ensure we exclude subtrees so we no longer accidentally include files we
don't intend.

Also, add the missing removals, so we do remove eveything we intended to
install.

Lastly add in (and include removal of!) the Resource/* tree, and the iccprofiles
directories - both of which users have asked to be included.

psi/nsisinst.nsi


2018-09-10 07:42:13 -0700
Ray Johnston <ray.johnston@artifex.com>
7738ffa5136549dd0cdcdf89974e339187246998

Correct getdeviceprops documentation

doc/Language.htm


2018-09-10 09:54:14 +0100
Chris Liddell <chris.liddell@artifex.com>
7146378240f90bf4171ae7a2a00cc9d46eaec86d

Add a note about unSAFERness of ps2epsi

doc/History9.htm
doc/News.htm


2018-09-10 09:25:22 +0100
Chris Liddell <chris.liddell@artifex.com>
7657f3698ce5a440b069ff953e57841950919132

Dates etc for 9.25 release candidate 1

base/gscdef.c
base/version.mak
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gs-vms.hlp
doc/sample_downscale_device.htm
doc/subclass.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


2018-09-10 08:41:34 +0100
Ken Sharp <ken.sharp@artifex.com>
7b0c4cc3e79d1e689b5fc3251a1130f409ed7a82

Bug 699748 "gs9.24/windows can't process environment variable GS_OPTIONS anymore"

This problem only exhibits in a 64-bit build.

The problem is caused by the union of 's' and 'file' in the arg_source
structure. When in a 32-bit build, this happens to work out to be 0
when the source is a string and not a file. But in a 64-bit it does not.

Now because we have a 'is_file' member in the structure this isn't a
problem, except that in get_codepoint() we pass both the u.file and
u.str members to the decoding function. In get_codepoint_utf8 we then
check to see if 'file' is 0, and if it is not, we attempt to read from
it. If 'file' is 0, then we treat this as a string instead.

To avoid altering the decoding function, with potential knock-on effects
through the code, I've chosen to test the 'is_file' member and pass
NULL for the file if this is not a file.

base/gsargs.c


2018-09-08 09:47:19 +0100
Ken Sharp <ken.sharp@artifex.com>
95281026d983bff8f72e431c7f620a0e8d07c2af

Bug 699744 "ps2epsi fails with Error: /undefined in --setpagedevice--"

Recent changes required to harden SAFER mode mean that it is no longer
possible to run this script in SAFER mode, because it relies upon
unsafe Ghostscript non-standard extension operators.

Removing SAFER and DELAYSAFER, and the code to reset SAFER, allow the
program to run as well as it ever did (ie badly). This program should
now be considered unsafe, you should not use it on untrusted PostScript
programs.

I think its likely we will deprecate and remove this program in future.

lib/ps2epsi
lib/ps2epsi.bat
lib/ps2epsi.cmd
lib/ps2epsi.ps


2018-09-07 10:33:41 -0700
Michael Vrhel <michael.vrhel@artifex.com>
232c2bf9db56ab32fbe5026e1b3eabdbb88380a8

gprf device: Memory leak

The deflate_block was not being freed after the writing of the page.

devices/gdevgprf.c


2018-09-07 10:17:44 -0700
Michael Vrhel <michael.vrhel@artifex.com>
d4c2e30bc057bc99e8d0fac04f6ecaae4721f435

Get formats set properly in gscms_transform_color

The color space was not getting set in the input
and output formats when we had a change in the lcms
formatters.

base/gsicc_lcms2mt.c


2018-09-07 08:54:58 +0100
Chris Liddell <chris.liddell@artifex.com>
fa78d81c37afc28950020df4accf58d7bb1d01e7

Initialize a variable.

Prevents static analysis tools from complaining about it being used
uninitialized (it's being to in order to initialize it).

psi/interp.c


2018-09-07 08:16:06 +0100
Chris Liddell <chris.liddell@artifex.com>
790f13e61ddbe232327b34665606f52b4d943676

Tidy up adding the temp dirs to the PermitFile* arrays

Resource/Init/gs_init.ps


2018-09-07 08:07:12 +0100
Chris Liddell <chris.liddell@artifex.com>
643b24dbd002fb9c131313253c307cf3951b3d47

Bug 699718(2): Improve/augment stack size checking

Improve the rebustness of the previous solution (previously it could trigger an
error when there *was* stack capacity available).

Remove redundant check: we don't need to check if the *current* stack size is
sufficient, before checking the maximum permitted stack size.

Also check the exec stack, as execstackoverflow can also cause the
Postscript call out to fail.

Lastly, in event of failure, put the LockSafetyParams flag back in the existing
device (this is only necessary because we don't enfore JOBSERVER mode).

Note: the Postscript callout (%grestorepagedevice) never pushes any dictionaries
on the dict stack - if that changes, we should check that stack, too.

psi/zdevice2.c


2018-09-07 08:05:52 +0100
Chris Liddell <chris.liddell@artifex.com>
7dd56d01397a40da636ad88a5d19af4e2e404e6a

Put .setdebug back into the proc removal list for SAFER

accidentally removed in a previous commit

Resource/Init/gs_init.ps


2018-09-07 15:22:29 +0100
Ken Sharp <ken.sharp@artifex.com>
65a9046ded8e9edd5d33bc812a9e94ae29607a1e

Bug #699707 "Security review bug - continuation procedures"

As a result of the recent security review, this bug was raised to go
through the PostScript interpreter looking for places where we exit the
'C' level and return control to PostScript. This is done when we need
to evaluate something in the PostScript environment, such as a transfer
function or a tint transform.

Because these functions are written in PostScript we need to run them
in the PostScript environment.

To do this we push the procedure (or at least 'a' procedure) onto the
exec stack and exit with an o_push_estack error. In many cases that's
all we need to do, but sometimes we want to return control back to the
'C' environment and, in some of those cases, we want to store some state
for the C code. We can't use the operand stack (because the PostScript
function will alter that) so we store stuff on the exec stack instead.

When we complete the C level, we should restore the exec stack, so if
we stored any state on it, we should remove it. Sometimes we were not
doing so if there was an error.

Generally this did not cause a problem, because in general on an error
we would stop. However if the error handler had been altered it was
possible we might carry on. 'Sometimes' that would mean we tried to
execute something which wasn't executable, and sometimes it might mean
that we tried to return to the C level, but without the expected
state on the exec stack.

This could lead to memory corruption and crashes.

This commit tries to find everywhere where we might end up leaving
extra items on the exec stack in the case of an error, and either
removes the required number of items from the exec stack or uses
whatever cleanup routine was established for the C code.

Its important to note that, in normal use, none of these could actually
cause a problem. This makes it hard to test. all the cases here I have
tested, though in many cases the only way I could produce an error was
by forcing an error return in the debugger. I suspect some error cases
simply aren't possible but its good practice to check the return codes
anyway, even if its only a theoretical problem.

psi/zalg.c
psi/zcie.c
psi/zcolor1.c
psi/zcontrol.c
psi/zfile.c
psi/zht1.c
psi/zht2.c
psi/zpath1.c
psi/zpcolor.c


2018-09-06 14:18:22 -0700
Michael Vrhel <michael.vrhel@artifex.com>
0da9680ca0506fd3cdf70840ad5387d85cab4996

gscms_transform_color fails in cloning operation

The cloning operation was getting called with a NULL
pointer for the current ICC link handle.

base/gsicc_lcms2mt.c


2018-09-06 11:39:58 -0700
Ray Johnston <ray.johnston@artifex.com>
f6ebd382763546e31a024376ff49ff2f074627de

Remove obsolete code and comment (from 1999)

After this long, there is no reason to carry this code around that was
a hack for joins of a flattened curve.

base/gxstroke.c


2018-09-06 12:07:35 -0700
Michael Vrhel <michael.vrhel@artifex.com>
f509c2c1350fbb3549dcd539448bf02742c1b49e

gproof device supports post rendering ICC profile

This issue was introduced during some error clean up
of the ICC profile code.

devices/gdevgprf.c


2018-09-06 18:40:05 +0100
Chris Liddell <chris.liddell@artifex.com>
13418541a5ae19b15f51cbb87faf344902f5af98

Bug 699722 (2): add wildcards to the permissions paths.

The temp and ICC profile paths need to finish with wildcards to work correctly.

Resource/Init/gs_init.ps


2018-09-05 17:14:59 +0100
Chris Liddell <chris.liddell@artifex.com>
3e5d316b72e3965b7968bb1d96baa137cd063ac6

Bug 699718: Ensure stack space is available before gsrestore call out

During a grestore, if the device is going to change, we call out to Postscript
to restore the device configuration, before returning to restore the graphics
state internally.

We have to ensure sufficient op stack space is available to complete the
operation, otherwise the device can end up an undefined state.

Resource/Init/gs_setpd.ps
psi/zdevice2.c


2018-09-06 14:08:41 +0100
Chris Liddell <chris.liddell@artifex.com>
c8c01f8c4164bc10281d9e8f87cf96314d93104b

Bug 699722: Add the ICCProfilesDir to the PermitReading list

There was also an issue that the string being returned from the graphics
library was null terminated, and Postscript strings are not (and Ghostscript
strings are not necessarily). We leave the null termination in place, but
reduce the length returned by 1.

Resource/Init/gs_init.ps
base/gsicc_manage.c


2018-09-06 09:16:22 +0100
Chris Liddell <chris.liddell@artifex.com>
fb713b3818b52d8a6cf62c951eba2e1795ff9624

Bug 699708 (part 1): 'Hide' non-replaceable error handlers for SAFER

We already had a 'private' dictionary for non-standard errors: gserrordict.

This now includes all the default error handlers, the dictionary is made
noaccess and all the prodedures are bound and executeonly.

When running with -dSAFER, in the event of a Postscript error, instead of
pulling the handler from errordict, we'll pull it from gserrordict - thus
malicious input cannot trigger problems by the use of custom error handlers.

errordict remains open and writeable, so files such as the Quality Logic tests
that install their own handlers will still 'work', with the exception that the
custom error handlers will not be called.

This is a 'first pass', 'sledgehammer' approach: a nice addition would to allow
an integrator to specify a list of errors that are not to be replaced (for
example, embedded applications would probably want to ensure that VMerror is
always handled as they intend).

Resource/Init/gs_init.ps
psi/interp.c


2018-09-05 17:00:41 +0100
Chris Liddell <chris.liddell@artifex.com>
0d8c7d563745bfd89051a203267fcbf2492ecfcc

Bug 699720: Change available buffer space to int from uint

sbufavailable() returns the number of bytes still available in the stream
buffer. This can end up as negative at EOF (after we've read the final byte in
the buffer, we read ptr is moved to the next byte, past the end of the buffer -
that should never be read, however).

We can safely use a signed integer since this is buffer space, *not* the total
bytes available from the stream

psi/interp.c


2018-09-05 12:54:46 +0100
Chris Liddell <chris.liddell@artifex.com>
37c1547e61e758cdd17c3dcb0504e2f5988004c3

Delete legacy code source file, and references to it

base/gp_sysv.c
base/unix-aux.mak
doc/Develop.htm
doc/Source.htm
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2018-09-04 14:35:18 +0100
Robin Watts <robin.watts@artifex.com>
164b6cb355900d0faea7468b4eafb3154aa90f6a

Fix some comment typos.

Resource/Init/gs_init.ps


2018-09-06 07:33:16 -0700
Michael Vrhel <michael.vrhel@artifex.com>
3a5815b014c316e28584f134dc3c06e43c848b38

Add overprint support to knock out rect-fill

When doing the rect fill for transparency knockout groups
we were not handling overprint properly

base/gdevp14.c


2018-09-04 11:18:48 -0700
Michael Vrhel <michael.vrhel@artifex.com>
5317e232d5a0309fc367d8bedb89988dd4bc38c9

Fix bit rot in RAW_DUMP and TRACK_COMPOSE_GROUPS

maskbuf is not defined in this particular path (as it is NULL)

base/gxblend.c


2018-07-09 16:38:15 +0100
Robin Watts <robin.watts@artifex.com>
1435e31660ba94909688dabf74b411ead3196384

Fix bug in mkromfs binary compaction.

When writing long strings, psc->inpos changes value between
writing it's low and high bytes.

base/mkromfs.c


2018-07-05 17:16:00 +0100
Robin Watts <robin.watts@artifex.com>
5ec955366733d15a4f720271186abcf922ea2535

Remove GS_NO_UTF8

base/gp_mswin.c
base/gp_ntfs.c
base/gp_wgetv.c
base/gp_wutf8.c
base/gsargs.c
base/msvclib.mak
base/windows_.h
devices/gdevwpr2.c
pcl/pl/plmain.c
pcl/pl/plwmainc.c
psi/dwmain.c
psi/dwmainc.c
psi/dwtext.c
psi/dwtext.h
psi/iapi.c
psi/imainarg.c
psi/iminst.h
psi/msvc.mak


2018-07-09 11:15:00 +0100
Robin Watts <robin.watts@artifex.com>
bc1d2d9742c960f1d4905f43810be072c5d92390

Bug 691725: Tweak gssetgs*.bat files.

The existing scripts assume that the gs binaries are on the path.
The tweaked scripts check to see if there is a binary in the same
directory as the .bat file, and if there is, use that in preference
to any version on the path.

Otherwise functionality is identical.

lib/gssetgs.bat
lib/gssetgs32.bat
lib/gssetgs64.bat


2018-09-06 12:56:51 +0100
Robin Watts <robin.watts@artifex.com>
68eca5e94e6f63f4392b15581ad41af52e0edfd9

Fix SEGV seen in all-devices test with plank examples/ridt91.eps

Silly typo in the contone fill code for the landscape flippedy
color cache case.

base/gximono.c


2018-09-05 23:58:39 +0100
Robin Watts <robin.watts@artifex.com>
6473ad1394900c79a7ca5335accaaad9cd67d42a

Add prototype missed from previous commit.

psi/interp.h


2018-09-05 18:07:40 +0100
Robin Watts <robin.watts@artifex.com>
2b533271d8bd915593a2f8e1a1f446ee940c7d76

Fix arg_copy leaks.

When handling -d or -s args, the code currently arg_copies the string
it gets back, then uses that copied block to make postscript names
from.

Here we change the code so that postscript names are made in a
slightly different way, so they copy the string content. This means
we can free the arg_copied block afterwards, solving the leaks.

While we are here, remove a layer of nasty variable hiding macros
that do nothing but confuse things.

psi/iddict.h
psi/idict.c
psi/idict.h
psi/iinit.c
psi/imain.c
psi/imainarg.c
psi/interp.h


2018-09-05 15:59:43 +0100
Robin Watts <robin.watts@artifex.com>
a8c7899267121cb92503fe0f7e7f6ae433c386b1

Bug 699711: Review arg_next to ensure that NULL arg returns are coped with.

We can only return NULL from arg_next if the return code == 0. We
therefore have to ensure that all call sites check for either of
those conditions.

base/gsargs.c
pcl/pl/plmain.c
psi/imainarg.c


2018-09-05 13:46:50 +0100
Robin Watts <robin.watts@artifex.com>
df4ec49e0f2237fe5b17d5d620f8c3cad95b3b5e

Second attempt at fix for bug 699699.

The previous attempt failed because it gave the wrong return value
when we hit an empty argument.

Now we ignore empty arguments.

base/gsargs.c
psi/imainarg.c


2018-09-05 13:19:51 +0100
Robin Watts <robin.watts@artifex.com>
ecfbc3126834e442edb309112e8995df9f10daa4

Revert previous fix for Bug 699699.

Revert "Bug 699699 "Crash upon bogus input argument.""
(commit b509290189f1f37a76339f7b6921d42f126bfd57).

This reopens bug 699699, so we can fix it in a way that doesn't
return 1 for 'empty' arguments.
This reopens bug 699699.

base/gsargs.c
psi/imainarg.c


2018-09-05 16:42:44 +0100
Robin Watts <robin.watts@artifex.com>
01514a0c6add9cbafe3c3ba55f57968154d2b323

Bug 699719: Fix @ files in arg handling.

When we met an @file in the arg handling, we were failing to swallow
it and returning "@file" to the caller.

base/gsargs.c


2018-09-05 16:43:20 +0100
Chris Liddell <chris.liddell@artifex.com>
6c887103a58563dd4e95acab49f9ee60f2aa13a7

Update signed ghostpdf.cat to new certificate

also add a *.cat rule to .gitattributes to ensure .cat files are always treated
as binary

.gitattributes
lib/ghostpdf.cat


2018-09-05 08:44:41 +0100
Chris Liddell <chris.liddell@artifex.com>
e914f1da46e33decc534486598dc3eadf69e6efb

Fix incomplete comment from previous commit

Resource/Init/gs_setpd.ps


2018-09-04 23:18:46 +0100
Chris Liddell <chris.liddell@artifex.com>
5812b1b78fc4d36fdc293b7859de69241140d590

Bug 699714: retain .LockSafetyParams through failed .installpagedevice

In the event that the .trysetparams fails during .installpagedevice, catch the
error, and ensure that at least the .LockSafetyParams is set.

Resource/Init/gs_setpd.ps


2018-09-04 17:01:08 +0100
Chris Liddell <chris.liddell@artifex.com>
bc3df0773fccf4b4906a3e59652ad646ea0fee91

For ICC profile validation, have cups id iteself as DeviceN

Give the range of color spaces and models that cups supports, we can't
reasonably provide (or expect others to provide) output ICC profiles for all
cases.

For the purpose of profile validation, have it claim to be DeviceN and benefit
from the extra tolerance in profiles allowed for that class of device.

cups/gdevcups.c
devices/devs.mak


2018-08-28 16:55:49 +0100
Chris Liddell <chris.liddell@artifex.com>
90a692cfbfc2d6ec3c227149cd8d52fc22dc9e4e

Bring master up to date with 9.24 release branch

Doc changes, etc

base/version.mak
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gs-vms.hlp
doc/sample_downscale_device.htm
doc/subclass.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


2018-09-03 16:57:51 +0100
Chris Liddell <chris.liddell@artifex.com>
cc6fafb69b7957c9a7eac9a0087793d48be0443c

Silence a coverity warning.

base/gdevdflt.c


2018-09-03 15:32:40 +0100
Chris Liddell <chris.liddell@artifex.com>
29b6890cc618a88e0d9eb8e996d3e0153b5fbda9

Update files for jbig2dec release 0.15

jbig2dec/CHANGES
jbig2dec/config_win32.h
jbig2dec/configure.ac
jbig2dec/jbig2dec.1


2018-09-03 15:34:44 +0100
Ken Sharp <ken.sharp@artifex.com>
fd6cac72bbc050e1a2832fd59f9fb1792b493750

PostScript interpreter - More places where exec stack is not restored

For the setcolorspace continuation procedure, and the related procs
for specific colour spaces, we need to remove the extra operands we
placed on the exec stack, so that there's no possibility of returning
and executing them.

psi/zcolor.c


2018-09-03 14:17:05 +0100
Ken Sharp <ken.sharp@artifex.com>
b509290189f1f37a76339f7b6921d42f126bfd57

Bug 699699 "Crash upon bogus input argument."

The code in arg_next starts by setting *argstr to NULL, the following
do..while loop assumes that *argstr will be filled in, and checks its
first byte. However, if we run out of characters in the argument string
then *argstr remains NULL, and causes a crash.

This can happen if we pass an empty quoted argument ""

In addition, the processing of -o and possibly other switches assumes
that arg_next will return an error if it doesn't find an argument
whereas now it can return a NULL. I believe its possible that it always
could do so.

So check the 'arg' returned from arg_next to make sure its not NULL
before we try to use it.

We should check other places where arg_next is called as well.

base/gsargs.c
psi/imainarg.c


2018-09-01 17:50:05 +0100
Chris Liddell <chris.liddell@artifex.com>
0704d18b10314d701a522ad6c16718e0b8e199b7

Bug 699658(related): Move recording of temp file names into C

When we successfully create a temporary file from Postscript, either doing so
when SAFER is not in force, or when SAFER is in force, and creating it in
a write permitted directory, we record the file name so we can later delete
the file, even is SAFER has been engaged, or if the PermitWriting list has
changed to no longer the directory in question.

Previously the recording of the name was done in Postscript, even though the
checking was done in C.

This moves the recording of the names to C, meaning we can remove the Postscript
redefinitions of .tempfile and deletfile, and make the dictionary in question
noaccess.

Also, tidy up the adding of the temporary file directory to the list of
permitted directories, and include the list in all of the categories
(PermitFileWriting, PermitFileReading and PermitFileControl) - it was only
previously adding to writing.

Resource/Init/gs_init.ps
psi/int.mak
psi/zfile.c


2018-08-31 15:57:55 +0100
Chris Liddell <chris.liddell@artifex.com>
29f4603fc0c6de7d5df1f293f0a7efbffe8112bd

Bug 699693: Fix FAPI handling of multibyte Unicode code point

The original code worked for one byte code points, and for the case there the
original character code and Unicode value both had the same number of bytes,
but was totally wrong if the the two were different.

psi/zfapi.c


2018-09-01 11:28:06 +0100
Ken Sharp <ken.sharp@artifex.com>
7ba6d80c69f0c74601ffc1077d27e0d1a299e57f

Bug #699687 "grestore can bypass SAFER"

The code in z2grestore (part of the level 2 restore machinery) in
ghostpdl/psi/zdevice2.c sets the device's LockSafetyParams to false, and
according to the comments there relies on putdeviceparams setting
the flag back when the old device is re-instated.

However, if we have corrupted any part of the device's content, then
its possible to exit putdeviceparams, in one place only, without
setting LockSafetyParams. Here we simply add an explicit reset of the
value even in the case of an error setting the new device.

base/gsdparam.c


2018-09-01 09:28:08 +0100
Ken Sharp <ken.sharp@artifex.com>
61ad589fb861d28e2d2c9d0b609ec4da4d7dd247

Bug 699677 ".bindnow still causing side effects"

In fact, its nothing to do with .bindnow. That simply modifies the exec
stack in a way which makes the problem exhibit.

setcustomcolor should really check its operands. because it doens't, it
creates a tint transform function which tries to mulitply a number by
(in this case) a name. This throws an error of course.

The problem is that the code to sample the tint transform function
didn't deal properly with the case where the PostScript function throws
an error. In that case it properly exits the code which executes the
function, but it fails to unwind the exec stack.

This leads to use trying to complete the function, using the enumerator,
which has been stored on the exec stack. Because we didn't clean up the
exec stack, what we retrieve isn't an enumerator. This causes us to try
to access invalid memory and can result in a crash.

So, several steps. Firstly have the sampling code properly handle the
error and restore the exec stack. Secondly, have the setcolorspace code
be prepared to accept a NULL returned from the sampling code and treat
that as an error (and also fix a similar exec stack problem in the
setcolorspace code). Finally; have setcustomcolor validate its operands.

Resource/Init/gs_lev2.ps
psi/zcolor.c
psi/zfsample.c


2018-08-29 09:30:19 -0700
Ray Johnston <ray.johnston@artifex.com>
c98cb5237c983e363fe05757b2639eab550499e8

Fix for security issues found during internal security audit

While most of the invocations of .forceput and related operators were
"protected" by being within "executeonly" procedures, several had crept
in that did not make sure that the operator was hidden in a procedure
that could not be read.

Resource/Init/gs_dps.ps
Resource/Init/gs_fntem.ps
Resource/Init/gs_init.ps
Resource/Init/gs_lev2.ps
Resource/Init/gs_pdfwr.ps
Resource/Init/gs_setpd.ps
Resource/Init/gs_typ32.ps


2018-08-31 08:12:48 +0100
Chris Liddell <chris.liddell@artifex.com>
d60214879cd71cf9f995c7d8862394293ffa9014

Remove embedded, copyrighted ICC profile from PNG images

doc/images/Artifex_logo.png
doc/images/favicon.png
doc/images/ghostscript_logo.png
doc/images/hamburger-light.png
doc/images/x-light.png


2018-08-31 09:58:00 +0100
Ken Sharp <ken.sharp@artifex.com>
478b73874179262d880c1417b5a11fb534a18651

PDF interpreter - remove a warning message

Commit f6bcc0dfc173b80fddab4fbf10afb34332ff1112 added extra checking
and processing to deal with the (illegal) case of a Text block which
includes a 'q' operator.

As part of that commit, we added a warning message so that users would
be able to tell there was a problem. Unfortunately, there are cases
which are perfectly legal (eg running a Pattern PaintProc to fill the
text) where a q can apparently occur inside a text object.

We can't differentiate between executing a 'q' in such cases, so the
only option is to remove the warning. This does not affect the actual
operation of the code, it still copes with a 'q' inside text objects,
whether legally or not.

Resource/Init/pdf_ops.ps


2018-08-30 13:33:36 +0100
Ken Sharp <ken.sharp@artifex.com>
f8834d04215857e6150876bf189b682dbf254f8a

ps2write - modify Lab space handling

Commit 9e58cc8dd7e9b98620c798c901f800aff2e381ce improved the handling of
/Separation spaces with an Lab alternate space.

However, it also altered the handling of Lab spaces as the base space
for patterns, or the initial space. This caused a small difference in
release testing.

The result was incorrect previously, and after the above commit, but the
commit made it appear worse from a user's perspective. Until we can
get time to properly convert Lab base spaces into a device space, return
the code to its prior state. This does not affect the improvement to
Separation spaces.

devices/vector/gdevpdfc.c


2018-08-30 09:34:07 +0100
Ken Sharp <ken.sharp@artifex.com>
6dfd431fb4a97665044dcea7a061e8fa6ec36098

Bug #699684 "gs segfaults in refset_null_new when processing malformed file"

It is possible for a specifically malformed Binary Object Sequence to
run out of data to process (and return to refill the buffer) when it
had read *exactly* the maximum number of objects declared in the top
array.

This meant that the 'index' pointing to the next expected array entry
to be filled in actually pointed past the end of the array.

We then called a routine to set the unused entries in the array to null
objects (for GC purposes), using the index. Because it pointed past the
end of the array this led to the count of objects being -1. The code
then counted down the count, until it reached 0, while at the same time
writing null objects past the end of the array.

This commit simply checks the index against the array size and doesn't
attempt to fill it in if its less than that value. Note that the array
index is 0-based, hence < not <=.

psi/iscanbin.c


2018-08-29 07:59:17 +0100
Chris Liddell <chris.liddell@artifex.com>
d469deaf34e25f701a531ffd36cfc7f738efc4a2

Fix a typo in commit 21ae2f8d9953

psi/zfapi.c


2018-08-28 16:39:43 +0100
Chris Liddell <chris.liddell@artifex.com>
a25e6980ca87eaf0ef3d7e71acbed1ff2db7ab28

Bump version on master to 9.25

Resource/Init/gs_init.ps
base/version.mak


2018-08-26 15:16:46 +0800
Sebastian Rasmussen <sebras@gmail.com>
032603f3c5448fc32609c51c932d11529eb6b581

Bug 699673: jbig2dec: Initialize return code for all cases.

Thanks to oss-fuzz for reporting.

jbig2dec/jbig2_arith.c


2018-08-26 15:16:02 +0800
Sebastian Rasmussen <sebras@gmail.com>
343366cf2d6c3170d8b582d5df076f803c699262

jbig2dec: Avoid dereferencing pointer before it is tested.

Thanks to coverity.

jbig2dec/jbig2.c


2018-09-03 09:44:54 +0100
Chris Liddell <chris.liddell@artifex.com>
32f1afe5c1e0b862e3bde05dc7b860a5f65cfbea

Update dates, product string etc for release

Fix release date

base/gscdef.c
base/version.mak
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gs-vms.hlp
doc/sample_downscale_device.htm
doc/subclass.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


2018-09-03 08:34:25 +0100
Chris Liddell <chris.liddell@artifex.com>
ae222d8aa93783ba542b8ba91d62a1e107650563

Update changelog... again

doc/History9.htm


2018-09-01 17:50:05 +0100
Chris Liddell <chris.liddell@artifex.com>
07da47959687c1e6a112ad746929ef66e82b5aa9

Bug 699658(related): Move recording of temp file names into C

When we successfully create a temporary file from Postscript, either doing so
when SAFER is not in force, or when SAFER is in force, and creating it in
a write permitted directory, we record the file name so we can later delete
the file, even is SAFER has been engaged, or if the PermitWriting list has
changed to no longer the directory in question.

Previously the recording of the name was done in Postscript, even though the
checking was done in C.

This moves the recording of the names to C, meaning we can remove the Postscript
redefinitions of .tempfile and deletfile, and make the dictionary in question
noaccess.

Also, tidy up the adding of the temporary file directory to the list of
permitted directories, and include the list in all of the categories
(PermitFileWriting, PermitFileReading and PermitFileControl) - it was only
previously adding to writing.

Resource/Init/gs_init.ps
psi/int.mak
psi/zfile.c


2018-08-31 15:57:55 +0100
Chris Liddell <chris.liddell@artifex.com>
d8cfd2e7e1000f644afcaca2f196cb6d494049b8

Bug 699693: Fix FAPI handling of multibyte Unicode code point

The original code worked for one byte code points, and for the case there the
original character code and Unicode value both had the same number of bytes,
but was totally wrong if the the two were different.

psi/zfapi.c


2018-09-01 11:28:06 +0100
Ken Sharp <ken.sharp@artifex.com>
a5993c537ae035b2396da5189fd985006627a478

Bug #699687 "grestore can bypass SAFER"

The code in z2grestore (part of the level 2 restore machinery) in
ghostpdl/psi/zdevice2.c sets the device's LockSafetyParams to false, and
according to the comments there relies on putdeviceparams setting
the flag back when the old device is re-instated.

However, if we have corrupted any part of the device's content, then
its possible to exit putdeviceparams, in one place only, without
setting LockSafetyParams. Here we simply add an explicit reset of the
value even in the case of an error setting the new device.

base/gsdparam.c


2018-09-01 09:28:08 +0100
Ken Sharp <ken.sharp@artifex.com>
21b27dc55b493564006c91326a5ddc636cf88563

Bug 699677 ".bindnow still causing side effects"

In fact, its nothing to do with .bindnow. That simply modifies the exec
stack in a way which makes the problem exhibit.

setcustomcolor should really check its operands. because it doens't, it
creates a tint transform function which tries to mulitply a number by
(in this case) a name. This throws an error of course.

The problem is that the code to sample the tint transform function
didn't deal properly with the case where the PostScript function throws
an error. In that case it properly exits the code which executes the
function, but it fails to unwind the exec stack.

This leads to use trying to complete the function, using the enumerator,
which has been stored on the exec stack. Because we didn't clean up the
exec stack, what we retrieve isn't an enumerator. This causes us to try
to access invalid memory and can result in a crash.

So, several steps. Firstly have the sampling code properly handle the
error and restore the exec stack. Secondly, have the setcolorspace code
be prepared to accept a NULL returned from the sampling code and treat
that as an error (and also fix a similar exec stack problem in the
setcolorspace code). Finally; have setcustomcolor validate its operands.

Resource/Init/gs_lev2.ps
psi/zcolor.c
psi/zfsample.c


2018-08-29 09:30:19 -0700
Ray Johnston <ray.johnston@artifex.com>
91d6bc4d3e3865388ede3bcd4e84bbb8787b78e4

Fix for security issues found during internal security audit

While most of the invocations of .forceput and related operators were
"protected" by being within "executeonly" procedures, several had crept
in that did not make sure that the operator was hidden in a procedure
that could not be read.

Resource/Init/gs_dps.ps
Resource/Init/gs_fntem.ps
Resource/Init/gs_init.ps
Resource/Init/gs_lev2.ps
Resource/Init/gs_pdfwr.ps
Resource/Init/gs_setpd.ps
Resource/Init/gs_typ32.ps


2018-08-31 08:12:48 +0100
Chris Liddell <chris.liddell@artifex.com>
cd83407209c3901ddfabd09e144c90ea105005d7

Remove embedded, copyrighted ICC profile from PNG images

doc/images/Artifex_logo.png
doc/images/favicon.png
doc/images/ghostscript_logo.png
doc/images/hamburger-light.png
doc/images/x-light.png


2018-08-30 15:07:33 +0100
Chris Liddell <chris.liddell@artifex.com>
f667df996290e64fc091d81b7513abdac488e156

Update dates etc for release candidate 2

base/gscdef.c
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gs-vms.hlp
doc/sample_downscale_device.htm
doc/subclass.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


2018-08-30 13:33:36 +0100
Ken Sharp <ken.sharp@artifex.com>
214d6725e4a2b539294ebfba528a8d0961379fd0

ps2write - modify Lab space handling

Commit 9e58cc8dd7e9b98620c798c901f800aff2e381ce improved the handling of
/Separation spaces with an Lab alternate space.

However, it also altered the handling of Lab spaces as the base space
for patterns, or the initial space. This caused a small difference in
release testing.

The result was incorrect previously, and after the above commit, but the
commit made it appear worse from a user's perspective. Until we can
get time to properly convert Lab base spaces into a device space, return
the code to its prior state. This does not affect the improvement to
Separation spaces.

devices/vector/gdevpdfc.c


2018-08-30 09:34:07 +0100
Ken Sharp <ken.sharp@artifex.com>
e40f79df969e4168daf65b3b3af3ea73b6a71fc4

Bug #699684 "gs segfaults in refset_null_new when processing malformed file"

It is possible for a specifically malformed Binary Object Sequence to
run out of data to process (and return to refill the buffer) when it
had read *exactly* the maximum number of objects declared in the top
array.

This meant that the 'index' pointing to the next expected array entry
to be filled in actually pointed past the end of the array.

We then called a routine to set the unused entries in the array to null
objects (for GC purposes), using the index. Because it pointed past the
end of the array this led to the count of objects being -1. The code
then counted down the count, until it reached 0, while at the same time
writing null objects past the end of the array.

This commit simply checks the index against the array size and doesn't
attempt to fill it in if its less than that value. Note that the array
index is 0-based, hence < not <=.

psi/iscanbin.c


2018-08-29 11:43:49 +0100
Chris Liddell <chris.liddell@artifex.com>
06e4829c6756f0aa6918ba19710050295bd29bfe

Update changelog post 9.24rc1

doc/History9.htm


2018-08-29 07:59:17 +0100
Chris Liddell <chris.liddell@artifex.com>
110b1843b16d92878fd56d874b95bac5e130c720

Fix a typo in commit 21ae2f8d9953

psi/zfapi.c


2018-08-26 15:16:46 +0800
Sebastian Rasmussen <sebras@gmail.com>
74cc0437c7d4aa8bef051300b0ba3b510b9922c4

Bug 699673: jbig2dec: Initialize return code for all cases.

Thanks to oss-fuzz for reporting.

jbig2dec/jbig2_arith.c


2018-08-26 15:16:02 +0800
Sebastian Rasmussen <sebras@gmail.com>
46c4a646d5c7954f076478aa8e85a4fc3b2b1f66

jbig2dec: Avoid dereferencing pointer before it is tested.

Thanks to coverity.

jbig2dec/jbig2.c


Version 9.24 (2018-09-03)

Highlights in this release include:

  • Security issues have been the primary focus of this release, including solving several (well publicised) real and potential exploits.

    PLEASE NOTE: We strongly urge users to upgrade to this latest release to avoid these issues.

  • As well as Ghostscript itself, jbig2dec has had a significant amount of work improving its robustness in the face of out specification files.

  • IMPORTANT: We are in the process of forking LittleCMS. LCMS2 is not thread safe, and cannot be made thread safe without breaking the ABI. Our fork will be thread safe, and include performance enhancements (these changes have all be been offered and rejected upstream). We will maintain compatibility between Ghostscript and LCMS2 for a time, but not in perpetuity. Our fork will be available as its own package separately from Ghostscript (and MuPDF).

  • The usual round of bug fixes, compatibility changes, and incremental improvements.

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

Incompatible changes

  • None

Changelog

2018-09-01 17:50:05 +0100
Chris Liddell <chris.liddell@artifex.com>
07da47959687c1e6a112ad746929ef66e82b5aa9

Bug 699658(related): Move recording of temp file names into C

When we successfully create a temporary file from Postscript, either doing so
when SAFER is not in force, or when SAFER is in force, and creating it in
a write permitted directory, we record the file name so we can later delete
the file, even is SAFER has been engaged, or if the PermitWriting list has
changed to no longer the directory in question.

Previously the recording of the name was done in Postscript, even though the
checking was done in C.

This moves the recording of the names to C, meaning we can remove the Postscript
redefinitions of .tempfile and deletfile, and make the dictionary in question
noaccess.

Also, tidy up the adding of the temporary file directory to the list of
permitted directories, and include the list in all of the categories
(PermitFileWriting, PermitFileReading and PermitFileControl) - it was only
previously adding to writing.

Resource/Init/gs_init.ps
psi/int.mak
psi/zfile.c


2018-08-31 15:57:55 +0100
Chris Liddell <chris.liddell@artifex.com>
d8cfd2e7e1000f644afcaca2f196cb6d494049b8

Bug 699693: Fix FAPI handling of multibyte Unicode code point

The original code worked for one byte code points, and for the case there the
original character code and Unicode value both had the same number of bytes,
but was totally wrong if the the two were different.

psi/zfapi.c


2018-09-01 11:28:06 +0100
Ken Sharp <ken.sharp@artifex.com>
a5993c537ae035b2396da5189fd985006627a478

Bug #699687 "grestore can bypass SAFER"

The code in z2grestore (part of the level 2 restore machinery) in
ghostpdl/psi/zdevice2.c sets the device's LockSafetyParams to false, and
according to the comments there relies on putdeviceparams setting
the flag back when the old device is re-instated.

However, if we have corrupted any part of the device's content, then
its possible to exit putdeviceparams, in one place only, without
setting LockSafetyParams. Here we simply add an explicit reset of the
value even in the case of an error setting the new device.

base/gsdparam.c


2018-09-01 09:28:08 +0100
Ken Sharp <ken.sharp@artifex.com>
21b27dc55b493564006c91326a5ddc636cf88563

Bug 699677 ".bindnow still causing side effects"

In fact, its nothing to do with .bindnow. That simply modifies the exec
stack in a way which makes the problem exhibit.

setcustomcolor should really check its operands. because it doens't, it
creates a tint transform function which tries to mulitply a number by
(in this case) a name. This throws an error of course.

The problem is that the code to sample the tint transform function
didn't deal properly with the case where the PostScript function throws
an error. In that case it properly exits the code which executes the
function, but it fails to unwind the exec stack.

This leads to use trying to complete the function, using the enumerator,
which has been stored on the exec stack. Because we didn't clean up the
exec stack, what we retrieve isn't an enumerator. This causes us to try
to access invalid memory and can result in a crash.

So, several steps. Firstly have the sampling code properly handle the
error and restore the exec stack. Secondly, have the setcolorspace code
be prepared to accept a NULL returned from the sampling code and treat
that as an error (and also fix a similar exec stack problem in the
setcolorspace code). Finally; have setcustomcolor validate its operands.

Resource/Init/gs_lev2.ps
psi/zcolor.c
psi/zfsample.c


2018-08-29 09:30:19 -0700
Ray Johnston <ray.johnston@artifex.com>
91d6bc4d3e3865388ede3bcd4e84bbb8787b78e4

Fix for security issues found during internal security audit

While most of the invocations of .forceput and related operators were
"protected" by being within "executeonly" procedures, several had crept
in that did not make sure that the operator was hidden in a procedure
that could not be read.

Resource/Init/gs_dps.ps
Resource/Init/gs_fntem.ps
Resource/Init/gs_init.ps
Resource/Init/gs_lev2.ps
Resource/Init/gs_pdfwr.ps
Resource/Init/gs_setpd.ps
Resource/Init/gs_typ32.ps


2018-08-30 15:07:33 +0100
Chris Liddell <chris.liddell@artifex.com>
00dd8bc74c2abb38195b9f88f7de36f169296a97

Update dates etc for release candidate 2

base/gscdef.c
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gs-vms.hlp
doc/sample_downscale_device.htm
doc/subclass.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


2018-08-30 13:33:36 +0100
Ken Sharp <ken.sharp@artifex.com>
214d6725e4a2b539294ebfba528a8d0961379fd0

ps2write - modify Lab space handling

Commit 9e58cc8dd7e9b98620c798c901f800aff2e381ce improved the handling of
/Separation spaces with an Lab alternate space.

However, it also altered the handling of Lab spaces as the base space
for patterns, or the initial space. This caused a small difference in
release testing.

The result was incorrect previously, and after the above commit, but the
commit made it appear worse from a user's perspective. Until we can
get time to properly convert Lab base spaces into a device space, return
the code to its prior state. This does not affect the improvement to
Separation spaces.

devices/vector/gdevpdfc.c


2018-08-30 09:34:07 +0100
Ken Sharp <ken.sharp@artifex.com>
e40f79df969e4168daf65b3b3af3ea73b6a71fc4

Bug #699684 "gs segfaults in refset_null_new when processing malformed file"

It is possible for a specifically malformed Binary Object Sequence to
run out of data to process (and return to refill the buffer) when it
had read *exactly* the maximum number of objects declared in the top
array.

This meant that the 'index' pointing to the next expected array entry
to be filled in actually pointed past the end of the array.

We then called a routine to set the unused entries in the array to null
objects (for GC purposes), using the index. Because it pointed past the
end of the array this led to the count of objects being -1. The code
then counted down the count, until it reached 0, while at the same time
writing null objects past the end of the array.

This commit simply checks the index against the array size and doesn't
attempt to fill it in if its less than that value. Note that the array
index is 0-based, hence < not <=.

psi/iscanbin.c


2018-08-29 11:43:49 +0100
Chris Liddell <chris.liddell@artifex.com>
7874cfe914edc8a244976d914fc5a150c263651e

Update changelog post 9.24rc1

doc/History9.htm


2018-08-29 07:59:17 +0100
Chris Liddell <chris.liddell@artifex.com>
110b1843b16d92878fd56d874b95bac5e130c720

Fix a typo in commit 21ae2f8d9953

psi/zfapi.c


2018-08-26 15:16:46 +0800
Sebastian Rasmussen <sebras@gmail.com>
74cc0437c7d4aa8bef051300b0ba3b510b9922c4

Bug 699673: jbig2dec: Initialize return code for all cases.

Thanks to oss-fuzz for reporting.

jbig2dec/jbig2_arith.c


2018-08-26 15:16:02 +0800
Sebastian Rasmussen <sebras@gmail.com>
46c4a646d5c7954f076478aa8e85a4fc3b2b1f66

jbig2dec: Avoid dereferencing pointer before it is tested.

Thanks to coverity.

jbig2dec/jbig2.c


2018-08-28 16:55:49 +0100
Chris Liddell <chris.liddell@artifex.com>
fa11dee6f8a779edbb03ce20853b719f49815fcc

Dates, strings and stuff for 9.24 rc1

base/gscdef.c
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/gs-vms.hlp
doc/sample_downscale_device.htm
doc/subclass.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


2018-08-28 16:27:53 +0100
Ken Sharp <ken.sharp@artifex.com>
520bb0ea7519aa3e79db78aaf0589dae02103764

Bug #699654 (again) and Bug #699677 Improve operator removal for SAFER

Take inspiration from the code to remove unused/dangerous operators
and, when SAFER is true, remove a bunch more non-standard operators
or routines.

In particular remove the .bindnow operator, which should have been
removed previously for Bug #699677 and remove the
.pushpdf14devicefilter for Bug #699654. Only the PDF interpreter
needs to use that, and the device in question only expects to be used
carefully and in the correct sequence. Make sure nobody can meddle with
it.

In addition I removed a number of other operators which are not needed
in normal operation. Some of them, however, are useful so these
(with the exception of .bindnow which is always removed) are only
undefined if SAFER is true.

This allows our QA procedure to continue to use them, which is
particularly important in the case of .makeoperator and .setCPSImode.

At a later date we may choose to move some of these into the regular
undefinition code, ie not dependent on SAFER.

Resource/Init/gs_init.ps


2018-08-28 14:53:49 +0100
Chris Liddell <chris.liddell@artifex.com>
21ae2f8d9953ffe8d6c8f1b2bf72a14b54d50e74

Bug 699682: Handle text from single "gs_glyph" or "gs_char"

In the FAPI code, when dealing a substituted cidfont, we extract the original
character code, and decode that using the ToUnicode CMap, in order to get a
Unicode code point we can then put through the TTF Unicode cmap table - thus
improving the chances of getting a legible result.

It failed to account for the possiblity that we were dealing with a single
character code stored directly, rather than a string of 1 or more codes in a
buffer - derefencing an invalid pointer.

Add code to handle those cases.

psi/zfapi.c


2018-08-28 14:17:09 +0100
Chris Liddell <chris.liddell@artifex.com>
7a702103b4490e370b36587c34b8b549a75ef3a5

Bug 699678: don't allow bytes to be "unread" from stdin

base/stream.c


2018-08-28 12:13:55 +0100
Ken Sharp <ken.sharp@artifex.com>
4b00990640258f464b02ce3f721a22fcb59b289b

Bug 699676 "PDF interpreter can leave dangerous operators available"

The problem here is that certain PDF functions require the ability to
use some of the non-standard, and dangerous, operators/procedures
from the PostScript interpreter.

If we leave those functions readable then a malicious PostScript program
could instantiate the PDF interpreter, inspect the packedarrray and
copy the otherwise unobtainable operator/function, then use it for
mischief.

By making the PDF functions executeonly its impossible to read the
function contents, which prevents this kind of abuse.

Resource/Init/pdf_base.ps
Resource/Init/pdf_draw.ps
Resource/Init/pdf_font.ps
Resource/Init/pdf_main.ps
Resource/Init/pdf_ops.ps
Resource/Init/pdf_rbld.ps
Resource/Init/pdf_sec.ps


2018-08-28 09:55:48 +0100
Chris Liddell <chris.liddell@artifex.com>
5b5536fa88a9e885032bc0df3852c3439399a5c0

Remove gssetresolution/gsgetresolution

These are non-standard, and never used, so remove them.

Also rejig gsgetdeviceprop, rename to .gsgetdeviceprop and undefine it after
it's used.

For the only other use of gsgetdeviceprop, replace with a special_op call.

Resource/Init/gs_init.ps
Resource/Init/gs_setpd.ps


2018-08-28 07:52:18 +0100
Chris Liddell <chris.liddell@artifex.com>
c9b362ba908ca4b1d7c72663a33229588012d7d9

Bug 699670: disallow copying of the epo device

The erasepage optimisation (epo) subclass device shouldn't be allowed to be
copied because the subclass private data, child and parent pointers end up
being shared between the original device and the copy.

Add an epo_finish_copydevice which NULLs the three offending pointers, and
then communicates to the caller that copying is not allowed.

This also exposed a separate issue with the stype for subclasses devices.
Devices are, I think, unique in having two stype objects associated with them:
the usual one in the memory manager header, and the other stored in the device
structere directly. In order for the stype to be correct, we have to use the
stype for the incoming device, with the ssize of the original device (ssize
should reflect the size of the memory allocation). We correctly did so with the
stype in the device structure, but then used the prototype device's stype to
patch the memory manager stype - meaning the ssize potentially no longer
matched the allocated memory. This caused problems in the garbager where there
is an implicit assumption that the size of a single object clump (c_alone == 1)
is also the size (+ memory manager overheads) of the single object it contains.

The solution is to use the same stype instance to patch the memory manager
data as we do in the device structure (with the correct ssize).

base/gdevdflt.c
base/gdevepo.c


2018-08-27 11:15:16 +0100
Ken Sharp <ken.sharp@artifex.com>
ea735ba37dc0fd5f5622d031830b9a559dec1cc9

Fix error condition for SC and CS

The SC and CS PDF operators correctly checked the return code from the
underlying setcolor and setcolorspace code, but we had already
set up the exec stack for handling a non-error return.

We have to do this before calling the underlying code, as that also
uses a state machine, and alters the exec stack. We must push our
own execution context first.

Ordinarily this isn't a problem, but if we have a custom error handler
which doesn't stop the interpreter, then we would continue on to try
and use what we'd pushed onto the exec stack, with predictably dire
results.

Here we avoid this by saving the exec stack pointer on entry, and if
an error occurs, restoring back to that point before returning control
to the PostScript interpreter.

A minor point, but we now also reset the space/color on an error as
well, previously it would have been left with the wrong space set.

psi/zcolor.c


2018-08-25 07:45:45 +0100
Chris Liddell <chris.liddell@artifex.com>
79cccf641486a6595c43f1de1cd7ade696020a31

Bug 699654(2): preserve LockSafetyParams in the nulldevice

The nulldevice does not necessarily use the normal setpagedevice machinery,
but can be set using the nulldevice operator. In which case, we don't preserve
the settings from the original device (in the way setpagedevice does).

Since nulldevice does nothing, this is not generally a problem, but in the case
of LockSafetyParams it *is* important when we restore back to the original
device, when LockSafetyParams not being set is "preserved" into the post-
restore configuration.

We have to initialise the value to false because the nulldevice is used during
initialisation (before any other device exists), and *must* be writable for
that.

base/gsdevice.c


2018-08-24 18:17:50 +0100
Chris Liddell <chris.liddell@artifex.com>
e5b46839994ec093251bb641fb7cbffe81712e40

Fix a typo in a dependency

psi/int.mak


2018-08-24 09:26:04 +0100
Chris Liddell <chris.liddell@artifex.com>
5516c614dc33662a2afdc377159f70218e67bde5

Improve restore robustness

Prompted by looking at Bug 699654:

There are two variants of the restore operator in Ghostscript: one is Level 1
(restoring VM), the other is Level 2+ (adding page device restoring to the
Level operator).

This was implemented by the Level 2+ version restoring the device in the
graphics state, then calling the Level 1 implementation to handle actually
restoring the VM state.

The problem was that the operand checking, and sanity of the save object was
only done by the Level 1 variant, thus meaning an invalid save object could
leave a (Level 2+) restore partially complete - with the page device part
restored, but not VM, and the page device not configured.

To solve that, this commit splits the operand and sanity checking, and the
core of the restore operation into separate functions, so the relevant
operators can validate the operand *before* taking any further action. That
reduces the chances of an invalid restore leaving the interpreter in an
unknown state.

If an error occurs during the actual VM restore it is essentially fatal, and the
interpreter cannot continue, but as an extra surety for security, in the event
of such an error, we'll explicitly preserve the LockSafetyParams of the device,
rather than rely on the post-restore device configuration (which won't happen
in the event of an error).

psi/int.mak
psi/isave.h
psi/zdevice2.c
psi/zvmem.c


2018-08-24 12:59:45 +0100
Ken Sharp <ken.sharp@artifex.com>
b0a3854751363657998d4c9bd33c290bf9d07c67

Improve PDF operator hiding

Firstly, hide the .setdistillerparams operator, if we try to use this
with a device which doesn't accept distiller params it could cause
problems. The setdistillerparams operator checks the device before
calling .setdistillerparams. This change is needed in *both*
pdf_main.ps and gs_init.ps (see next)

Secondly, fix the code for hiding PDF operators, when DELAYBIND is
true. We can't undefine the operators in pdf_main.ps if DELAYBIND
is true, because the procedures using them won't have been bound yet.
So we duplicate the code for removing the operators in gs_init.ps
and call that during .bindnow, after all the deferred binding has been
completed.

Previously the code for hiding the PDF and PostScript operators had been
left commented out, meaning that if a user chose DELAYBIND (which is
itself a massive security hole) then this minor layer of security
would not have been activated.

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


2018-08-24 12:44:26 +0100
Ken Sharp <ken.sharp@artifex.com>
e01e77a36cbb2e0277bc3a63852244bec41be0f6

Hide the .shfill operator

Commit 0b6cd1918e1ec4ffd087400a754a845180a4522b was supposed to make
the .shfill operator unobtainable, but I accidentally left a comment
in the line doing so.

Fix it here, without this the operator can still be exploited.

Resource/Init/gs_init.ps


2018-08-23 15:42:02 +0100
Ken Sharp <ken.sharp@artifex.com>
8e9ce5016db968b40e4ec255a3005f2786cce45f

Bug 699665 "memory corruption in aesdecode"

The specimen file calls aesdecode without specifying the key to be
used, though it does manage to do enough work with the PDF interpreter
routines to get access to aesdecode (which isn't normally available).

This causes us to read uninitialised memory, which can (and often does)
lead to a segmentation fault.

In this commit we set the key to NULL explicitly during intialisation
and then check it before we read it. If its NULL we just return.

It seems bizarre that we don't return error codes, we should probably
look into that at some point, but this prevents the code trying to
read uninitialised memory.

base/aes.c
base/saes.c


2018-08-23 15:41:18 +0100
Chris Liddell <chris.liddell@artifex.com>
241d91112771a6104de10b3948c3f350d6690c1d

Bug 699664: Ensure the correct is in place before cleanup

If the PS job replaces the device and leaves that graphics state in place, we
wouldn't cleanup the default device in the normal way, but rely on the garbage
collector.

This works (but isn't ideal), *except* when the job replaces the device with
the null device (using the nulldevice operator) - this means that
.uninstallpagedevice doesn't replace the existing device with the nulldevice
(since it is already installed), the device from the graphics ends up being
freed - and as it is the nulldevice, which we rely on, memory corruption
and a segfault can happen.

We avoid this by checking if the current device is the nulldevice, and if so,
restoring it away, before continuing with the device cleanup.

psi/imain.c


2018-08-23 14:13:25 +0100
Chris Liddell <chris.liddell@artifex.com>
c432131c3fdb2143e148e8ba88555f7f7a63b25e

Bug 699661: Avoid sharing pointers between pdf14 compositors

If a copdevice is triggered when the pdf14 compositor is the device, we make
a copy of the device, then throw an error because, by default we're only allowed
to copy the device prototype - then freeing it calls the finalize, which frees
several pointers shared with the parent.

Make a pdf14 specific finish_copydevice() which NULLs the relevant pointers,
before, possibly, throwing the same error as the default method.

This also highlighted a problem with reopening the X11 devices, where a custom
error handler could be replaced with itself, meaning it also called itself,
and infifite recursion resulted.

Keep a note of if the handler replacement has been done, and don't do it a
second time.

base/gdevp14.c
devices/gdevxini.c


2018-08-23 14:12:48 +0100
Ken Sharp <ken.sharp@artifex.com>
0b6cd1918e1ec4ffd087400a754a845180a4522b

Fix Bug 699660 "shading_param incomplete type checking"

Its possible to pass a t_struct parameter to .shfill which is not a
shading function built by .buildshading. This could then lead to memory
corruption or a segmentation fault by treating the object passed in
as if it were a shading.

Its non-trivial to check the t_struct, because this function can take
7 different kinds of structures as a parameter. Checking these is
possible, of course, but would add a performance penalty.

However, we can note that we never call .shfill without first calling
.buildshading, and we never call .buildshading without immediately
calling .shfill. So we can treat these as an atomic operation. The
.buildshading function takes all its parameters as PostScript objects
and validates them, so that should be safe.

This allows us to 'hide' the .shfill operator preventing the possibility
of passing an invalid parameter.

Resource/Init/gs_init.ps
Resource/Init/gs_ll3.ps
Resource/Init/pdf_draw.ps


2018-08-23 12:20:56 +0100
Chris Liddell <chris.liddell@artifex.com>
b575e1ec42cc86f6a58c603f2a88fcc2af699cc8

Bug 699668: handle stack overflow during error handling

When handling a Postscript error, we push the object throwing the error onto
the operand stack for the error handling procedure to access - we were not
checking the available stack before doing so, thus causing a crash.

Basically, if we get a stack overflow when already handling an error, we're out
of options, return to the caller with a fatal error.

psi/interp.c


2018-08-23 09:30:56 +0100
Chris Liddell <chris.liddell@artifex.com>
d224b4abec1d0bd991028b7e38e95d47b7a834f4

Bug 699623: ICC profile creation file permissions check

The original fix missed the initial branch with an explicitly specified
directory.

This also uncovered problems with device profile reference counting, where
if profile creation failed we'd leave a pointer to the original profile
in place - either a dangling pointer, or leaving the ref count wrong.

To solve this, we NULL the relevant profile pointer in the device after
adjusting the reference count.

base/gsicc_manage.c


2018-08-23 09:54:59 +0100
Chris Liddell <chris.liddell@artifex.com>
78911a01b67d590b4a91afac2e8417360b934156

Bug 699654: Check the restore operand type

The primary function that implements restore correctly checked its parameter,
but a function that does some preliminary work for the restore (gstate and
device handling) did not check.

So, even though the restore correctly errored out, it left things partially done
and, in particular, the device in partially restored state. Meaning the
LockSafetyParams was not correctly set.

psi/zdevice2.c


2018-08-21 20:36:52 +0100
Chris Liddell <chris.liddell@artifex.com>
0edd3d6c634a577db261615a9dc2719bca7f6e01

Bug 699659: Don't just assume an object is a t_(a)struct

psi/ztype.c


2018-08-21 20:17:51 +0100
Chris Liddell <chris.liddell@artifex.com>
a054156d425b4dbdaaa9fda4b5f1182b27598c2b

Bug 699658: Fix handling of pre-SAFER opened files.

Temp files opened for writing before SAFER is engaged are not subject to the
SAFER restrictions - that is handled by recording in a dictionary, and
checking that as part of the permissions checks.

By adding a custom error handler for invalidaccess, that allowed the filename
to be added to the dictionary (despite the attempted open throwing the error)
thus meaning subsequent accesses were erroneously permitted.

Resource/Init/gs_init.ps


2018-08-21 20:17:05 +0100
Chris Liddell <chris.liddell@artifex.com>
0d3901189f245232f0161addf215d7268c4d05a3

Bug 699657: properly apply file permissions to .tempfile

psi/zfile.c


2018-08-21 16:42:45 +0100
Chris Liddell <chris.liddell@artifex.com>
c3476dde7743761a4e1d39a631716199b696b880

Bug 699656: Handle LockDistillerParams not being a boolean

This caused a function call commented as "Can't fail" to fail, and resulted
in memory correuption and a segfault.

devices/vector/gdevpdfp.c
psi/iparam.c


2018-08-21 16:24:05 +0100
Chris Liddell <chris.liddell@artifex.com>
b326a71659b7837d3acde954b18bda1a6f5e9498

Bug 699655: Properly check the return value....

...when getting a value from a dictionary

psi/zcolor.c


2018-08-15 16:24:11 +0100
Chris Liddell <chris.liddell@artifex.com>
f25045e88de674a1202c1239565ee99e9ddabe91

Fix missing dependency declaration for gdevoflt.h

base/lib.mak


2018-08-20 15:18:27 +0100
Chris Liddell <chris.liddell@artifex.com>
50ef2aa8c28f0eb097b8dab3effbe6b1c3948879

Fix "ignored return code" Coverity errors.

Several places in pl_main_process_options(), we were ignoring return codes -
particularly, cases where a genuine error is possible.

Rather than handle each error case automatically, drop out of the switch,
and catch the error before jumping to the top of the while loop.

For consistency, ignore the error triggered by -dBATCH

pcl/pl/plmain.c


2018-08-20 19:03:26 +0100
Ken Sharp <ken.sharp@artifex.com>
678261f0d973badfc4609e9e7b27a1d039609ebb

PostScrip ICC spaces - fix minor memory leak

psi/zicc.c


2018-08-18 17:12:46 +0100
Ken Sharp <ken.sharp@artifex.com>
4ade82d9471971937ff3bcb39823cb080a18c2d5

Fix a minor compiler warning

devices/gdevdsp.c


2018-08-18 10:44:52 +0100
Ken Sharp <ken.sharp@artifex.com>
6b1106c232bb18366c527f9da54715ac79165317

Fix display device (some more) with subclassing

Because the display device isn't based off one of the standard devices
we need to do extra work with it to ensure it behaves well with the
subclassing device code.

Commit 1203adc8bbcb60f0e4145300aac44f1988b7c2de contained some of this
work, but unfortunately it had an oversight, it didn't update the
parent (subclassing) devices when the device parameters changed.

This led to it using the wrong width for the raster, if the media
size changed after initialisation.

devices/gdevdsp.c


2018-08-15 13:44:53 -0600
Henry Stiles <henry.stiles@artifex.com>
c265ee6563a1a65d225c4255d95d7306a21c3146

Token buffer not freed.

Unrecognized PJL settings resulted in a memory leak of the token
buffer.

pcl/pl/pjparse.c


2018-08-15 10:45:50 -0700
Nancy Durgin <nancy.durgin@artifex.com>
fa9b0f51a5fbac1bdabef012cc5b0ca006c2c281

Fix compiler warning

base/gdevepo.c


2018-08-15 14:10:55 +0100
Chris Liddell <chris.liddell@artifex.com>
7ab21af0b0c70707aefb1083505136ff7862d337

Bug 699638(3): Fix param list key handling in pl_main_process_options()

param lists can be configured to handle keys in two ways: persistent keys, or
transient keys. For persistent keys, the param list contains a reference to the
key string, and does no management of the string memory.

Configured for transient key strings, the param list makes a copy of the string
and the string memory is managed along with the parameter list itself.

The two approaches cannot be mixed in the same param list.

The pl_main_process_options() code configures the param list to use transient
key strings (which is the default). But it was then copying the key strings,
before passing them to the param list API, and taking no action to manage
the string memory - causing memory leaks.

Since the param list (as configured) takes a copy of the key string, there's no
call for the calling code to do so, and not doing the local string copy
prevents leaking memory.

pcl/pl/plmain.c


2018-08-15 09:30:09 +0100
Chris Liddell <chris.liddell@artifex.com>
1ff8b85ae28c7813aa484dd8f1779f4a4d0742af

Bug 699638(2): correct reference counts in gs_initgraphics

In gs_initgraphics(), when we create new color spaces for the graphics state
the color space is created with a reference count of 1, we then call
gs_setcolorspace() which attaches the color space to the gstate and increments
the reference count - we then drop the "local" reference, leaving a
reference count of 2, but only a single reference to the color space (the one
in the graphics state). Meaning the memory leaks.

So, decrement the reference count for the local reference, before dropping the
local reference.

base/gsstate.c


2018-08-15 08:37:38 +0100
Chris Liddell <chris.liddell@artifex.com>
854f14096c0c6467068701ad19c4c775374e1ce4

Bug 699638(1): Clean up before early exit in gx_image_cached_char()

If we end up using the imagemask method to render a cached glyph, we can drop
out early if the glyph is outside the current clip. Previously, the function
simply returned at that point, leaking memory.

Now it falls through to the cleanup and normal return, no longer leaking.

base/gxccache.c


2018-08-14 10:01:08 -0700
Nancy Durgin <nancy.durgin@artifex.com>
1fe06b350370a51d1bcccde37f8daf13af803d3c

Change the debugging in epo to use the gs_debug stuff

I am using 3 flags -- epo-details, epo-install-only, epo-disable.

Can also call "epo_disable(1)" during a gdb session to turn on/off
during the session.

base/gdbflags.h
base/gdevepo.c


2018-08-09 07:56:51 -0700
Nancy Durgin <nancy.durgin@artifex.com>
df188f54f3e3eed5f12b921440ac7d29970aba35

Bug 690131: Add epo subclass device to do erasepage optimization.

This optimization only works for devices that have a fillpage
implementation that is "gx_default_fillpage". For other devices the
subclass device will not be installed. If the device transitions to
clist (or any other non-gx_default_fillpage device), we will stop
doing the optimization.

The optimization basically swallows(defers) all fillpages, remembering
the color (which is probably always white, but it will work with any
"pure" color). Then when the first actual marking operation happens,
we do a fill_rectangle operation with the remembered color.

base/gdevepo.c
base/gdevepo.h
base/gspaint.c
base/lib.mak


2018-08-09 11:25:57 +0100
Ken Sharp <ken.sharp@artifex.com>
428c05bf7168df79721f9bf3c574ccd9e1294e7e

Fix a couple of compiler warnings

Part of the subclassing updates.

devices/vector/gdevpdfo.c


2018-08-09 11:25:57 +0100
Ken Sharp <ken.sharp@artifex.com>
55cb739c1134882c6abaca6264a8d8bccf24dedf

Fix a couple of compiler warnings

Part of the subclassing updates.

devices/gdevdsp.c
devices/vector/gdevpdfo.c


2018-07-31 16:36:28 +0100
Ken Sharp <ken.sharp@artifex.com>
5f8ac1413077051fd0f559b7b2d5f36b10d58bfe

Device Subclassing - fix memory leak of the 'stype' device member

This is all horribly crufty and really not possible to explain.

With the addition of the custom finalize() for subclassing devices we
sorted this out for the case where all the devices were garbage
collected (the GC, the custom finalize and the device finalize take
care of all the wrinkles here).

But for unsubclassing we cannot use the finalize() routine for the
original device when freeing the child. For most devices this does
actually work, but if the device itself has a custom finalize method
(rare, but see psdcmyk) then if we allow the finalize routine to run
it might (and in the case of psdcmyk does) free memory which is still
being pointed at by the parent (original) device structure.

So we need to NULL the finalize routine in the stype structure, tell
the memory manager to use the newly modified structure, then free the
child device memory and finally free the stype structure.

We also need to properly handle the reference counts of the icc_struct
and PagesList objects, but we had done that already in previous commits.

For safety, set the parent and child pointers to NULL and set the child
device structure reference count to 0 to ensure it is not retained.

Finally; there was a minor error when patching back the memory manager
'stype' copy in the parent device, fix that now too.

base/gdevdflt.c


2018-07-27 12:17:32 +0100
Ken Sharp <ken.sharp@artifex.com>
1203adc8bbcb60f0e4145300aac44f1988b7c2de

Device subclassing - synchronise devices on put_params

Commit 434fb65601b91e14fe4f846dcbb92a68d939faf9 on the erasepage
branch fixed the initial problem, but was not a sufficient solution.

While it seems correct to update the 'target' of the clist so that it
points to the head of the subclassing chain, we can run into problems
using that device, if its parameters (eg width and height) do not
match the ultimate device.

This can happen if we get a put_params() which alters the device
parameters. Although we update the chain after the put_params has
completed, gdevprn-derived devices will reallocate memory or
re-initialise the clist *during* the course of the put_params. If we
don't resynchronise the chain but do update the clist target, then the
clist re-initialisation will be using the wrong parameters.

base/gdevprn.c


2018-07-26 17:39:40 +0100
Ken Sharp <ken.sharp@artifex.com>
9cb7fbd8ca2f2dee6652d832c76da16b85a5f730

Device Subclassing - fix memory leaks with child device

We should not patch out the finalize routine (now that we have a custom
one), that prevents the child device finalize being run, leading to
memory leaks with ICC profiles.

Also, now we have a finalize routine, we need to free the child device
if there is one present. The child device's own finalize routine will
clean everything up.

base/gdevdflt.c
base/gdevsclass.c


2018-07-26 16:03:30 +0100
Ken Sharp <ken.sharp@artifex.com>
12a188d18097e2161f3d653b677e55f558d57faf

Device Subclassing - add a finalize routine for subclassing devices

After some research its clear that subclassing devices do actually need
their own specific finalize routine, borrowing the device finalize
leads to problems.

So here we define a default version. All subclassing devices should
either use this routine, or implement their own of the allocate additional
memory. In that case the specific finalize routine should clean up its
own memory and then call the default one.

Add default subclassing finalize to system devices

base/gdevflp.c
base/gdevmplt.c
base/gdevoflt.c
base/gdevsclass.c
base/gdevsclass.h


2018-07-17 12:45:20 +0100
Ken Sharp <ken.sharp@artifex.com>
ae5fddd0bd7b06215235090470d3f9297faa24bb

Subclassing - correct reference counts on ICC profiles

We weren't previously reference counting the profile structure, this
wasn't a problem until pdfwrite started honouring /ProcessColorModel
requests in setpagedevice, which could lead to the ICC profile
structure altering between the device being subclassed, and the
device being unsubclassed.

base/gdevdflt.c


2018-07-17 10:08:33 +0100
Ken Sharp <ken.sharp@artifex.com>
2642d19883e4c008f999f2872cc0a37b2268634e

Fix the display device with subclassing devices

When the display device is chosen, the executable calls display_set_callbacks
on the current device. That code then sets a member in the current
device, *without* checking the device is actually the display device.

It does this *before* opening the device....

This is a quick hack to resolve the problem by descending to the bottom
child device if there is a chain of devices in place. We should really
check the device name at each step.

In addition the Windows display device keeps a pointer to the device along
with each 'image'. Not sure why, but it breaks if we are using device
subclassing, because the device can change.

Finally; the code doesn't cope with being unable to find a matching
image with the same device. It sets the 'img' to NULL and then goes ahead
and tries to use it anyway. Fix that at the same time so we don't crash!

devices/gdevdsp.c
psi/dwmain.c
psi/idisp.c


2018-07-16 16:02:26 +0100
Ken Sharp <ken.sharp@artifex.com>
8c0d309e74526e0eb5152af05067a9b0a53892c7

pdfwrite - fix stored device pointers in streams, when subclassing

Yet more evidence of nasty hackery in pdfwrite. It stores a copy of the
device pointer in the pdf stream_state. Of course, if we had a
subclassed device when we created the stream, and unsubclassed it before
we closed the (eg if we create a high level pattern before the first
marking operation) then the stored pointer was pointing at the wrong
(child, freed) device.

Just do some pointer traversal to make sure we store the top level one
and use the bottom level one when we need it.

devices/vector/gdevpdfo.c
devices/vector/gdevpsds.c


2018-07-16 15:58:35 +0100
Ken Sharp <ken.sharp@artifex.com>
40b7e425f7ba239e4639baf3feb9d54ebbb85957

device subclassing - solve several problems with short-lived subclassing

Nancy's new erasepage optimisation code revealed some interesting
wrinkles in the subclassing code, Firstly;

If we did a save, then inserted a subclassing device, then a restore
we would get a segmentation fault.

This is because when we subclass a device, we make a new copy of the
original device. This device is, of course, created inside the current
save context. When we restore, that restores away the copied device
with the result that the 'child' pointer of the original device is now
pointing at garbage memory.

Fix this by using 'stable' memory instead of immovable memory. Stable
memory is unaffected by save and restore.

This means we also need to 'null' the members of the copied child when
we 'unsubclass' the device. Otherwise garbage collection may end up
trying to enumerate the pointers in the freed device.

Following on from that, when we get a create_compositor call in the
subclassing code we do a dance whereby we patch the method in the
compositor handler that gets pushed, so that it points to the subclass
device, not the device's ultimate child. Of course, when we unsubclass
the device, we need to unpatch the compositor as well.

That one may need more work.

Finally (for now) we weren't properly handling the parent and child
pointers for the list when we removed a device from the middle of a
chain. The doubly-linked pointers weren't being properly updated.

base/gdevdflt.c


2018-07-14 10:22:45 +0100
Ken Sharp <ken.sharp@artifex.com>
39e8e61d79488909b7645ecc31563ce15aa05702

Fix subclassing and page buffer reallocation in prn devices

It is possible for us to need to reallocate the page buffer for a
device if (or example) a setpagedevice call results in changed width
or height of the media.

When we do that, if we need to change to (or re-initialise) a clist
then we set the clist 'target' member to be the 'current' device. That
doesn't mean the current device in the graphics state though, if
we have subclassed the device then we will have passed the params
request down the chain, so the rendering device is not the current
device in the gstate.

We need the target of the clist to be the subclassing device, ie the
one in the graphics state, not the 'current' one. Otherwise if we
were to unsubclass the device, then the clist would be pointing at a
device which was freed.

There's no good way to do this from the subclassing code itself, so
I have (reluctantly) modified gdevprn.c to handle this. Any devices
which don't derive from gdevprn, and use the clist, will need to handle
this case themselves.

base/gdevprn.c


2018-07-14 10:15:34 +0100
Ken Sharp <ken.sharp@artifex.com>
8eb6643606556921bbbbf495825470cd75123874

subclassing devices - fix clist patching on unsubclass

When removing a subclassing device from the chain, if we have patched
the clist create_compositor method, then we need to restore it,
otherwise it will continue to point to the (now vanished) subnclassing
device's method.

base/gdevdflt.c
base/gdevsclass.c
base/gxdevice.h


2018-08-09 11:55:54 +0100
Chris Liddell <chris.liddell@artifex.com>
88c54234ef0565e54de8b2378907ca201f348b4b

Update "Font lookup" description

The FONTPATH section did not explicitly state the search includes descendants
of the directories listed in FONTPATH.

Possibly this is because filenameforall (with which the search is implemented)
did not recurse into subdirectories when the FONTPATH feature was originally
added, but filenameforall now does (as it is supposed to), so the docs should
reflect that.

doc/Use.htm


2018-08-06 11:31:11 +0100
Ken Sharp <ken.sharp@artifex.com>
398fd3742abf40cd1c4b94273e81755bdcb5e88f

PDF interpreter remove debug code

Accidentally left a 'pstack' in the last commit

Resource/Init/pdf_draw.ps


2018-08-06 11:23:00 +0100
Ken Sharp <ken.sharp@artifex.com>
17d6b5fd47e161b8a0bfd23e7a4214b16acd07dd

PDF interpreter - resurrect Link handling improvements

commit 61f53ab8f9e586c8722ccd0ea7de3722b0d40cd2 removed the duplication
of /Link and /Text annotation handling, and used the newer code for
handling these instead.

It transpires that the /Link handling in the old (removed) code was
considerably more functional than that in the newer code...

Here we replace the new code with the old code in order to get the same
functionality, but with the proper controls in place, and only handling
annotations in one place instead of 2.

Resource/Init/pdf_draw.ps


2018-08-06 09:37:32 +0100
Ken Sharp <ken.sharp@artifex.com>
61f53ab8f9e586c8722ccd0ea7de3722b0d40cd2

PDF interpreter - Remove old annotation handling for pdfwrite

Bug #699619 "Annotations included twice with pdfwrite"

At some point in the past we handled a very few annotations with
pdfwrite and did so in the pdfshowpage_finish routine. Since then we
have moved the handling of annotations for pdfwrite into the
showpagecontents routine, along with regular annotation rendering.

But leaving the old code in place meant that some annotations (/Link
and /Text) were being processed twice (for pdfwrite). Additionally
the old code didn't honour the ShowAnnots or PreserveAnnots controls.

Just remove the old code.

Resource/Init/pdf_main.ps


2018-08-03 21:36:26 +0800
Sebastian Rasmussen <sebras@gmail.com>
1c12d01a2fb48e5fc69f46318348a4ad641be131

Revert accidentally pushed "WIP: gitignore"

This reverts commit 3f6507e834e92d9f5fc07ec8e91509a54ce9ec6d.

.gitignore
jbig2dec/.gitignore


2018-08-03 10:48:55 +0100
Ken Sharp <ken.sharp@artifex.com>
3bf4f3ea45f0022b6cd36415f095f1bfc119fb73

pdfwrite - improve further the glyph bounding box calculation

Bug #699571 "Missing characters when convert eps to pdf. Ok when convert to png."

When deciding whether to include a text string in the output PDF file
we compare the bounding box of the string with the bounding box of the
current clip path. If the string bbox is not at least partially within
the clip, then we don't emit it.

To do this we previously used the font's FontBBox in order to estimate
the size of each glyph in the string.

Commit 6a4202691c4317a698fa23c5309ad8974fe2b003 fixed a bug where the
font has a wildly incorrect FontBBox leading to us deciding that the
glyph was outside the clip area.

In that commit Chris Liddell noted that using the 'real' glyph bounding
box would require executing the complete CharString which has
performance implications.

Unfortunately this latest bug has forced us into this course. The EPS
file draws the same glyph multiple times, clipping portions of it each
time. Sometimes it uses charpath/fill to render the clipped portion, and
sometimes it uses an xyshow where the advance in both directions is 0.
At the same time, the font has a completely inaccurate FontBBox.

Because the advance width is 0 the previous fix does not address this
situation. The FontBBox is so inaccurate that most of the times the
glyph is rendered it is deemed to be outside the clip.

The only remaining solution is to determine the *actual* Bounding Box
of the glyph, which means we have to execute the glyph description.

This does result in some degradation in performance.

devices/vector/gdevpdte.c


2018-08-03 10:40:44 +0100
Ken Sharp <ken.sharp@artifex.com>
3cbfb32d83f8910a9aeae805542c805eba584e34

TrueType interpreter - set the TrueType rendering routine

Ensure the GS TTF interpreter is associated with a TTF font before attempting
to retrieve the glyph bounding box. We have to eplicitly NULL the FAPI entry
before doing so because, for normal rendering, we'll use the FAPI/Freetype API
(in this case, we want to avoid rendering the glyph)

Fix supplied by Chris Liddell

base/gstype42.c


2018-05-26 19:11:58 +0800
Sebastian Rasmussen <sebras@gmail.com>
3f6507e834e92d9f5fc07ec8e91509a54ce9ec6d

WIP: gitignore

.gitignore
jbig2dec/.gitignore


2018-08-03 19:14:15 +0800
Sebastian Rasmussen <sebras@gmail.com>
8c7d55b8f5b1248bf120ed312538bd824ba5ad9f

jbig2dec: Avoid accessing symbol bitmap width if it is missing.

jbig2dec/jbig2_text.c


2018-08-03 19:11:02 +0800
Sebastian Rasmussen <sebras@gmail.com>
06d82c1d8b0c625f5bb8db8acd7113ff0b8179d8

jbig2dec: Prevent underflow when checking if enough data for bitmap.

When decoding the symbol dictionary the bitmap size field
determines the size of the bitmap. The bitmap size is however
restricted to the size of the segment's data region. This was
checked previously, but the check itself may underflow, so
another check was introduced to prevent this from happening.

jbig2dec/jbig2_symbol_dict.c


2018-08-03 19:10:09 +0800
Sebastian Rasmussen <sebras@gmail.com>
d20a98cb7d3e10a68c7d288318f216db70db610c

jbig2dec: When reading past the end of a word stream, return 0.

Previously the returned value would be uninitialized, leading
to issues detected by valgrind later on in the parsing.

jbig2dec/jbig2.c


2018-08-03 12:28:23 +0800
Sebastian Rasmussen <sebras@gmail.com>
105f72c232121b12ec2b53bc76c66dd8cf821a78

jbig2dec: Initialize entire page structure upon allocation.

Without this uninitialized values in the page structure will be
used when parsing segments. An example of this is in
jbig2_immediate_generic_region() when a the height of the page is
used to determine if the region is outside of the page.

jbig2dec/jbig2.c


2018-04-26 01:48:05 +0800
Sebastian Rasmussen <sebras@gmail.com>
163d0687c8c6bcfbff9e2ebae634530de0c3ebce

jbig2dec: Explanation of (un)optimized generic region decoder.

Previously it was difficult to understand the magic values used in the
optimized generic region decoder, and also whether the order of pixels
in the context in the unoptimized decoder were important. This new
explanation attempts to rectify these issues.

jbig2dec/jbig2_generic.c


2018-07-24 01:00:18 +0800
Sebastian Rasmussen <sebras@gmail.com>
e115b9b367645f85b42c5c7922b84af6fad7a907

jbig2dec: Print warning messages even for non-debug builds.

This is useful because jbig2dec emits warnings when it encounters
broken files it is able to cope with, e.g. referrals to symbols
outside the symbol dictionary are ignored but a warning is
emitted. Ghostscript ought to output warnings in these cases so
that users know that the final render might not be the intended
one because the input file is broken.

base/sjbig2.c


2018-07-01 17:26:21 +0800
Sebastian Rasmussen <sebras@gmail.com>
2db336dc75bf710bcf327545c61f2d215332ce99

jbig2dec: Read region segment height/width/x/y as unsigned.

The specification in 5.4.4 states that numbers are unsigned unless
otherwise stated. 7.4.1.1 through 7.4.1.4 specifying the region segment
height, width, x and y do not mention that these fields are signed,
hence they ought to read and handled as unsigned.

jbig2dec/jbig2_generic.c
jbig2dec/jbig2_halftone.c
jbig2dec/jbig2_page.c
jbig2dec/jbig2_page.h
jbig2dec/jbig2_refinement.c
jbig2dec/jbig2_segment.c
jbig2dec/jbig2_segment.h


2018-07-08 14:10:09 +0800
Sebastian Rasmussen <sebras@gmail.com>
fd551bc0e40d2220b4343aeeefa7d9d3a64140eb

jbig2dec: Use accurate references to the specification.

jbig2dec/jbig2_halftone.c
jbig2dec/jbig2_halftone.h


2018-07-31 19:32:00 +0800
Sebastian Rasmussen <sebras@gmail.com>
ab862e07f1a804d5cf55548e73c0128673070e17

jbig2dec: Support up to 16 bit gray-scale image for halftoning.

Without this commit if jbig2dec is fed a fuzzed bitstream where
HBPP ends up larger than 8, jbig2dec will access bits outside of
each 8 bit sample in GSVALS.

HBPP is in Table 22 in 6.6.4 defined to be 32 bits unsigned. The
specification in C.2 limits GSBPP to 6 bits unsigned, a maximum
value of 63, i.e. a gray-scale image with 63 bits per sample.
According to table 23 in 6.6.5 HBPP is assigned to GSBPP, so any
value larger than 63 would be out of spec.

A non-fuzzed bitstream that has HBPP larger than 9 is yet to be
encountered. So for the time being use uint16_t the GSVALS and
limit HBPP to 16. If a file with HBPP larger than 16 is ever
encountered, the type and limit needs to be revisited.

jbig2dec/jbig2_halftone.c


2018-07-09 00:42:51 +0800
Sebastian Rasmussen <sebras@gmail.com>
907b9dff401154cdf5a4716e4f067bdf3a45de27

jbig2dec: Use corresponding stride for gray-scale bitplane.

All bitplanes have the same stride, but this change makes it obvious
that we will not overwrite any boundaries (i.e. use the stride of the
bitplane in question, not the stride for another bitplane).

jbig2dec/jbig2_halftone.c


2018-07-08 22:05:57 +0800
Sebastian Rasmussen <sebras@gmail.com>
7f4cd0ad4c0d8636141de50bb6eb76b17e574eb5

jbig2dec: Fix accidental typo in context size function.

jbig2dec/jbig2_generic.c


2018-07-04 03:03:17 +0800
Sebastian Rasmussen <sebras@gmail.com>
2bc62e131fb14d22e7f4e0701a190b1cf50e9792

jbig2dec: Ignore negative pixel runs in MMR decoder.

Previously these were fatal errors, now warn and continue.

jbig2dec/jbig2_mmr.c


2018-07-03 00:36:40 +0800
Sebastian Rasmussen <sebras@gmail.com>
9bff24e265f40fca19926f2a44390d1ac543e309

jbig2dec: Ignore missing glyphs when rendering text region.

jbig2dec/jbig2_text.c


2018-05-28 22:46:16 +0800
Sebastian Rasmussen <sebras@gmail.com>
052910bb5f16adaa0bc28fb2e8c7aeb562e0e7cb

jbig2dec: Rephrase jbig2_error() messages.

* Do not prefix messages with "jbig2 error:", this ought to be
done by the error callback itself.
* Avoid using function names in messages as they mean nothing to
the end user.
* Avoid contractions in messages.
* Try to adhere to "failed to" pattern as far as possible.
* Messages start with lower case character, unless it refers to
something in the specification.
* Messages do not end with punctuation.

jbig2dec/jbig2.c
jbig2dec/jbig2_arith.c
jbig2dec/jbig2_arith_iaid.c
jbig2dec/jbig2_arith_int.c
jbig2dec/jbig2_generic.c
jbig2dec/jbig2_halftone.c
jbig2dec/jbig2_huffman.c
jbig2dec/jbig2_image.c
jbig2dec/jbig2_image_pbm.c
jbig2dec/jbig2_page.c
jbig2dec/jbig2_refinement.c
jbig2dec/jbig2_segment.c
jbig2dec/jbig2_symbol_dict.c
jbig2dec/jbig2_text.c
jbig2dec/jbig2dec.c


2018-07-03 20:02:04 +0800
Sebastian Rasmussen <sebras@gmail.com>
fdf6a2d9b8a33b04429608c104680d982fb085f5

jbig2dec: Implement support for generic region pixel skipping.

jbig2dec/jbig2_generic.c
jbig2dec/jbig2_generic.h
jbig2dec/jbig2_halftone.c


2018-07-04 12:36:41 +0800
Sebastian Rasmussen <sebras@gmail.com>
c10cd780ace02cdc2a07e9c9e59e4617c0434fc6

jbig2dec: Fix where end row of stripe was only updated locally.

jbig2dec/jbig2_page.c


2018-07-03 03:10:55 +0800
Sebastian Rasmussen <sebras@gmail.com>
90964e633488e2d8e9fa450ebe04ace16ec0d396

jbig2dec: Warn on too many symbols in text region, do not report fatal error.

This condition is already taken care of by not continuing to read symbols,
so attempt to proceed with parsing the image.

jbig2dec/jbig2_text.c


2018-07-02 12:44:31 +0800
Sebastian Rasmussen <sebras@gmail.com>
0073f2a6524c731528e950deb7eac598c819a3da

jbig2dec: Treat unstriped pages with unknown height as striped with max stripe height.

jbig2dec/jbig2_page.c


2018-07-01 17:25:48 +0800
Sebastian Rasmussen <sebras@gmail.com>
3d8b1c3fc85271e075b22627182998ae4cf894d5

jbig2dec: Limit region height to page/stripe height.

Make sure to ignore regions outside of stripe/page.

jbig2dec/jbig2_generic.c
jbig2dec/jbig2_page.c


2018-07-09 01:30:11 +0800
Sebastian Rasmussen <sebras@gmail.com>
f3e4a8978b9577bad31d0f818b206eb65da222d6

jbig2dec: Stripe offsets are absolute, not relative.

jbig2dec/jbig2_page.c


2018-07-30 16:24:28 +0100
Ken Sharp <ken.sharp@artifex.com>
cf964a720496ff8e1c55f0d629bdec91b789faf0

Coverity ID 305953 - uninitialised variable

Also a scan-build warning.

devices/vector/gdevpdtt.c


2018-07-01 00:36:28 +0800
Sebastian Rasmussen <sebras@gmail.com>
e3212ede0590b02ef57f8946ae413ce44ef3658e

jbig2dec: Cap runlength for exported symbols, don't error out.

Capping is necessary because the preceding symbol dictionary segment header
stated that a specific number of symbols will be exported to succeeding symbol
dictionaries. By capping overly long runlengths of exported symbol instead of
reporting fatal errors somewhat corrupt JBIG2 bitstreams may still partially
render, albeit with a warning about the capping taking place.

jbig2dec/jbig2_symbol_dict.c


2018-07-01 13:28:26 +0800
Sebastian Rasmussen <sebras@gmail.com>
bbbb7eff0b63f383e073ec760b2b8a94896d81a1

jbig2dec: Occasional runlengths may be zero, avoid infinite sequence.

Previously any runlength when exporting symbol dictionary symbols
being zero caused a fatal error. These are not disallowed by the
specification, but if there is an infinite sequence of them the
decoder cannot make any progress in establishing the dictionary
of exported symbols from a symbol dictionary. This may happen
when the huffman or arithmetic integer decoder due to e.g. fuzzed
input data returns an infinite sequence of zeroes when the
decoder attempts to read the runlengths. This case of infinite
zero runlengths is best handled as a fatal error. An arbitrary
limit of 1000 of zero runlengths in sequence (an approximation of
an infinite sequence of zero runlengths) will now cause a fatal
error, but the occasional zero runlength will be accepted without
any kind of message.

jbig2dec/jbig2_symbol_dict.c


2018-07-13 14:10:40 +0800
Sebastian Rasmussen <sebras@gmail.com>
55ed0cbe04df585a987ca8ce7b6255e9705646d1

jbig2dec: Advance and limit b1 in MMR decoder in a single location.

Previously this unnecessarily happened multiple times.

jbig2dec/jbig2_mmr.c


2018-07-13 13:39:42 +0800
Sebastian Rasmussen <sebras@gmail.com>
1d22aa82619bfd6e02dd1e4afa019a68ba2f3cca

jbig2dec: Remove check for a0 set before scanline in MMR decoder.

A few lines of code prior if a0 is set before the scanline it is
reset to index 0, so no need to recheck for this condition.

jbig2dec/jbig2_mmr.c


2018-07-13 13:00:06 +0800
Sebastian Rasmussen <sebras@gmail.com>
230dd860b0db9924794570654db3bb162194977e

jbig2dec: Error message in MMR coded data mixed black/white pixel runs.

jbig2dec/jbig2_mmr.c


2018-07-13 12:31:19 +0800
Sebastian Rasmussen <sebras@gmail.com>
7f94da2ccf574524d71a7d6aa2e381893dbacb37

jbig2dec: The MMR runlength tables list error codes, handle those.

Previously these errors led to spurious negative values for runlengths,
which were treated as if these were legal even though they are not.

jbig2dec/jbig2_mmr.c


2018-07-26 11:43:10 +0100
Chris Liddell <chris.liddell@artifex.com>
4b16b3762c1177497633178303665317eae8297e

Bug 699560: Shut down libjpeg encoder in gdevjpeg

Have the jpeg devices correctly shutdown libjpeg and release the encoder
context correctly - solves memory leaks reported by memento.

devices/gdevjpeg.c


2018-07-26 08:28:23 +0100
Ken Sharp <ken.sharp@artifex.com>
2f017502459778cac3c2b8cb2c6df2f52629aae3

pdfwrite - don't retry CharProc capture on error.

Bug #699561 "Infinite loop or Segfault"

The input PostScript file for this case is invalid and throws a
rangecheck error with normal devices.

However when the output device is pdfwrite in the case of *any* error
handling text we fall back to the 'default implementation' which means
we run the glyph description normally, and capture the bitmap into a
type 3 bitmap font.

In the case of this file, however, when we try to use the captured
bitmap we again throw an error. This causes us to run the glyph
description again and capture the bitmap. Of course, that again fails
when we try to use it leading to an infinite loop. But not any simple
loop, it involves exiting the code and re-entering it after capture.

This commit adds a new variable, captured_pte_index. When we complete
a capture, we record the index (the pointer to the input character codes)
from the text enumerator. We then try to process the text as normal. If
we get an error, before falling back to the default implementation, we
test the current text enumerator index. If its the same as the captured
index then we know that it was the captured CharProc threw an error.

In the case of this kind of error we simply return the error, there is
nothing further we can do.

devices/vector/gdevpdtt.c


2018-07-20 11:43:54 +0800
Sebastian Rasmussen <sebras@gmail.com>
d735b5ae0b8fc6573f09aee9b8663612bdde3c9b

jbig2dec: Change overflow check for allocations.

The maximum size of an allocation was previously limited to
(maximum value of size_t)-256 bytes. Use SIZE_MAX instead.

jbig2dec/jbig2.c


2018-06-29 17:47:25 +0800
Sebastian Rasmussen <sebras@gmail.com>
2272769bf1126e20f8458729c334f2134b95e951

jbig2dec: Always complete a page, attempting decode of problematic streams.

When JBIG2 bitstreams contain end of page segments the parser in
jbig2dec calls jbig2_complete_page() to signal that the page is
now finished.

JBIG2 bitstreams created by some producers do not contain end of
page segments but are otherwise well-formed JBIG2 bitstreams.
Embedded JBIG2 bitstreams do not have to contain end of page
segments. jbig2dec previously tried to detect these cases and
simulated an end of page segment by manually calling
jbig2_complete_page() so as to be able to output a displayable
image.

Problematic non-embedded JBIG2 bitstreams that have parse errors
before any end of page segment is reached, or bitstreams where
the end of page segment itself is broken, do not fall into either
of the categories above but may be missing end of page segments.
Previously jbig2dec treated this type of bistreams as not having
any displayable image because the pages were never finished.

To handle all types of bitstreams and attempt to output a
displayable image (possibly partial due to parse errors),
jbig2dec now always calls jbig2_complete_page() function.

jbig2dec/jbig2dec.c


2018-07-13 12:49:36 +0800
Sebastian Rasmussen <sebras@gmail.com>
2483cf3a3467068510a012dc814aa607d6c6a32f

jbig2dec: Limit scanline index in MMR coded data.

According to the T.6 specification the pixel references, e.g. a0,
may point to any of the pixels (indices 0 through N-1) on a
scanline, one pixel to the left of a scanline (index MINUS1) or
one pixel beyond the scanline (index N). These indicies are all
positive (despite its name MINUS1 is defined to UINT32_MAX).

This commit changes the index type from signed to unsigned to
reflect this. Moreover, when looking for changing elements,
make sure to limit the returned index to N.

jbig2dec/jbig2_mmr.c


2018-07-13 12:41:14 +0800
Sebastian Rasmussen <sebras@gmail.com>
e05019b96b7e038d9335e640b83db098022d1e2c

jbig2dec: Handle EOFB whether it is required or not.

Chapter 6.2.6 in the JBIG2 specification states that MMR-encoded
data _may_ skip the EOFB code when the data length is known in
advance. If the data length is _not_ known in advance EOFB is
required. Since an encoder may choose to use or skip EOFB when
the data length is known, decoders must always be prepared to
handle EOFB regardless of whether the data length is known or
unknown.

After encountering EOFB jbig2dec now stops consuming MMR-coded
data regardless of whether the data lenght is known in advance
or not. The remainder of the decoded image region is filled with
white.

jbig2dec/jbig2_mmr.c


2018-05-29 03:09:58 +0800
Sebastian Rasmussen <sebras@gmail.com>
7fade522e9e406b1faedc76e71f86951901633d2

jbig2dec: Limit image size to 2GByte and check for overflow.

The width/height fields of a JBIG2 image are limited by the
specification to UINT32_MAX. This means that the total size of
the image is limited to UINT32_MAX * UINT32_MAX pixels.

jbig2_alloc() take a size argument of type size_t, limiting
allocations to at most SIZE_MAX bytes. For 32 bit systems
SIZE_MAX == UINT32_MAX and for 64 bit systems SIZE_MAX ==
UINT64_MAX.

This means that for 32 bit systems the maximum image size is
limited to UINT32_MAX * 8 pixels. For 64 bit systems it could
conceivably be limited to UINT64_MAX * 8 pixels if all indexing
into the image buffer allocation is 64 bit safe.

However jbig2dec's indexing into the image buffer allocations is
not always 64 bit safe, so limit image allocations to the safe
choice of 2Gbyte. This equates to limiting image sizes to
INT32_MAX * 8 pixels, or a square of 131072 by 131072 pixels.

jbig2dec/jbig2_image.c


2018-06-20 01:38:41 +0800
Sebastian Rasmussen <sebras@gmail.com>
6f06c79a4f0ee664840ce7bedc35dafc921e5086

jbig2dec: Cast BMSIZE in symbol dicts to size_t.

BMSIZE is used to skip over uncompressed symbols in a symbol dictionary.
Therefore this value is inherently unsigned. Also because the value is
a multiplication of the height and stride of an image, both of which are
unsigned 32 bit numbers, rely on the size_t type which is large enough
to handle images this big.

jbig2dec/jbig2_huffman.c
jbig2dec/jbig2_huffman.h
jbig2dec/jbig2_symbol_dict.c
jbig2dec/jbig2_text.c


2018-05-29 02:58:14 +0800
Sebastian Rasmussen <sebras@gmail.com>
c01e08cf984192defb63017e1a11a9f1bf05f9ef

jbig2dec: Remove denial of service check which is no longer needed.

In commit ee0bc20cc98c8e8381003a25dfa0b21e681c6545 an attempt to detect the end
of the arithmetic integer decoder bit stream is detected. Now once more error
handling has been implemented, the files from bug 694949 that caused this end of
bitstream detection code to be added no longer end in an infinite loop, but fail
with fatal errors due to other reasons.

jbig2dec/jbig2_arith.c
jbig2dec/jbig2_symbol_dict.c


2018-07-24 13:35:03 +0100
Ken Sharp <ken.sharp@artifex.com>
160431b50a3154341fa9ef1270ecb6f8ae045b4d

Fix tiffpack and tifflzw devices

Commit 0ef309305417776a9f8b8cd143fbf3c5e89456b2 moved the FillOrder
parameter into the 'generic' tiff fax device structure, and added a new
BlackIs1 parameter.

The macro FAX_DEVICE_BODY was updated to reflect this but unfortunately
two of the devices, tiffpack and tifflzw do not use the FAX_DEVICE_BODY
macro, as they need to use device-specific code for the output_page
device method.

This meant that the initialisation of these devices was incorrect and
led to failures in our automated testing.

devices/gdevtfax.c


2018-07-23 11:54:50 +0100
Chris Liddell <chris.liddell@artifex.com>
da7288fe212f24db7789f9807b9e55a0e4367b8a

gx_cpath_unshare(): zero unset entries.

gx_cpath_unshare() does not copy the clip path list, and leaves the list
structure uninitialized.

Until/Unless we implement copying the list, set the values in the list to
zero/NULL so later freeing of the unshared clip path doesn't trip up.

base/gxcpath.c
base/lib.mak


2018-07-18 16:41:17 +0100
Chris Liddell <chris.liddell@artifex.com>
954d535ee5a63ff751c1af24bbd45adefc2a078c

Bug 699542: Fix compiler/linker options for shared lib on AIX

configure.ac


2018-07-18 16:32:38 +0100
Chris Liddell <chris.liddell@artifex.com>
3afe2983e8e3c5fd9f290d7af0f7469d944a57ec

Bug 699543: handle missing isinf() and fpclassify()

Makefile.in
base/lcms2mt.mak
configure.ac
lcms2mt/src/cmsplugin.c
lcms2mt/src/lcms2_internal.h


2018-07-24 13:03:39 +0100
Ken Sharp <ken.sharp@artifex.com>
f6bcc0dfc173b80fddab4fbf10afb34332ff1112

PDF interpreter - improve handling of 'q' inside a text object

Bug #699551 "Text with rendering mode stroke is not displayed"

We already did deal with a q/Q pair inside a text object (BT/ET pair)
but a couple of points were missed. We didn't check for the existence
of a qTextSavematrix in settextstate, which meant that we didn't
set the text matrix. So vector and image marking worked, but text did
not.

We also didn't check for the existence of a qSaveTextMatrix when handling
the stroke width for a text rendering mode which involves stroking the
text.

This commit exhibits one 'progression' (ie it now matches Acrobat) in
the Quality Logice PDF 2.0 FTS files. I intend to raise this with QL as
the file is demonstrably invalid.

It also adversely impacts the performance of text in PDF files, since we
must now do additional checking on every text operation. This has pushed
a small number of our test files beyond the point where they start to
time out on our automated testing.

Resource/Init/pdf_ops.ps


2018-07-23 13:50:59 -0600
Henry Stiles <henry.stiles@artifex.com>
0ef309305417776a9f8b8cd143fbf3c5e89456b2

Bug 699425, new fax device parameters added.

Two new device parameters specify bit order and black white polarity,
these parameters are the same as found in the tiff fax devices
(gdevtfax.c)

devices/gdevfax.c
devices/gdevfax.h
devices/gdevtfax.c


2018-07-23 11:51:03 -0600
Henry Stiles <henry.stiles@artifex.com>
dca564fc2a95b6610084ad06a939367217aa78e3

Bug #699550 - Fix infinite loop processing PCL file with JPEG image.

The color depth was set to 1 instead of 8 resulting in an ouput buffer
smaller than the filter needed. Also, make sure we process the return
code from the dct stream filter correctly so an error will be handled
properly.

pcl/pxl/pximage.c


2018-07-20 10:46:59 +0100
Ken Sharp <ken.sharp@artifex.com>
285cd8f8ced5b561116190d56e14baabef740ee9

ps2write - add a check for PreserveSeparation

When we check for a /Separation with a Lab alternate, check whether we
should be preserving Separation spaces before going ahead and converting
the alternate space to the ProcessColorModel of the device.

devices/vector/gdevpdfg.c


2018-07-20 10:45:33 +0100
Ken Sharp <ken.sharp@artifex.com>
d0c058c8ef9112f6245e96e3cef81a24e7c9c103

Documentation - Documentation on PreserveSeparation for pdfwrite was missing

doc/VectorDevices.htm


2018-07-20 09:49:44 +0100
Ken Sharp <ken.sharp@artifex.com>
9e58cc8dd7e9b98620c798c901f800aff2e381ce

ps2write - improve handling of Separation colour space with Lab alternate

Bug #699535 "Separation Colors with alternate Color Lab are not converted correctly when device (e)ps2write is used"

We can't embed a Lab space in the output from ps2write with the current
colour handling. So instead spot the condition and convert the
/Separation alternate space into the underlying ProcessColorModel.

This preserves the /Separation ink, though the resulting tint transform
is less than ideal.

At the same time, make sure we don't try to handle the ICC Lab space
as if it were a device space. Instead return a rangecheck error so that
we convert the whole space into the ProcessColorModel.

devices/vector/gdevpdfc.c
devices/vector/gdevpdfg.c


2018-07-19 12:09:02 +0100
Ken Sharp <ken.sharp@artifex.com>
b44096b33d28d25c8f88c9fc2565713d85ca0614

JBIG2DEC - add declarations which are not defined in VS 2005

Like INT32_MAX and INT32_MIN, UINT32_MAX which is defined in stdint.h
is not defined for old versions of Visual Studio. Add simple definitions
in the two source files that use it, if it is not already defined.

jbig2dec/jbig2_generic.c
jbig2dec/jbig2_segment.c


2018-07-01 17:26:37 +0800
Sebastian Rasmussen <sebras@gmail.com>
e7ededef7c8b09845aedae08674519fbf50654b8

jbig2dec: Ignore extension segments that are not marked necessary.

Previously this was a fatal error, but it is better as a warning as
the extension segment has not been marked necessary as outlined in
the specification.

jbig2dec/jbig2_segment.c


2018-07-04 22:23:26 +0800
Sebastian Rasmussen <sebras@gmail.com>
a6fef0ad778e67783204f71a28119a47fe6eb7c7

jbig2dec: Improve halftoning debug message.

jbig2dec/jbig2_halftone.c


2018-07-11 02:40:57 +0800
Sebastian Rasmussen <sebras@gmail.com>
c21d7dfb8cd82f698eb93b0b122a4e01c152faad

jbig2dec: Fix composing subset of image onto destination.

jbig2dec/jbig2_image.c


2018-07-01 13:19:43 +0800
Sebastian Rasmussen <sebras@gmail.com>
f8300fe31d487088e2de195ab0bf3a5725e6806f

jbig2dec: Warn on out of range symbol IDs, but continue.

jbig2dec/jbig2_text.c


2018-07-01 13:18:48 +0800
Sebastian Rasmussen <sebras@gmail.com>
12e9787cd20407b1440edf212d8e7f1c544dc29e

jbig2dec: Use already parsed size of page association field.

jbig2dec/jbig2_segment.c


2018-07-01 13:03:01 +0800
Sebastian Rasmussen <sebras@gmail.com>
72165c941ad4c4134ca593cd744be6b1b5ac1dda

jbig2dec: Handle text regions without symbol dictionaries.

Normal text regions reference symbol dictionaries. The symbols
in those dictionaries are then referenced to by the text region
and placed somewhere on the page. In the degenerate case a text
region might not have any instances of symbols that it wants to
place on the page. If that is the case then there is no need for
the text region to refer to any symbol dictionaries (since it
doesn't need any symbols). Previously this was treated as a fatal
error, but now this just creates a warning and decoding proceeds.

jbig2dec/jbig2_text.c


2018-07-01 13:07:19 +0800
Sebastian Rasmussen <sebras@gmail.com>
de25a4676d82587b8c6d6c6aeca3785514fde1c2

jbig2dec: Attempting to compose NULL on a page is silently accepted.

jbig2dec/jbig2_image.c


2018-07-04 22:19:34 +0800
Sebastian Rasmussen <sebras@gmail.com>
b417ef1deee793f93cc0643e3eccc4a8fea6cf3d

jbig2dec: Make local functions static.

jbig2dec/jbig2_halftone.c
jbig2dec/jbig2_halftone.h


2018-06-29 01:54:15 +0800
Sebastian Rasmussen <sebras@gmail.com>
5158b558038c939c287d3a1194412134a5dc1134

jbig2dec: Handling missing OOB at end of height class.

jbig2dec/jbig2_symbol_dict.c


2018-06-24 16:00:30 +0800
Sebastian Rasmussen <sebras@gmail.com>
fb8347da8e388793a4add8442931dbd5033fce41

jbig2dec: Handle immediate generic regions with unknown height.

jbig2dec/jbig2.c
jbig2dec/jbig2_generic.c
jbig2dec/jbig2_segment.c
jbig2dec/jbig2_segment.h


2018-06-27 02:13:04 +0800
Sebastian Rasmussen <sebras@gmail.com>
29371c6872f9b72e3810d76bd920f41619924fa7

jbig2dec: Print segment number in messages when available.

jbig2dec/jbig2.c
jbig2dec/jbig2_generic.c
jbig2dec/jbig2_mmr.c
jbig2dec/jbig2_refinement.c
jbig2dec/jbig2_segment.c
jbig2dec/jbig2_symbol_dict.c


2018-06-22 21:16:24 +0800
Tor Andersson <tor.andersson@artifex.com>
d469fa3d995c8593680c2425f9c2c5a7a231bac7

jbig2dec: Avoid accessing bytes outside of MMR decoder line.

Previously the file Bug688080.pdf in bug 693798 e.g. has an object 668
containing a JBIG2 bitstream containing an MMR-coded region where the
width of the region is 32 pixels. At one point while decoding this
image, a0 is in the middle of the line and because of the decoded black
and white runs both a1 and a2 end up at the pixel just beyond the end
of the line. At this point jbig2dec would access the byte supposedly
containing this pixel beyond the end of the line, but that is not
allowed. Because this byte was written back unchanged no real harm was
done, but the access was still being performed, triggering software
like valgrind/ASAN that detects buffer overflows.

This commit also reverts the incorrect fix for bug 693798
introduced in commit 46d6b40803cb7a68ceb06b2f71db8cf3f384c2ee
where the allocated image buffer was simply extended by one byte,
thereby accommodating the illegal access.

jbig2dec/jbig2_image.c
jbig2dec/jbig2_mmr.c


2018-07-14 18:19:47 +0800
Sebastian Rasmussen <sebras@gmail.com>
dfa5b1b784b9c575cb9d797248e282871d24625c

jbig2dec: Untie fix for Visual Studio from Microsoft's compiler.

The i32 suffix is specific for MSVC, but can be avoided.
gssprintf.c for APR_INT32_MAX and APR_INT32_MIN also leaves out
the suffix out. This is legal because the default integer literal
size is large enough to fit 32 bit signed integers.

jbig2dec/jbig2_arith_int.c


2018-07-14 10:31:08 +0100
Ken Sharp <ken.sharp@artifex.com>
29363ac25e7f8796e4cd09a7a88b3b1104191519

Jbig2dec - Fix compile error on old version of Visual Studio

A recent change uses INT32_MAX and INT32_MIN, but these are not defined
in old versions of Visual Studio (not C99 probably).

This commit works around the problem by including two simple #defines
if the values are undefined.

Sebastian may want to alter this.

jbig2dec/jbig2_arith_int.c


2018-06-10 16:36:21 +0800
Sebastian Rasmussen <sebras@gmail.com>
c7bd3bb9fc9d008ab9d70f4d762be95d3f33cb0c

jbig2dec: Plug context leak upon errors.

E.g. failing to complete a page previously caused a context leak.

jbig2dec/jbig2dec.c


2018-06-10 21:29:31 +0800
Sebastian Rasmussen <sebras@gmail.com>
d06d19b3cfda9a563ffa09e4aa58322774d751fb

jbig2dec: Free huffman tables upon symbol dictionary parse errors.

jbig2dec/jbig2_symbol_dict.c


2018-06-10 21:14:48 +0800
Sebastian Rasmussen <sebras@gmail.com>
afed61efb38bed3a5580ee0e458b8c6946ee49f5

jbig2dec: Free symbol images upon text region parse error.

The symbol images were previously not freed upon errors.

jbig2dec/jbig2_text.c


2018-06-19 23:16:17 +0800
Sebastian Rasmussen <sebras@gmail.com>
314fb613ca8fa3028e33627bbb3fa484d4da1e13

jbig2dec: Remove untested, incomplete metadata handling.

base/jbig2.mak
jbig2dec/Makefile.am
jbig2dec/Makefile.unix
jbig2dec/jbig2_metadata.c
jbig2dec/jbig2_metadata.h
jbig2dec/jbig2_segment.c
jbig2dec/msvc.mak
windows/ghostscript.vcproj
windows/ghostscript_rt.vcxproj


2018-06-19 01:31:14 +0800
Sebastian Rasmussen <sebras@gmail.com>
3835fcfe6d3894e03a68c66bd211c7a739007b5d

jbig2dec: Limit EXRUNLENGTH according to symbol dictionary header.

jbig2dec/jbig2_symbol_dict.c


2018-06-19 01:30:34 +0800
Sebastian Rasmussen <sebras@gmail.com>
22e702351066d38c30d2bf695140f8fe6719c3f3

jbig2dec: Remove unnecessary limitation of EXRUNLENGTH.

Due to missing boundary checks in other code bug 693285 was resolved
by limiting the number of times EXRUNLENGTH may be zero. This limit
is actually not according to the specification. Now that the missing
boundary checks have been introduced the limitation may be removed.

jbig2dec/jbig2_symbol_dict.c


2018-06-18 19:04:38 +0800
Sebastian Rasmussen <sebras@gmail.com>
be27bd6685b714e1deca80d580d3ff9dc82f78dc

jbig2dec: Make private function static.

jbig2dec/jbig2_metadata.c
jbig2dec/jbig2_metadata.h


2018-05-30 15:31:10 +0800
Sebastian Rasmussen <sebras@gmail.com>
79eee7b35a6070cacfe94343d01e9e1b7ebb1191

jbig2dec: Return NULL upon error, avoid returning variable.

This makes it clearer what is being returned upon error.

jbig2dec/jbig2.c
jbig2dec/jbig2_arith.c
jbig2dec/jbig2_arith_iaid.c
jbig2dec/jbig2_arith_int.c
jbig2dec/jbig2_huffman.c
jbig2dec/jbig2_segment.c


2018-06-01 14:33:11 -0700
Sebastian Rasmussen <sebras@gmail.com>
a97b724a6639e710cb4626ba53be2f86b1ebd5ba

jbig2dec: Make sure to print fatal error upon detected error.

jbig2dec/jbig2_huffman.c


2018-06-01 16:56:39 -0700
Sebastian Rasmussen <sebras@gmail.com>
8ea06bef59929bbaa0450a94ab9586dd154657e8

jbig2dec: Make sure to return fatal/warnings when propagating error.

jbig2dec/jbig2_huffman.c
jbig2dec/jbig2_symbol_dict.c
jbig2dec/jbig2_text.c


2018-05-30 17:30:37 +0800
Sebastian Rasmussen <sebras@gmail.com>
443588c95d5776f141940d57aee2b3a0a21b668f

jbig2dec: Change types to match those of the parsed data.

jbig2dec/jbig2_generic.c
jbig2dec/jbig2_halftone.c


2018-06-21 00:30:02 +0800
Sebastian Rasmussen <sebras@gmail.com>
0188d0818b6f5b25aefdbafefa46d2845a21da9b

jbig2dec: Keep track of previous lines in generic region decoding.

This avoids issues with negative array indices.

jbig2dec/jbig2_generic.c


2018-05-30 14:26:16 +0800
Sebastian Rasmussen <sebras@gmail.com>
7352f5a01fd2e0a1f221d25cbf35fe088226232e

jbig2dec: No need to check for NULL in huff_get_next_word, use macro instead.

jbig2dec/jbig2_huffman.c


2018-05-27 02:49:49 +0800
Sebastian Rasmussen <sebras@gmail.com>
6da6f365a8c93128fcd67938ed3f5ef362c77630

jbig2dec: Label everything not yet implemented NYI.

jbig2dec/jbig2_halftone.c
jbig2dec/jbig2_segment.c


2018-05-27 02:48:56 +0800
Sebastian Rasmussen <sebras@gmail.com>
67c937009233f4496b8ece8270c10c4021785752

jbig2dec: Validate ASCII characters in metadata comments.

jbig2dec/jbig2_metadata.c


2018-05-27 00:33:45 +0800
Sebastian Rasmussen <sebras@gmail.com>
5c8a10f2e936b990fa3340650849186e92f1ecfd

jbig2dec: Implement support for profile segment.

The information in the profile segment is simply printed
as informational messages via jbig2_error().

jbig2dec/jbig2_segment.c


2018-04-24 21:43:48 +0800
Sebastian Rasmussen <sebras@gmail.com>
46f4acd48c81fa0db76f26c40b2e76c0fe7d7842

jbig2dec: Implement support for outputting multipage PBM files.

jbig2dec/jbig2dec.c


2018-04-25 02:47:39 +0800
Sebastian Rasmussen <sebras@gmail.com>
540f6a2f1c7f98b29b60a6e666623caec8dc8983

jbig2dec: Share arithmetic/huffman decoding contexts/tables.

Previously text regions had their own arithmetic/huffman
decoding contexts/tables, separate from those used to decode
fields in the symbol dictionary itself. This is incorrect.

Annex E.3.7 describes how to reset the arithmetic coding
contexts. Only the top-level symbol dictionary decoding
procedure described in chapter 7.4.2.2 references this
annex.

Neither the symbol dictionary decoding procedure outlined
in chapter 6.5 in the specification, nor chapter 6.5.8
describing how to decode the symbol bitmap itself (and
thereby implicitly chapter 6.2 describing the generic
region decoding procedure, 6.4 explaining the text
region decoding procedure and 6.5.8.2.2 describing how to
decode bitmaps with only one symbol in the
refinement/aggregate coding) refer to annex E.3.7.

It is therefore incorrect to separate the arithmetic
integer decoding contexts from the ones used to parse
the symbol dictionary fields as the specification calls
for these to be reused.

This created a problem when decoding page 3 in the sample
bitstream in Annex H.1. More specifically in Annex H.1,
step 37 (f) xi E where the refinement flag was decoded as
3 instead of the expected 0. This was because the IAID
arithmetic coding context used in step 37 (f) xi D had
not been shared with that in step 37 (f) v as is expected
in the specification. The result was that page 3 of the
sample bitstream was never decoded. Potentially this may
also have affected other JBIG2 bitstreams.

Sharing the arithmetic coding contexts between the symbol
dictionary decoding procedure and the text region decoder
resolves the issue

jbig2dec/jbig2_symbol_dict.c


2018-06-18 18:48:49 +0800
Sebastian Rasmussen <sebras@gmail.com>
d7b659b9853059ddd1d5ecaab79de16a7f675b32

jbig2dec: Handle very large symbol code lengths without overflowing.

jbig2dec/jbig2_symbol_dict.c


2018-04-25 02:33:52 +0800
Sebastian Rasmussen <sebras@gmail.com>
62df49ab137726635c9f3d2f76c0b599d733e8b5

jbig2dec: Reorder test for huffman decoding vs arithmetic integer decoding.

jbig2dec/jbig2_symbol_dict.c


2018-04-25 02:27:59 +0800
Sebastian Rasmussen <sebras@gmail.com>
fdf1504cb5dfbe77b0458ccad025fc992df77ad8

jbig2dec: Move text region decoder parameters initialization.

Previously the text region decoder parameters were only initialized
once a text region was about to be decoded. Now they are initialized
at the beginning of the decoding of the symbol dictionary. This
prepares for sharing of the IAID, IARDX and IARDY arithmetic
integer decoder contexts as well as the SBHUFFRDX, SBHUFFRDY and
SBHUFFRSIZE huffman tables between the text region decoder and the
symbol dictionary parser itself.

jbig2dec/jbig2_symbol_dict.c


2018-04-25 02:16:29 +0800
Sebastian Rasmussen <sebras@gmail.com>
e32e214b5de77ca1b658e46ae8d7cc6cabfb9d62

jbig2dec: Simplify cleanup when parsing symbol dictionary.

In the process move all cleanup, including any intermediate
images to the cleanup section towards the end of the symbol
decoding function.

jbig2dec/jbig2_symbol_dict.c


2018-04-25 02:11:00 +0800
Sebastian Rasmussen <sebras@gmail.com>
94a5d891cb5cf495b4d2bb8460b293b39e1603ce

jbig2dec: Initialize huffman table for size of symbols refinement data.

Previously this was uninitialized, possibly leading to dereferencing
an uninitialized table pointer.

jbig2dec/jbig2_symbol_dict.c


2018-04-25 01:57:52 +0800
Sebastian Rasmussen <sebras@gmail.com>
a27e623cac13c67926c42222589ff87f76f369dc

jbig2dec: Let symbol refinement Y offset use its own huffman table.

Previously both the symbol instances refinement X and Y offset reused
the same table SBHUFFRDX, but according to 6.4.11.3 and 6.4.11.4 in
the specification they ought to be using the independent SBHUFFRDX
and SBHUFFRDY tables. Let's make it so.

jbig2dec/jbig2_symbol_dict.c


2018-04-25 01:50:07 +0800
Sebastian Rasmussen <sebras@gmail.com>
721338e0846bc0e50cf4528ba6b0d54b1a577db4

jbig2dec: Remember to put all new symbols into ref/agg dictionary.

Previously the symbol dictionary propagated to the text region
decoder for a refinement/aggregate coded symbol did not contain
all necessary symbols. Only the symbols in the symbol dictionaries
referred to (SDINSYMS) by the currently parsed symbol dictionary
would be propagated into the text region decoder (SBSYMS).

Table 17 in the specification states that SBSYMS should be set
according to 6.5.8.2.4 which clearly states that SDINSYMS as well
as any symbols decoded up to that point (NSYMSDECODED symbols in
SDNEWSYMS) ought to be introduced into the dictionary that is
propagated to the text region decoder (SBSYMS). This is now done
by providing the text region decoder not just with a single symbol
dictionary, but both with SDINSYMS and SDNEWSYMS allowing the
decoder to refer to symbols from both.

jbig2dec/jbig2_symbol_dict.c


2018-04-24 22:32:16 +0800
Sebastian Rasmussen <sebras@gmail.com>
9eab580c634eb61d9340ebc40f4c40174ed226c5

jbig2dec: Paper over the fact that VS 2010 and earlier may not have SIZE_MAX.

jbig2dec/config_win32.h


2018-04-20 02:33:31 +0800
Sebastian Rasmussen <sebras@gmail.com>
0ee7f3b1c19f6d777eaf6bdf2b8ea8d241bf49d4

jbig2dec: Check for T.88 amendments 2/3 bitstreams.

T.88 Amendment 2 adds up to 12 adaptive template pixels in generic regions.
T.88 Amendment 3 adds support for generic/text regions to encode colors.
Neither amendment is implemented and no sample files have been found.
Return fatal errors for such bitstreams/files for the time being.

jbig2dec/jbig2.c
jbig2dec/jbig2_generic.c
jbig2dec/jbig2_page.c
jbig2dec/jbig2_segment.c
jbig2dec/jbig2_text.c


2018-04-24 13:39:07 +0800
Sebastian Rasmussen <sebras@gmail.com>
b200c6e476d00e760100b0b3e23f6e57f0794969

jbig2dec: Handle under-/overflow in arithmetic integer decoder.

jbig2dec/jbig2_arith_int.c


2018-04-24 13:54:47 +0800
Sebastian Rasmussen <sebras@gmail.com>
d73eadc850bd8b4f3bd26a70d7916de9f5c824c8

jbig2dec: Rename variables to closely follow the specification.

jbig2dec/jbig2_refinement.c
jbig2dec/jbig2_refinement.h
jbig2dec/jbig2_symbol_dict.c
jbig2dec/jbig2_text.c


2018-04-24 04:01:13 +0800
Sebastian Rasmussen <sebras@gmail.com>
f135d8f51b7a3da455c6cd4ccd88c5f6ab7f930b

jbig2dec: Implement support for resizing image width.

jbig2dec/jbig2_image.c


2018-04-24 03:48:35 +0800
Sebastian Rasmussen <sebras@gmail.com>
fe83cea1333445c0273e45003d6eeb172bc82e0e

jbig2dec: When extending image use default page color.

jbig2dec/jbig2_image.c
jbig2dec/jbig2_image.h
jbig2dec/jbig2_page.c


2018-04-24 03:40:06 +0800
Sebastian Rasmussen <sebras@gmail.com>
95df4340d0d65c1f5f180d31a93e8806ddb345dd

jbig2dec: Clarify lack of support for dependency bit.

The extension segment dependency bit only matters for
encoders. This is because it informs the encoder what
other segments a specific segment depends on. Since
jbig2dec doesn't do any alteration of segments this
need not be supported (or indeed even parsed).

jbig2dec/jbig2_segment.c


2018-04-24 23:57:18 +0800
Sebastian Rasmussen <sebras@gmail.com>
edb5c4000cc7e38c1f9f5e93243ab1737e13aeee

jbig2dec: Move arithmetic decoder test logging inside test.

Also take the opportunity to make the test stream static.

jbig2dec/jbig2_arith.c


2018-04-24 04:51:31 +0800
Sebastian Rasmussen <sebras@gmail.com>
3a2b2f13a26355a0ca7dc58d7c28276df3d7b786

jbig2dec: Enable both huffman tests when running check.

jbig2dec/jbig2_huffman.c


2018-04-23 14:02:46 +0800
Sebastian Rasmussen <sebras@gmail.com>
db1efdfb5f194079070bfd1ab50ae11e881de50d

jbig2dec: Handle get_next_word() returning error/less than a word.

This includes propagating the error handling to all callers.

jbig2dec/jbig2_arith.c
jbig2dec/jbig2_huffman.c
jbig2dec/jbig2_huffman.h
jbig2dec/jbig2_symbol_dict.c
jbig2dec/jbig2_text.c


2018-04-24 20:05:39 +0800
Sebastian Rasmussen <sebras@gmail.com>
968c424a70471c086466568bee21097e89149663

jbig2dec: free/release functions must handle NULL argument.

jbig2dec/jbig2.c
jbig2dec/jbig2_halftone.c
jbig2dec/jbig2_huffman.c
jbig2dec/jbig2_image.c
jbig2dec/jbig2_metadata.c
jbig2dec/jbig2_page.c
jbig2dec/jbig2_segment.c
jbig2dec/jbig2_symbol_dict.c


2018-04-11 00:02:39 +0800
Sebastian Rasmussen <sebras@gmail.com>
a21e4d7cf5b7928c490a2f804dfc01fc66069e35

jbig2dec: Implement pixel out of field test for refinement regions too.

jbig2dec/jbig2_refinement.c


2018-04-21 23:36:54 +0800
Sebastian Rasmussen <sebras@gmail.com>
01ae24d85f67b3c1b11993f1644a71da643ecc9b

jbig2dec: Differentiate error messages in generic region decoder.

This makes it easier to know from where the error message originated.

jbig2dec/jbig2_generic.c


2018-04-22 01:45:15 +0800
Sebastian Rasmussen <sebras@gmail.com>
f920a1839a66b844651b2ff5524944b0dd9484cf

jbig2dec: Fix and use decoder for template 3 generic regions.

Previously an optimized implementation for template generic
regions was commented out, presumably because it was faulty,
but now once the implementation is fixed it may be used.

The PDF in bug 693617 has an object 25 that contains a JBIG2
bitstream that can use this fix optimized decoder. Without
the fix in the optimized decoder the rendered output image
is incorrect.

jbig2dec/jbig2_generic.c


2018-04-23 01:25:34 +0800
Sebastian Rasmussen <sebras@gmail.com>
8e1b5e97f0950a47be4094028cf242a2b2861a07

jbig2dec: Handle non-nominal adaptive pixel locations in template 2.

Optimized generic region decoders can only handle nominal
adaptive pixel locations, while the unoptimized generic region
decoders can handle them being located at any location.

Previously the optimized decode was always used regardless of the
locations of the adaptive pixels, possibly causing decoding
issues. Now an unoptimized decoder is added for template 2 and is
being used whenever the adaptive pixel locations are at non-nominal
locations.

jbig2dec/jbig2_generic.c


2018-04-23 01:28:14 +0800
Sebastian Rasmussen <sebras@gmail.com>
c389757b311d9e01cf98cfb5d56c500929e28c43

jbig2dec: Handle non-nominal adaptive pixel locations in template 1.

Optimized generic region decoders can only handle nominal
adaptive pixel locations, while the unoptimized generic region
decoders can handle them being located at any location.

Previously the optimized decode was always used regardless of the
locations of the adaptive pixels, possibly causing decoding
issues. Now an unoptimized decoder is added for template 1 and is
being used whenever the adaptive pixel locations are at non-nominal
locations.

jbig2dec/jbig2_generic.c


2018-04-09 22:25:34 +0800
Sebastian Rasmussen <sebras@gmail.com>
d522f9a9815dce16977f7a9e9715e861cab76a55

jbig2dec: Fix incorrect adaptive pixel location check.

Previously for the adaptive pixel template 2 the check for the
location of the adaptive pixel was wrong. Because generic regions
with nominal locations are more common this lead to the
unoptimized decoder being used. Only a few images where the
adaptive pixel location happened to be at this wrong location
used the optimized decoder, and presumably were decoded
incorrectly. This incorrect location check therefore hid the bug
in the optimized generic region decoder concerning what pixels
are included at what location in the arithmetic integer context.

Now the adaptive pixel location check is corrected as well as the
bug in the optimized generic region decoder itself.

jbig2dec/jbig2_generic.c


2018-05-24 03:27:21 +0800
Sebastian Rasmussen <sebras@gmail.com>
18a051f2f422f9d336e1d6a28f990068faaf2abc

jbig2dec: Differentiate between errors/OOB when decoding BMSIZE.

Previously the two very lumped together, causing a single error message.

jbig2dec/jbig2_symbol_dict.c


2018-04-24 13:39:46 +0800
Sebastian Rasmussen <sebras@gmail.com>
851e3885386f992af8e73ba90c8b8fcf5a6cb69a

jbig2dec: Print errors when out of boundary values occur.

According to the specification in 6.4.5 when decoding text
regions, where OOB values in IDS indicate that the last symbol
in a strip has been decoded, or in 6.5.5 when decoding symbol
dictionaries, where OOB values in DW indicate that all the
symbols in a height class have been decoded. When decoding any
other symbols than IDS or DW, OOB values are not expected, so
report these as fatal errors.

jbig2dec/jbig2_symbol_dict.c
jbig2dec/jbig2_text.c


2018-04-25 02:08:40 +0800
Sebastian Rasmussen <sebras@gmail.com>
6f4075cae5c70e5f766a79d011624326c4bf5185

jbig2dec: Check if all arithmetic decoder contexts are initialized.

Previously the IADT and IARI contexts were never checked for having
been successfully initialized, possibly causing uninitialized data
issues later.

jbig2dec/jbig2_symbol_dict.c


2018-05-24 03:28:04 +0800
Sebastian Rasmussen <sebras@gmail.com>
7241bffe648d3f75cd03bbaa404fc927163e6215

jbig2dec: Skip over undecoded pages when getting pages.

jbig2dec/jbig2_page.c


2018-05-24 03:23:25 +0800
Sebastian Rasmussen <sebras@gmail.com>
7b68d2964935c40fe8f58a9540c5765fb2f53f0f

jbig2dec: Detect NULL image pointer before trying to take reference.

Attempting to take a reference to NULL is a no-op anyway.

jbig2dec/jbig2_refinement.c
jbig2dec/jbig2_text.c


2018-06-01 10:36:53 -0700
Sebastian Rasmussen <sebras@gmail.com>
f8f900369183f908fb8e8796154e2c7b57fbd202

jbig2dec: Rename jbig2_image_clone() to jbig2_image_reference().

This more accurately explains what the function does, and
mirrors jbig2_image_release() quite well.

jbig2dec/jbig2_image.c
jbig2dec/jbig2_image.h
jbig2dec/jbig2_page.c
jbig2dec/jbig2_refinement.c
jbig2dec/jbig2_symbol_dict.c
jbig2dec/jbig2_text.c


2018-05-24 03:24:33 +0800
Sebastian Rasmussen <sebras@gmail.com>
c3707893650d631dfcc4ca5a99b2eb28f7108fd9

jbig2dec: Refinement bitmaps without images should be treated as fatal errors.

jbig2dec/jbig2_refinement.c


2018-05-23 23:12:16 +0800
Sebastian Rasmussen <sebras@gmail.com>
dc80246ab0a08f3c946d43d930c772dedb8b7bf4

jbig2dec: Report warnings if called functions indicate errors.

The first error detected ought to be a fatal error, but when this
error condition is propagated to callers, they should indicate warnings.

jbig2dec/jbig2.c
jbig2dec/jbig2_generic.c
jbig2dec/jbig2_halftone.c
jbig2dec/jbig2_page.c
jbig2dec/jbig2_refinement.c
jbig2dec/jbig2_symbol_dict.c
jbig2dec/jbig2_text.c


2018-05-27 02:51:10 +0800
Sebastian Rasmussen <sebras@gmail.com>
689fa69bfd6c423194e58f22835836870cb519b5

jbig2dec: Unsupported intermediate generic region is now a fatal error.

jbig2dec/jbig2_segment.c


2018-05-27 02:50:32 +0800
Sebastian Rasmussen <sebras@gmail.com>
f394d8e7b5588bed1c2265136da0bcb2502507fb

jbig2dec: Halftone regions with skip enabled is now a fatal error.

jbig2dec/jbig2_halftone.c


2018-05-24 03:20:52 +0800
Sebastian Rasmussen <sebras@gmail.com>
de4b96e07690cde1999554b1413d79f20d1e8523

jbig2dec: Detected errors should be fatal, not warnings.

jbig2dec/jbig2_generic.c
jbig2dec/jbig2_metadata.c


2018-05-23 21:48:31 +0800
Sebastian Rasmussen <sebras@gmail.com>
d175962540cd0ff2b6dcec2a13bf61a17df93741

jbig2dec: Remember to free IAID context upon error.

Previously this might result in a memory leak.

jbig2dec/jbig2_arith_iaid.c


2018-05-24 00:52:15 +0800
Sebastian Rasmussen <sebras@gmail.com>
e32e5535ca5055e31417d022753eed67a30d482e

jbig2dec: Free referred to symbol dictionary upon error.

jbig2dec/jbig2_symbol_dict.c


2018-05-24 03:26:43 +0800
Sebastian Rasmussen <sebras@gmail.com>
fc4940d6aabebd6516befefc0b51676ccc332a7f

jbig2dec: Pages without decoded images cannot be completed.

jbig2dec/jbig2_page.c


2018-05-24 00:51:20 +0800
Sebastian Rasmussen <sebras@gmail.com>
e4e1e6ac335eaccd92eff57308e173ac67a392f0

jbig2dec: When a page fails to complete, handle as an error.

Previously this only caused a warning message but didn't fail,
but failing to complete a page means the parsing is somehow broken,
and so it ought to be best to treat it as a fatal error.

jbig2dec/jbig2dec.c


2018-05-24 00:33:18 +0800
Sebastian Rasmussen <sebras@gmail.com>
3da06c6284e3370f31382299eddf7c76f11960cd

jbig2dec: Releasing a page cannot not fail.

It can only fail if you supply a random page pointer.
Don't do that it would be a programming error.

jbig2dec/jbig2.h
jbig2dec/jbig2_page.c


2018-05-23 23:21:27 +0800
Sebastian Rasmussen <sebras@gmail.com>
451ee5588ec2616afc21ae9ccc61c2afb8144bf7

jbig2dec: Directly return jbig2_error(FATAL); they indicate errors.

Because jbig2_error(ctx, JBIG2_SEVERITY_FATAL, ...) returns -1,
it can be immediately returned or assigned as a return code.

jbig2dec/jbig2_huffman.c
jbig2dec/jbig2_metadata.c
jbig2dec/jbig2_text.c


2018-05-23 23:12:43 +0800
Sebastian Rasmussen <sebras@gmail.com>
1e751b882e18fee36a16488e7b46c0e1b571d605

jbig2dec: Return jbig2_error(WARNING); they indicate errors.

Because jbig2_error(ctx, JBIG2_SEVERITY_WARNING, ...) now returns -1,
it can be immediately returned or assigned as a return code.

jbig2dec/jbig2_generic.c
jbig2dec/jbig2_halftone.c
jbig2dec/jbig2_metadata.c
jbig2dec/jbig2_mmr.c
jbig2dec/jbig2_page.c
jbig2dec/jbig2_symbol_dict.c
jbig2dec/jbig2_text.c


2018-05-24 01:24:32 +0800
Sebastian Rasmussen <sebras@gmail.com>
c159c4534b9b9af4998d6dcdee896fe2197fa542

jbig2dec: Convert debug messages in debug code to warnings.

This is because the debug code calls functions that write
PBM images or similar, these may fail and when this happens
the calling function ought to print a warning and fail itself.

jbig2dec/jbig2_page.c
jbig2dec/jbig2_refinement.c
jbig2dec/jbig2_symbol_dict.c


2018-05-23 00:22:41 +0800
Sebastian Rasmussen <sebras@gmail.com>
a8b6f19d5f5e7af568c448421c24bbe200ea9c89

jbig2dec: Error callback should not modify jbig2_error() return code.

If a function detects an error it should call
jbig2_error(ctx, JBIG2_SEVERITY_FATAL, ...) and return -1. The caller
of this function may then detect the return code indicating error
and call jbig2_error(ctx, JBIG2_SEVERITY_WARNING, ...). Previously
this latter call to jbig2_error() would not return -1, but it is good
form for the calling function to fail and return -1 to the next caller.
Therefore the error callback no longer has the option to override the
return code from jbig2_error(), instead jbig2_error() always returns -1.

base/sjbig2.c
jbig2dec/jbig2.c
jbig2dec/jbig2.h
jbig2dec/jbig2dec.c


2018-05-23 02:00:49 +0800
Sebastian Rasmussen <sebras@gmail.com>
2c743c193e1812795c9c23a8c6cc9d69d2a47eb5

jbig2dec: Only return jbig2_error() for fatal errors/warnings.

Only calls to jbig2_error() using fatal errors or warnings may
return, no calls to jbig2_error() using informational or debug
messages may return. This is preparation for jbig2_error() to
always return -1 for errors/warnings.

jbig2dec/jbig2_refinement.c
jbig2dec/jbig2_segment.c


2018-04-06 23:43:51 +0800
Sebastian Rasmussen <sebras@gmail.com>
be59a40717ec60a5a054ccf88f7064c90788aa78

jbig2dec: Add support to process embedded JBIG2 bitstreams.

This type of stream is present in PDF files which is a good source
of test streams for jbig2dec.

jbig2dec/jbig2dec.c


2018-04-24 04:19:31 +0800
Sebastian Rasmussen <sebras@gmail.com>
d7f529ac50d61a1fe07eb1a667322234402e9894

jbig2dec: Remove check for bitmap coding context use.

The removed check used bitmask 0x80 to check for the flag
"bitmap coding context used" among the symbol dictionary flags.
The correct bitmask is 0x100, which was already checked for
later in the code, rendering this incorrect check unnecessary.

jbig2dec/jbig2_symbol_dict.c


2018-04-22 16:11:32 +0800
Sebastian Rasmussen <sebras@gmail.com>
22fbf1bb62b49316452c7556399618399c463039

jbig2dec: Return error code from get_next_word().

Previously Jbig2WordStream's get_next_word() callback
sometimes returned error codes. This contradicted the
declaration of the callback. However indicating errors
and the number of bytes returned upon successful calls
is a good idea. The declaration and all implementations
of the callback have been adjusted accordingly.

This means that jbig2dec now compiles without warnings.

jbig2dec/jbig2.c
jbig2dec/jbig2_arith.c
jbig2dec/jbig2_huffman.c
jbig2dec/jbig2_priv.h


2018-04-25 05:01:41 +0800
Sebastian Rasmussen <sebras@gmail.com>
ef05820d514fd6a27d1b7690df16b63f8b20cf26

jbig2dec: Indicate success when using arithmetic decoder.

Commit 2b2dcf4ccf401ed210f03c858b304994749fd2b3 accidentally
forgot to set the out parameter to indicate success when the
call was indeed successful.

jbig2dec/jbig2_arith.c


2018-05-23 20:05:20 +0800
Sebastian Rasmussen <sebras@gmail.com>
359a15e1c8b460268ff80fb8e8a5da121fcbafc3

jbig2dec: Avoid NULL-check before jbig2_free()/jbig2_image_release().

jbig2dec/jbig2_halftone.c
jbig2dec/jbig2_huffman.c
jbig2dec/jbig2_segment.c
jbig2dec/jbig2_symbol_dict.c


2018-05-23 00:04:55 +0800
Sebastian Rasmussen <sebras@gmail.com>
b9f15473bdd8f48b9336b67d15dc08a6f78f750b

jbig2dec: Move declarations from jbig2_priv.h to their respective headers.

Due to this some .c-files now need new includes.

jbig2dec/jbig2.c
jbig2dec/jbig2.h
jbig2dec/jbig2_generic.c
jbig2dec/jbig2_generic.h
jbig2dec/jbig2_halftone.c
jbig2dec/jbig2_halftone.h
jbig2dec/jbig2_huffman.c
jbig2dec/jbig2_image.h
jbig2dec/jbig2_metadata.c
jbig2dec/jbig2_page.c
jbig2dec/jbig2_priv.h
jbig2dec/jbig2_segment.c
jbig2dec/jbig2_symbol_dict.c
jbig2dec/jbig2_text.c
jbig2dec/jbig2_text.h


2018-05-26 19:12:28 +0800
Sebastian Rasmussen <sebras@gmail.com>
c6d6efdc340e0cac31cda1bbb654bcbfcda92b47

jbig2dec: Create jbig2_segment.h with segment declarations.

jbig2dec/jbig2.c
jbig2dec/jbig2.h
jbig2dec/jbig2_generic.c
jbig2dec/jbig2_halftone.c
jbig2dec/jbig2_huffman.c
jbig2dec/jbig2_metadata.c
jbig2dec/jbig2_page.c
jbig2dec/jbig2_priv.h
jbig2dec/jbig2_refinement.c
jbig2dec/jbig2_segment.c
jbig2dec/jbig2_segment.h
jbig2dec/jbig2_symbol_dict.c
jbig2dec/jbig2_text.c


2018-05-26 15:00:00 +0800
Sebastian Rasmussen <sebras@gmail.com>
624bc3cc86c95bc6215d02d6bf39ff694e2c2a9d

jbig2dec: Create jbig2_refinement.h with refinement declarations.

jbig2dec/jbig2_generic.h
jbig2dec/jbig2_priv.h
jbig2dec/jbig2_refinement.c
jbig2dec/jbig2_refinement.h
jbig2dec/jbig2_segment.c
jbig2dec/jbig2_symbol_dict.c
jbig2dec/jbig2_text.c


2018-05-26 14:51:42 +0800
Sebastian Rasmussen <sebras@gmail.com>
8f4288807d659f72734d41dd8b7d434b1e15dfc2

jbig2dec: Create jbig2_page.h with page declarations.

jbig2dec/jbig2.c
jbig2dec/jbig2_generic.c
jbig2dec/jbig2_halftone.c
jbig2dec/jbig2_page.c
jbig2dec/jbig2_page.h
jbig2dec/jbig2_priv.h
jbig2dec/jbig2_refinement.c
jbig2dec/jbig2_segment.c
jbig2dec/jbig2_text.c


2018-05-26 15:12:54 +0800
Sebastian Rasmussen <sebras@gmail.com>
55925ee6220fe371b1fe34fdc27cfd4dad8847b2

jbig2dec: Create jbig2_image_rw.h with image reading/writing declarations.

jbig2dec/jbig2_image.h
jbig2dec/jbig2_image_pbm.c
jbig2dec/jbig2_image_rw.h
jbig2dec/jbig2dec.c
jbig2dec/pbm2png.c


2018-05-26 15:01:37 +0800
Sebastian Rasmussen <sebras@gmail.com>
f7d2387f73488a24db04b22884d1e2c7bb83a857

jbig2dec: Remove non-existing function from header.

jbig2dec/jbig2_priv.h


2018-05-24 23:54:54 +0800
Sebastian Rasmussen <sebras@gmail.com>
cbb2072c14305de22f2334acf44a080933f26e21

jbig2dec: Add include guards to all headers.

jbig2dec/jbig2_arith.h
jbig2dec/jbig2_arith_iaid.h
jbig2dec/jbig2_arith_int.h
jbig2dec/jbig2_generic.h
jbig2dec/jbig2_huffman.h
jbig2dec/jbig2_hufftab.h
jbig2dec/jbig2_mmr.h
jbig2dec/jbig2_priv.h
jbig2dec/jbig2_symbol_dict.h
jbig2dec/jbig2_text.h


2018-05-24 03:18:04 +0800
Sebastian Rasmussen <sebras@gmail.com>
6cc76f397ff5af382e4e49914d1b42df3e0a78e4

jbig2dec: Rephrase error messages.

jbig2dec/jbig2.c
jbig2dec/jbig2_arith_int.c
jbig2dec/jbig2_generic.c
jbig2dec/jbig2_halftone.c
jbig2dec/jbig2_huffman.c
jbig2dec/jbig2_image.c
jbig2dec/jbig2_image_png.c
jbig2dec/jbig2_mmr.c
jbig2dec/jbig2_page.c
jbig2dec/jbig2_refinement.c
jbig2dec/jbig2_segment.c
jbig2dec/jbig2_symbol_dict.c
jbig2dec/jbig2_text.c


2018-05-24 02:05:36 +0800
Sebastian Rasmussen <sebras@gmail.com>
344a90c91dc03e9ae80500303e67594f175374e3

jbig2dec: Remove unnecessary scoping.

jbig2dec/jbig2_refinement.c


2018-04-25 00:50:12 +0800
Sebastian Rasmussen <sebras@gmail.com>
120732b27011a1651ebfcf50536cac953c7b4c9b

jbig2dec: Remove many unnecessary parentheses.

jbig2dec/jbig2_page.c
jbig2dec/jbig2_symbol_dict.c
jbig2dec/jbig2_text.c


2018-04-22 23:08:49 +0800
Sebastian Rasmussen <sebras@gmail.com>
b3d2e786ace758422cdeb22c1cc688bb52087ddf

jbig2dec: Remove unnecessary comments, whitespace and unused code.

jbig2dec/jbig2.c
jbig2dec/jbig2_generic.c
jbig2dec/jbig2_halftone.c
jbig2dec/jbig2_huffman.c
jbig2dec/jbig2_image.c
jbig2dec/jbig2_page.c
jbig2dec/jbig2_refinement.c
jbig2dec/jbig2_segment.c
jbig2dec/jbig2_symbol_dict.c
jbig2dec/jbig2_text.c
jbig2dec/jbig2dec.c


2018-05-08 22:35:11 +0800
Sebastian Rasmussen <sebras@gmail.com>
def343c44322ebdf609d0113884385d944dc361a

jbig2dec: Fix typos in error messages and comments.

jbig2dec/jbig2_halftone.c
jbig2dec/jbig2_huffman.c
jbig2dec/jbig2_metadata.c
jbig2dec/jbig2_page.c
jbig2dec/jbig2_symbol_dict.c
jbig2dec/jbig2dec.1


2018-05-26 15:46:16 +0800
Sebastian Rasmussen <sebras@gmail.com>
a4ebc6d3cd3e2fcab8b3e9b7bcb7364c14f09d8d

jbig2dec: Reindent sources in the same way as before.

Accept some whitespace changes as done by the commands
from commit d3d767d9b91ae7d82c261fbdfd735f3042161032.

jbig2dec/jbig2.c
jbig2dec/jbig2_arith.h
jbig2dec/jbig2_halftone.c
jbig2dec/jbig2_image.c
jbig2dec/jbig2_metadata.c
jbig2dec/jbig2_mmr.c
jbig2dec/jbig2_page.c
jbig2dec/jbig2_priv.h
jbig2dec/jbig2_symbol_dict.c
jbig2dec/jbig2dec.c


2018-07-12 16:35:12 +0100
Ken Sharp <ken.sharp@artifex.com>
bc6af8da1adc9b4939e3acbfc4194a143412af3c

Fix an error in the type 3 stitching function monotonic detection

Bug #699528 "A rare edge condition can cause a function to incorrectly signal a rangecheck error"

This is rather difficult to describe. The problem occurs when we try to
check for monotonicity of a stitching function between two data points
of the parametric variable.

We actually calculate a series of points between the two values and
check to see that they all increase (or decrease). However, a stitching
function can contain multiple functions, and so we break the range of
values into groups at the limits of each function and check each
group of values.

If the lower value of the parameteric variable is 'close' to the upper
bound of the current function, we decide to 'punt' it up to the next
function, presumably to avoid the overhead of a miniscule break. That is
we simply don't bother calculating tiny amounts at the end of a function
we just do the next function.

However, if the upper range of the parametric variable happened also
to lie close to (but less than) the upper bound of the function, then
when we used it to evaluate the next function in the array, it would lie
below the bottom bound of that function, resulting in a rangecheck error.

This commit applies two fixes; firstly, if the upper and lower values
of the parametric variable are the same then this is a point, and there
is no point in checking it, so just jump straight out.

Secondly, the upper value is now promoted to the lower bound of the
current function if it is less than that. This prevents us trying to
use an out of bound value, in case we should somehow get both an upper
*and* a lower bound which lie within the 'noise' threshold.

Because the range of 'noise' is so small (the bounds values of the
function divided by 1 million) there is no practical likelihood of
us missing a function which is not monotonic between those data
points.

base/gsfunc3.c


2015-03-19 11:33:51 +0000
Tim Waugh <twaugh@redhat.com>
00c14a25c0f0d5e5e65d2d489045e566ccf436df

bug #695876: check that page margins don't overlap in cups driver.

cups/gdevcups.c


2018-07-10 09:51:37 +0100
Ken Sharp <ken.sharp@artifex.com>
87cfc860ea49a4a39c1198b419a019ed598416f0

PDF interpreter improve handling of PageLabels as pdfmark

Patch supplied by Leon Bottou, see Bug #696568. This improves the way
the code handles the number tree when converting it to pdfmark
operations.

I don't have any reasonable way to test this, as it relies on using a
device which implements pdfmark, but doesn't implement WantsPageLabels
(to avoid getting the number tree passed).

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


2018-07-10 08:50:11 +0100
Ken Sharp <ken.sharp@artifex.com>
ac9f8412e8c35edd7c0bbbbcd1c7195a56bc15d8

PDF interpreter - fix new PageLabels processing for non-pdfwrite case

The commit to treat PageLabels as pdfmark operations instead of using
our internal code had a logical error when *not* using pdfwrite.

Committed verbatim as there's no simple way to test this case.

Resource/Init/pdf_main.ps


2018-07-09 09:24:27 -0700
Nancy Durgin <nancy.durgin@artifex.com>
d45ebe705de7b7618ad0d0d20fc31a960c8d9ba2

Bug 690339 - use free/alloc instead of resize when change frame buffer size

In gdev_prn_allocate(), when size of frame buffer changed, we used to call
call gs_resize_object(). Now we call gs_free_object() followed by
gs_alloc_bytes().

Two advantages -- avoids copying the old frame buffer to the new one
(which was pointless) and now the old buffer and new buffer don't need
to coexist, which could help on a low memory system.

base/gdevprn.c


2018-07-09 16:49:38 +0100
Ken Sharp <ken.sharp@artifex.com>
9d168db605fba44e6238d53d8c29f5997760d2ca

device subclassing of patterns, use the correct memory structure

Spotted by Chris while looking at a customer problem, the customer's
code allocs a new pattern accumulator using the device's memory, but it
should really be using the current VM state of the interpreter.

The reason it didn't was because that information wasn't available at
the point where the allocation is made. This commit adds the current
interpreter VM mode to the 'param' structure, which enables us to pass
it to th device, and have the device use it properly.

base/gxdevsop.h
psi/zpcolor.c


2018-07-09 14:16:31 +0100
Ken Sharp <ken.sharp@artifex.com>
4f02acd487721451256d3348760cd3c9333e7635

pdfwrite - allow PageLabels to be (optionally) transmitted as pdfmarks

Bug #696568 "Treatment of page labels"

Patch supplied by Leon Bottou, the creator and maintainer of the djvu
device for Ghostscript, very slightly modified.

The djvu device wants the PageLabels from existing PDF files sent to
the device as pdfmarks, exactly as they would be from PostScript. The
problem with this from the pdfwrite point of view is that this would
result in us unpicking the number tree to create pdfmark operations, and
then at the pdfwrite end rebuilding a number tree to emit. Not rebuilding
the tree would result in larger output.

This patch checks that the device implements pdfmark, and if it does
checks whether WantsPageLabels is set in the device. If it is then we
assume its pdfwrite (or a similar device prepared to accept the number
tree). If it is not set then we walk the tree and create a new pdfmark
for each page in the tree range.

I'm unable to test this properly, because it relies on a device which
does implement pdfmark, but doesn't want PageLabels. Rudimentary
testing seemed to work as expected, its possible that more complex
examples might require some more work.

Resource/Init/pdf_main.ps


2018-07-06 09:58:06 +0100
Ken Sharp <ken.sharp@artifex.com>
42cee04f173ccacb6aafc8243dd6c2ef12cdde54

Forgot to include the changed doc file in last commit

doc/Use.htm


2018-07-06 09:53:45 +0100
Ken Sharp <ken.sharp@artifex.com>
cc826ca86485321cbc5fc111f7dad7ee39e69a17

Update PageList processing in the FirstPage/LastPage device

The intention of the PageList was that pages would be specified in
ascending order, but the documentation didn't actually say that
explicitly, so update the documentation to make it absolutely clear.

In addition, by specifying a lower page number at the end, it was
possible to cause a buffer overrun, so prevent that here and flag an
error to the user so they know.

base/gdevflp.c


2018-07-05 18:04:28 +0100
Robin Watts <robin.watts@artifex.com>
18e4b59efeca56ec2ca716559a7b9e0639561428

Bug 699379: Fix infinite loop with filenames starting with #.

The argument handling routines treat lines starting with #
as being comments. Unfortunately, the logic for this was failing
to recognise EOF as stopping the search for the end of a line.

Doubly unfortunatately, it was extending this courtesy, intended
for lines within @files to command line arguments too. We take
steps to avoid that too.

base/gsargs.c


2018-07-05 11:22:41 +0100
Robin Watts <robin.watts@artifex.com>
f390123f8e34ec149fe1a3366ebb872368a57d7f

Bug 698928: Rework arg_next.

When I worked on arg_next before, I think I had the wrong idea of
what it was doing.

The idea of arg_next (I thought) was that we'd call it, and get back
a pointer to a decoded version of the next argument. Sadly, this
wasn't true - it would leave us with an *encoded* version of the
argument. Now, for most things this didn't matter, for for encodings
like UTF16LE, it certainly did.

So, largely revert the previous misguided commit to this code, and
update arg_next so that it really does return a "decoded" (i.e. always
utf-8 encoded) buffer.

This fixes Bug 698928 where I had an underflow read in a buffer.

base/gsargs.c
base/gsargs.h


2018-07-05 16:38:01 +0100
Ken Sharp <ken.sharp@artifex.com>
62e67ecc475d3648f32d7d8c4459bbabd740ea2b

Fix a device subclassing problem with colour mapping procedures

Bug #699520 "Seg fault with customer device utilising device subclassing"

When we retrieve colour mapping methods, we need to use the first
subclassing device in the chain which does not have a 'default' for
the colour mapping methods. This is so that the monochrome palette
device in PCL works properly.

In contrast, if none of the subclassing devices overrides the colour
mapping then we want to use the first non-subclassing device's
methods and, importantly, that device as well.

base/gxdevcli.h


2018-07-03 13:44:28 +0100
Ken Sharp <ken.sharp@artifex.com>
2f8082aa9777a7274c463c6375c2f7d01c299251

Increase limit on UniqueIDs for fonts

Bug #699513 "CFF font UniqueID greater then 2^24 - 1 causes error"

The PDF file contains a font with a UniqueID of 0x7fffff which exceeds
the PostScript definition of a font UniqueID (0 -> 2^24 - 1).

Experimentation shows that no PostScript interpreter that I have access
to (other than GS) implements this limit. However, to keep the change
conservative, I'm chosen to raise the limit to 2^32-1 to match the CFF
specification, rather than eliminate it altogether.

psi/idparam.c


2018-07-03 08:55:43 +0100
Chris Liddell <chris.liddell@artifex.com>
3e44dd7a9f112ea5334a4e189ec64f7a16139597

Remove some obsolete sections from the docs.

DOS and OS/2 install sections in install.htm

doc/Install.htm


2018-06-30 16:10:48 +0100
Ken Sharp <ken.sharp@artifex.com>
dc20112ef13ebdfc6e1ad20ac9ef5462e9145682

Fix a compiler warning

devices/vector/gdevpdfp.c


2018-06-30 14:29:43 +0100
Ken Sharp <ken.sharp@artifex.com>
aba212c73d6f10fe891786a938bb461636563dba

pdfwrite - when changing ProcessColorModel, don't just change the name

Bug 699490 "Broken PDF/X-3 generated"

The reason that an empty file was generated was due to a mismatch
between the underlying device process color model and the ICC profile
attached to the device. The profile was a CMYK profile, while the
device was set to have 3 components.

This is due to the fact that setting the ProcessColorModel separately
from the ColorConversionStrategy was not actually changing the model,
it just changed the name.

This should, of course, have generated an error and an earlier commit
had already addressed that. In this commit, we call the routine which
actually switches the colour model, and we also count down the ICC
structure attached to the device, and set it to 0. This forces a reload
of the ICC profile. That isn't needed for this particular bug but it
is needed when OutputICCProfile is not set, because we will otherwise
try to use the profile for the prior colour model, which will be
incorrect and leaed to errors.

devices/vector/gdevpdfp.c


2018-06-29 14:13:39 -0700
Michael Vrhel <michael.vrhel@artifex.com>
8d415abe6f1e0e3a7e895511e20d99eebad48ada

Fix rendering issue on tiffscaled devices

The tiffscaled contone devices have to be able to change their color model
to allow a more flexible use of the post render ICC profile with the output
intent. Prior to this commit, certain profile combinations would result in
mis-rendered results.

With this fix, if we are wanting to render to a CMYK intermediate
output intent but we want the output to be in sRGB then we need to use
-sDEVICE=tiffscaled24 -dUsePDFX3Profile -sOutputICCProfile=default_cmyk.icc
-sPostRenderProfile=srgb.icc . This should then render to a temporary
buffer the is in the OutputIntent color space and then be converted to
sRGB. This should look like the result we get when we go out to the
tiffscaled32 device. This is in contrast to the command line
sDEVICE=tiffscaled24 -dUsePDFX3Profile -sPostRenderProfile=srgb.icc which would
end up using the output intent as a proofing profile. The results may be similar
but not exact as overprint and spot colors would not appear correctly due to the
additive color model during rendering.

base/gsicc.c
base/gsicc.h
base/lib.mak
devices/devs.mak
devices/gdevtsep.c


2018-06-28 16:44:41 +0100
Ken Sharp <ken.sharp@artifex.com>
da3810ce626a1c5dca856a7bac757bf254761f69

pdfwrite - create GC desscriptors for JPEG Passthrough stream

Bug #699427 " Shrinking PDF is causing SIGSEGV"

Its not absolutely clear that this is the same problem, but I'm
reasonably confident. When passing JPEG data through untouched, we
copied the stream pointer for the uncompressed data into the device
structure (because the image enumerator isn't available at that time)
but if the stream should be relocated after the copy is taken, then the
old stream might not be valid any more.

This commit adds a GC descriptor for the copied stream pointer to the
PDF device structure. For me this solves the problem, but the nature
of these kinds of problems means that *any* change which affects memory
layout will affect the execution, so I'm not 100% certain this is the
problem.

devices/vector/gdevpdf.c
devices/vector/gdevpdfx.h


2018-06-26 14:52:22 -0700
Michael Vrhel <michael.vrhel@artifex.com>
250b5e83e923bed9b6d48bf3965f3b38af52286d

Fix errors introduced in previous commit

The commit f2cf68297e3d63cb927db3c98d317f7ee68e7898
resulted in errors with the separation type devices.
With these devices, we can simply check if the color
model matches the ICC profile since these devices
change their number of components. Will likely need
to do some testing with these device and different
profiles to see what breaks when and make sure we
exit gracefully.

base/gsicc_manage.c
devices/devs.mak
devices/gdevcmykog.c
devices/gdevgprf.c
devices/gdevpsd.c


2018-06-27 13:22:41 +0100
Chris Liddell <chris.liddell@artifex.com>
e4a7fc24c051241e4dbd14760a218290769d78a6

Fix a typo in a link

doc/API.htm
doc/C-style.htm
doc/Commprod.htm
doc/DLL.htm
doc/Deprecated.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/History9.htm
doc/Install.htm
doc/Language.htm
doc/Lib.htm
doc/Make.htm
doc/News.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/sample_downscale_device.htm
doc/subclass.htm
doc/thirdparty.htm


2018-06-25 09:44:34 +0100
Chris Liddell <chris.liddell@artifex.com>
6a4202691c4317a698fa23c5309ad8974fe2b003

Bug 699454: 'improve' pdfwrite guesstimate of glyph bbox

When estimating the bounding box of a glyph, we were basically only using the
FontBBox - which is often bogus (as it is in this case).

We'll now, additionally, use the advance width of the glyph in that estimate.

This could possibly result in glyphs being included whose marking operations
are outside the current clip, but whose advance width intersects with the
current clip. But that would be preferable to (as was happening) a glyph inside
the clip being dropped.

(Using the "real" glyph bbox would require executing the complete charstring,
which, obviously, has performance implications)

devices/vector/gdevpdte.c


2018-06-22 11:48:58 -0700
Michael Vrhel <michael.vrhel@artifex.com>
9ae241f271ae2eafc69ca44a0b8b70af17705c0e

Fix crash introduced by commit to make lcms thread-safe

Using a proof profile or even using -dUsePDFX3Profile with
a device color model that was different than the output
intent caused a crash after commit
9ff6b34e461fcbd4ef27fbb6c5c8a15071fe1370

Problem was that the intermediate device link was not
getting created.

base/gsicc_lcms2mt.c


2018-06-22 10:35:48 -0700
Michael Vrhel <michael.vrhel@artifex.com>
f2cf68297e3d63cb927db3c98d317f7ee68e7898

Bug 699381 Add error checking for device icc profiles

Make sure that the various types of profiles that can be set work with
the device color model and with each other. Only allow the use of
the post render ICC profile when the device supports it.

base/gdevdflt.c
base/gsdparam.c
base/gsicc_manage.c
base/gxdevsop.h
base/lib.mak
devices/devs.mak
devices/gdevtsep.c


2018-06-21 11:56:17 -0700
Michael Vrhel <michael.vrhel@artifex.com>
6b981f05c5dafe5d03e8827cb3b5c1cd879c0644

Fix crash when using PostRenderProfile

Crash was introduced by commit to make lcms thread-safe
9ff6b34e461fcbd4ef27fbb6c5c8a15071fe1370

base/gsicc_cache.c


2018-06-19 11:28:31 +0100
Chris Liddell <chris.liddell@artifex.com>
da399f89d08f66d8608e83ecf2cd5c33ec45b866

Don't overwrite filename in the event of an error.

When we 'wrap' a file to allow thread safe file access for multithreaded clist
operation, we replace the original file name with a special 'encoded' file
name - we shouldn't do the replacement if the underlying file fails to open
since it means the error message shows the encoded file name, rather than the
name of the 'real' file.

base/gxclfile.c


2018-06-14 12:47:21 -0700
Ray Johnston <ray.johnston@artifex.com>
f92376925f99cd418ce94ab738935eb88013175f

Add aarch64:Linux case to tiff config.guess

Needed for configure on 64-bit Linux on ARM (seen with SUSE 64-bit linux
on the Raspberry Pi).

tiff/config/config.guess


2018-06-14 12:42:49 -0700
Ray Johnston <ray.johnston@artifex.com>
255fe6272797351f83613e6ca079a903bdabb136

Fix typo in lib.mak. Missing sfilter2 in psfilters.dev

Both entries were $(GLOBJ)sfilter1.$(OBJ) which resulted in s_A85E_template
undefined in the link.

base/lib.mak


2018-06-14 13:57:30 +0100
Ken Sharp <ken.sharp@artifex.com>
fbf2eefa62b8dd4eb1b96aa77b7d4cf6719af5fe

fix lib.mak for Windows builds

Commit ca18b9663b10798a2bd800173df3bfbca4a87650 had an extra $(GLOBJ)
macro in the build line for psfilters.dev. On Linux this doesn't seem
to be a problem, but nmake (Windows build in Visual Studio) throws
an error.

Just remove the extraneous macro.

base/lib.mak


2018-06-13 16:27:32 +0100
Chris Liddell <chris.liddell@artifex.com>
ca18b9663b10798a2bd800173df3bfbca4a87650

Move the PS Level 1 filters into 'base/'

Oddly, Level 2 filters were already in 'base/', but the Level 1 filters were
still (partially) in 'psi/' (but at least one was partially in base/).

This not only moves the code, but puts both Level 1 and 2 filters into a
'feature' .dev (called psfilters.dev) - on the basis we don't really support
building as a Level 1 only interpreter any more.

It is still up to the interpreter makefile(s) to include the dependency on
psfilter.dev to get these built in.

This is tidier than before, but primarily done so the SubFileDecode filter
is available for use by the in-development C based PDF interpreter.

base/lib.mak
base/sfilter1.c
psi/int.mak


2018-06-12 10:08:09 +0100
Ken Sharp <ken.sharp@artifex.com>
e0b4f52ee1904ff3f1cf72d86163321b2f9d6357

Fix PageList when the last page in the file is not included in the list

It was possible to run off the end of the array of pages if the last
page was not included in the list of pages to be printed.

Also, the trailing '-' syntax (from page 'n' to the end of file) was
off by one printing the initial page.

base/gdevflp.c
base/gdevflp.h


2018-06-11 11:31:05 +0100
Ken Sharp <ken.sharp@artifex.com>
bc0b0ff9bd8dbdd91a142b46a0e5f5168c13306d

Better fix for bug #699404

Bug #699404 "Failure with psdcmyk -dGraphicsAlphaBits=4 -dFirstPage=1 -dLastPage=1"

The commit 3347a19f6fd89fc1b7d9644ff6c4703897501f7e did fix this problem
but it left a more serious underlying problem. The devices in the chain
weren't being updated to note that the standard subclassing devcies had
been installed.

This could lead to them being installed multiple times, and also to
taking the wrong code path and failing to update the device methods
when required.

This commit unwinds the previous one in gdevprn.c and applies a better
fix in gdevkrnlsclass.c

base/gdevkrnlsclass.c
base/gdevprn.c


2018-06-08 14:05:24 +0100
Ken Sharp <ken.sharp@artifex.com>
a219c745f5fd3bcf38da40f64c5b7cd053721a16

Documentation update - PageList

Update use.htm to make it clear that using PageList will override any
values for FirstPage and LastPage.

doc/Use.htm


2018-06-07 16:16:08 -0600
Henry Stiles <henry.stiles@artifex.com>
493066fceed538d3c499221aea8e085fba86c827

Add PCL symbol sets: PC-865 Norway and PC-860 Portugal.

pcl/pl/plsymbol.c


2018-06-06 17:25:00 +0100
Ken Sharp <ken.sharp@artifex.com>
3347a19f6fd89fc1b7d9644ff6c4703897501f7e

Move installation of standard subclassing devices

Bug #699404 "Failure with psdcmyk -dGraphicsAlphaBits=4 -dFirstPage=1 -dLastPage=1"

The installation of the devices in gdev_prn_open() was slightly too
early, the procs can still (quite reasonably because this is part of
the device installation) be altered by gdev_prn_allocate_memory().

If we had already subclassed the device, then the procs of the
subclassing device (ie firstPage/LastPage) would be altered rather than
the real target device's procs. This led to the wrong graphics library
call, which produced an error.

Moving the subclassing later in the installation solves the problem.

base/gdevprn.c


2018-06-05 10:16:26 -0600
Henry Stiles <henry.stiles@artifex.com>
bfbd2a02cd39c799d5d5f2d9850fb0fd06e57b7a

Fix #699390 - text position wrong.

The PCL current position (CAP) can be in two states: floating or
fixed. Floating tracks the origin with margin and orientation changes
fixed does not. The CAP is floating until we have printable data or a
command that affects the cursor position is received. We were
mistakenly resetting the the CAP from fixed to float for orientation
changes resulting in incorrect text position.

Norbert Janssen provided the analysis and code change for this fix.

pcl/pcl/pcpage.c


2018-06-01 17:40:09 +0100
Ken Sharp <ken.sharp@artifex.com>
e997c6836d243ab37fe3a5f0d57974af95eb5eac

pdfwrite - drop UTF16-BE DOCINFO strings when creating PDF/A-1

Bug #699392 " XMP metadata missing when trying to create PDF/A "

Its not obvious, but it appears to be impossible to embed UTF-16BE
strings in XMP metadata and have them be validated against the same
string in the Info dictionary, because of the specified method for
comparing such strings.

PDF/A-2 states that the document information dictionary should be
ignored, in contrast to the PDF/A-1 specification which says the
XMP and Info dictionary information must be consistent. So this
problem can't arise there.

This commit detects the use of any UTF-16BE string in a DOCINFO
pdfmark and use the usual PDFACompatibilityPolicy to decide whether to
abort PDF/A-1 production, drop the string or raise an error.

devices/vector/gdevpdfm.c


2018-05-30 15:59:32 +0100
Ken Sharp <ken.sharp@artifex.com>
71de6d0f9c2a48d6e4a69287b2123bf9efd6df88

txtwrite - Increment character index in text enumerator

Bug #699391 "segfault in txtwrite_process_plain_text()"

We need to increment the text enumerator character index no matter what
kind of operation this is, we had omitted it in the
TEXT_FROM_SINGLE_GLYPH case.

devices/vector/gdevtxtw.c


2018-05-28 17:39:55 +0100
Robin Watts <robin.watts@artifex.com>
7a91a08d9c78b5e37b0d434ffaafa30aa1d680ad

Bug 699382: Fix UTF-8 encoding screwup.

Also fix utf8_to_wchar making wchar buffers longer than required.

base/gp_wutf8.c
base/gsargs.c


2018-05-24 16:37:15 +0100
Chris Liddell <chris.liddell@artifex.com>
fa7a350708d393bad28dffff22da4f96ba037001

Ghostscript documentation pages revised to new look and feel

doc/API.htm
doc/AUTHORS
doc/C-style.htm
doc/Changes.htm
doc/Commprod.htm
doc/DLL.htm
doc/Deprecated.htm
doc/Details.htm
doc/Details8.htm
doc/Details9.htm
doc/Develop.htm
doc/Devices.htm
doc/Drivers.htm
doc/Fonts.htm
doc/Helpers.htm
doc/Hershey.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/gs-style.css
doc/gs.css
doc/images/.DS_Store
doc/images/Artifex_logo.png
doc/images/favicon.png
doc/images/ghostscript_logo.png
doc/images/hamburger-light.png
doc/images/x-light.png
doc/index.js
doc/sample_downscale_device.htm
doc/style.css
doc/subclass.htm
doc/thirdparty.htm


2018-05-24 09:21:17 +0100
Ken Sharp <ken.sharp@artifex.com>
1eab394d3715ac37eca4ee3d4b139520166f37f4

Improve FirstPage/LastPage image data handling

commit e92f7cbadec35ced4e38d2be9bf13fe4f362aa59 had the right idea but
erroneous implementation. We can't simply cast the image enumerator,
because we didn't allocate the enumerator that way.

Instead, add the expected height and tracking variable to the individual
enumerator.

Implement for object filtering device as well.

base/gdevflp.c
base/gdevoflt.c


2018-05-23 15:57:16 +0100
Ken Sharp <ken.sharp@artifex.com>
59dce27871a39a9f161aaaf0e852dbd05ba009fe

PDF interpreter - fix illegal CIDSystemInfo dictionaries

Bug #699294 " Ghostscript giving errors for attached pdfs and generating blank tiffs"

The supplied example file has several CIDFonts embedded which have
illegal CIDSystemInfo dictionaries; they are missing the required
Registry and Ordering entries.

A long time ago we discarded the CIDSystemInfo from the CIDFont and
created a dummy one, which is why the reporter thinks this 'used to
work'. It didn't. Discarding the information caused problems with the
pdfwrite output.

In this case we simply manufacture the missing data. Its wrong, but it
allows the file to proceed to completion. Naturally we emit a warning
so that users know their file is garbage.

Resource/Init/pdf_font.ps


2018-05-23 09:14:07 +0100
Ken Sharp <ken.sharp@artifex.com>
e92f7cbadec35ced4e38d2be9bf13fe4f362aa59

First/Last page - Fix image data handling with proc data source

Bug #699215 "Subclassing device leads to infinite(?) loop"

When processing images, its acceptable for the subclassed device to
return 0 (need more data) in response to image_plane_data, if the
source is a file, because the file will reach EOF and the code will
properly terminate.

For procedural (or string) data sources this isn't true. The code needs
to keep track of the number of rows of image data received, and return
1 (completed) when we have received enough data.

Fixed the object filtering device at the same time.

base/gdevflp.c
base/gdevoflt.c


2018-05-22 14:47:54 +0100
Ken Sharp <ken.sharp@artifex.com>
b61071c9411c3f6aa0dd594da2c5a20ff4ecd914

Replace EOI marker in JPEG passthrough

Bug #699216 " JPEG passthrough appears to truncate JPEGs in some cases"

The IJG JPEG implementation consumes the EOI marker before the JPEG
passthrough code gets to see it (in general). Most PDF consumers don't
care, but some seem to, so when we terminate the DCT decompression
send the EOI marker to the passthrough code.

base/sdctd.c


2018-05-22 14:04:31 +0100
Ken Sharp <ken.sharp@artifex.com>
4a288cb8678517c578b336b3d26e5c4115906624

Fix conversion from PDF time to XMP time for pdfwrite

Bug #699182 " Invalid XMP metadata and possibly invalid memory access for dates without timezone in pdfmark"

Two different problems; in the first case a '>' should be '>=' so that
we properly identify an empty string.

Then when converting the string, there was a different off-by-one error
in the buffer index. Also corrected a comment while passing.

devices/vector/gdevpdfe.c


2018-05-22 10:51:46 +0100
Ken Sharp <ken.sharp@artifex.com>
16ad4cc70918da40f62a919e11187dfb72f4ff63

Prevent use of CID 0 in a PDF/A output file.

Bug #699375 "PDF/A 1b / 2b Validation fails after conversion with Ghostscript on some files"

The input file(s) use CID 0 (which is defined as the /.notdef glyph)
which is illegal in PDF/A files.

'Fixing' this would require us to alter the CID, change the CMap and
the ToUnicode CMap, and runs the obvious risk of the CID we use as a
replacement being used later in the document. We could avoid this by
scanning for 'holes' in the CMap, but even that potentially leaves us
with a problem if there are no empty entries in the CMap.

Since we can't guarantee fixing the problem, a partial fix would be a
great deal of coding, would almost certainly introduce a bug tail and
still wouldn't guarantee a compliant result, don't try. Instead if we
encounter this condition abort PDF/A output, or throw an error if the
PDFACompatibilityPolicy is set that way.

devices/vector/gdevpdtc.c


2018-05-17 14:30:40 +0100
Chris Liddell <chris.liddell@artifex.com>
48e4565e967eae091b97a9037e77016d8d99f3ce

Bug 699329: add display device to default Unix build.

Previously it was only included in the .so build (it doesn't really make sense
in a monolithic exe build). But since we now have a "supported" static library
build, it makes sense to include it.

configure.ac


2018-05-17 07:35:02 +0100
Chris Liddell <chris.liddell@artifex.com>
891ea7d2813edaa3c7c874a4053afdda128e8a10

Fix for small glyph distortion

Glyphs with very few pixels (i.e. lower case "i" in 9pt text rendered at 72dpi)
we being distorted due to the specific rules applied by Freetype's dropout
compensation. This isn't a full solution but resolves the change in behaviour
between 2.7.x and 2.9.x (the change was due to different rounding being
applied).

This fix is from upstream:
http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=f1458d2e44d8

So should be in future Freetype releases, and not need re-applied here.

freetype/src/base/ftobjs.c


2018-04-03 15:49:48 +0100
Chris Liddell <chris.liddell@artifex.com>
9cb169b6b260f650aac2c3c7ed7af0f345ee0707

Work around a behaviour change in freetype > 2.8

Freetype will throw an error when we try to retrieve the glyph if the x/y
advance values are too big to fit in a 16.16 fixed point value.

Since we have no need of those values, set them to zero, and avoid the error.

Bring freetype up to 2.9.1

Plus the gs makefile changes to support the new version.

Reapply "Work around a change in the zlib API for 1.2.11"

for Freetype
commit: 08482c582115a1396d0fd9186011008f889a61c5

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/ChangeLog.27
freetype/ChangeLog.28
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/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/newline
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
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.mk
freetype/builds/unix/pkg.m4
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.vcproj
freetype/builds/wince/vc2005-ce/index.html
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.MAC
freetype/docs/INSTALL.UNIX
freetype/docs/INSTALL.VMS
freetype/docs/MAKEPP
freetype/docs/TODO
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-parameter_tags.html
freetype/docs/reference/ft2-pcf_driver.html
freetype/docs/reference/ft2-pfr_fonts.html
freetype/docs/reference/ft2-properties.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-t1_cid_driver.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/freetype/config/ftconfig.h
freetype/include/freetype/config/ftheader.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/ftdriver.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/ftparams.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/cffotypes.h
freetype/include/freetype/internal/cfftypes.h
freetype/include/freetype/internal/ftcalc.h
freetype/include/freetype/internal/ftdebug.h
freetype/include/freetype/internal/ftdrv.h
freetype/include/freetype/internal/ftgloadr.h
freetype/include/freetype/internal/ftmemory.h
freetype/include/freetype/internal/ftobjs.h
freetype/include/freetype/internal/ftpic.h
freetype/include/freetype/internal/ftpsprop.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/svcfftl.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/svmetric.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/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/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