summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Update stuff for releaseghostscript-9.15ghostpdl-9.15gs915Chris Liddell2014-09-2261-64/+64
|
* Bug 695492: fix seg fault regression with '-h'Chris Liddell2014-09-171-7/+9
| | | | | | | | When called with the '-h' parameter, we don't fully initialise the PS interpreter. In which case, we shouldn't try to use the PS interpreter when we shut down. No cluster differences.
* Update docs, dates etc for second release candidate.ghostpdl-9.15rc2Chris Liddell2014-09-1660-63/+211
|
* Bug 695483: disable BGPrint before we shutdown interpreterChris Liddell2014-09-162-0/+22
| | | | | | | | | | | | | Before we start the process of shutting down the PS interpreter, disable BGPrint (and set NumRenderingThreads to 0, just for safety). If we don't do this, the "parent" rendering thread will continue preparations for the next page whilst we shutdown the interpreter, and will thus attempt to access some objects subject to garbage collection (such as the I/O device table). Additionally, when a device switches from BGPrint enabled to disabled, make sure we tear down the rendering thread(s) and get rid off the BGPrint related data. No cluster differences.
* Bug 695486: initialise c_alone in current chunk (cc)Chris Liddell2014-09-161-0/+1
| | | | | | | When we (re-)initialise an allocator, we have to initialise the contents of the current chunk (cc) entry - initialise to "false" since that's the common case. No cluster differences.
* pdfwrite - free pdfwrite's 'complete' font copy if requiredKen Sharp2014-09-161-1/+5
| | | | | | | | | | | | | | | | | | | | Bug #695484 "Regression: seg fault with debug build in pdfwrite starting with ceb5e2f006bf554a56701ee2f2c228841b324a4b" The problem was caused because pdfwrite can maintain two copies of a font, a subset and a complete copy, depending on settings. We were properly freeing the subset, but not the complete copy. This has been a long-standing undetected memory leak, but only on systems without garbage collection, because the copied font is subject to GC, and indeed this was causing the actual fault. When we restored at the end of the file, the copied font was garbage collected, which caused it to try nd free any glyphs from its font cache. But the font cache is now (since the commit in the bug title) pointing at the pdfwrite font cache, and that has already been freed before we get to the end of job restore, resutling in a seg fault. Here we free the complete font copy if one has been allocated. No differences expected.
* Fix Bug 695481 - Barcode font scaled incorrectly.Henry Stiles2014-09-161-4/+5
| | | | | | | | | | | | | | The downloaded font in this file (the barcode) used the typeface family designation of 0 which is reserved for the lineprinter font. Our interpreter scales lineprinter specially and identifies lineprinter with its typeface number (0), thus the barcode font was scaled as if it were the lineprinter font. Now we check the typeface number is 0 and the font is internal which will uniquely identify the lineprinter font and not confuse other fonts with it. Technically the font is broken and shouldn't be accepted, the typeface family numbers documented by HP should not be reused by downloaded fonts, but HP printers seem to print the job.
* Get rid of last vestiges of pswrite....Chris Liddell2014-09-1618-1717/+20
| | | | | | | | | | Remove epswrite (the final "subdevice" of pswrite) and references to it. Also remove the gdevps.c source file. Cluster differences only in files that enumerate the devices list, for example: 430-01.ps
* Add lib/viewraw.ps utility to view "raw" filesRay Johnston2014-09-161-0/+77
| | | | | | | | An extended version of lib/viewcmyk.ps so that "raw" output from bit, bitrgb or bitcmyk can be displayed or converted. For example: gswin32c -sDEVICE=bitrgb -dGrayValues=256 -o x.rgb examples/tiger.eps can be viewed with: gswin32c -dRGB -dBITS=8 -- lib/viewraw.ps x.rgb 612
* Update docs, versions and dates for release candidate.ghostpdl-9.15rc1Chris Liddell2014-09-0860-129/+5431
|
* pdfwrite - tidy up some compiler warningsKen Sharp2014-09-082-13/+11
| | | | No effect, just silences the compiler or scan-build.
* Remove the uproduct and co targets.Chris Liddell2014-09-051-8/+20
| | | | | | | Replaced (for now) with a brief message about being unsupported, and to use configure --with-ufst=<> No cluster differences.
* Better mkromfs support for cross compileChris Liddell2014-09-051-3/+30
| | | | | | | When cross compiling between platforms of differening endianness, mkromfs will now create output usable on the target architecture. No cluster differences.
* Tweak "search" for default CID fallback font.Chris Liddell2014-09-051-2/+11
| | | | | | | Fix an issue where the default fallback font could not be found if the GenericResourceDir was a relative path. No cluster differences.
* pdfwrite - consume Distiller params even when LockDistillerparams is trueKen Sharp2014-09-052-163/+220
| | | | | | | | | | | | | | | | | | | | | | | | | Bug #695468 "/rangecheck in .installpagedevice error when combining LockDistillerParams, setpagedevice, and restore" Previously when LockDistillerParams was true the distiller param parsing code did not get called. This left the Distiller parameter key/value pairs 'untouched' in the parameter list. Ordinarily this is not a problem, but .installpagedevice, which is called during restore to reset the page device parameters, insists that all keys must be consumed and throws an error if they are not. This patch alters the distiller parameter parsing to read all the parameters no matter what the setting of LockDisillerParams. The values are read into a dummy parameter structure, when complete they are either copied back to the real structure or, if LockDistillerParams is set, discarded. If we discard the parameters we clean up the memory rather than relying on garbage collection to do it for us. I don't think the pdfwrite device currently does this when the device is closed, which would be a memory leak, if we ever decide we need to address this then we can use the code here. No differences expected.
* Improved form handling of clip areasKen Sharp2014-09-041-9/+11
| | | | | | | | | | | | Bug #695307 "Preservation of PostScript form elides form content" When a device (such as pdfwrite) hands back a matrix to set as the CTM (pdfwrite does this to capture the form unscaled), we need to account for that CTM when we reset the clip, otherwise we can end up clipping content. Also, rather than using +/- page boundaries, we use +/- the form BBox. This shows 2 minor progressions in the test suite.
* Address leaking font cache in PCL interpreterKen Sharp2014-09-025-2/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug #695017 "pcfont_do_reset() leaks memory" The PCL interpreter should free its font cache on exit, but it does not. This is because of the fact that when we copy fonts the font cache of the original font is copied to the font cache of the copied font. Later, when a high level device wants to retrieve glyph information, the font code uses the font cache from the copied font. This doesn't immediately seem like a problem, it seems like we should be able to defer freeing the font cache until after we've closed the device, and that would satisfy pdfwrite. However, the way that PCL 'passthrough' works, the PCL interpreter can be run 'inside' the PXL interpreter. If we free the PCL interpreter font cache when it exits then pdfwrite has font copies which are still pointing at the freed font cache. We did discuss having the PCL/PXL interpreter set the gs_lib_ctx font_dir (it currently dos not do so) and having pdfwrite set the font cache of the fonts it copies use that, instead of the font cache from the original font. But this seemed to me likely to run into the possibility of the same problem recurring in future. Instead, we have pdfwrite create and maintain its own font cache. When pdfwrite copies a font it replaces the font cache pointer (which is initially the same as the original font) with the new pdfwrite-specific font cache. This means that any interpreter can free its font cache and pdfwrite will still be able to use its own font cache when retrieving glyph information. This commit includes both the changes to pdfwrite to enable the new font cache and the changes to the PCL/PXL interpreter to free the font cache when the interpreter is done with it. No differences expected.
* Bug 695235: off-by-one error in trioChris Liddell2014-09-021-0/+12
| | | | | | Tweak to deal with off-by-one errors due to casting of doubles in trio. No cluster differences.
* Tweak the libtiff configure invocation to use relative paths.Chris Liddell2014-08-292-2/+2
| | | | No cluster differences.
* Add quoting around paths for libtiff configure.Chris Liddell2014-08-292-7/+7
| | | | No cluster differences.
* More work with setpagedeviceKen Sharp2014-08-281-0/+29
| | | | | | | | | | | | | | commit 55bd0a59caf26a59f852e2dec5b76ad399d9408b fixed the problems with RedValues and friends, but at the cost of preventing these keys being set by setpagedevice. This commit allows them to be set by creating a 'write only' dictioanry whose keys are removed from the initial device dictionary before we make it read-only and send it to setpagedevice. See the comments in the commit for further details. No differences expected.
* Fix setpagedevice so that changing ProcessColorModel worksKen Sharp2014-08-271-6/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug #695439 "Reference to free memory, or segfault with release build" The problem is the horrendous way our implementation of setpagedevice works. Where we should query the device for its parameters, our implementation maintains a dictionary (initially built by querying the device) which is updated by calls to setpagedevice. Clearly at some time in the past someone has discovered that this breaks badly if the device changes a parameter itself, as this won't be reflected in the saved dictionary. So the '.dynamicppkeys' dictionary was defined, whose sole purpose is to hold a list of keys whose values must be refreshed from the device. However, this dictionary is *also* used to prevent those same keys being sent to the device..... This means that commit 2eda51b48c7e97adf7c46fc3d7eb34fcdf6061e6 prevented any changes to OutputICCProfile being sent to the device. So I've now made 2 dictionaries with separate purposes, one is for 'read only' keys which should not be sent to the device, and one which contains the list of keys which must be read back from the device to replace the stored values in our dictionary. Keys may appear in both, either, or neither. The problem in this bug is that we create our initial dictionary when the device is in DeviceRGB, and we store the RedValues, GreenValues, BlueValues and GrayValues from the device in our stored dictionary. Then we execute code to change the ProcessColorModel to DeviceGray. This alters the values of the RedValues etc in the device. But these are *not* copied into our stored dictionary. Later we call .installpagedevice which does not change the ProcessColorModel, but does attempt to set the RedValues etc, which are invalid for a DeviceGray ProcessCOlorModel, leading to a rangecheck. I had hoped that adding these keys to the volatile dictionary would be sufficient to fix the problem, but it seems that we don't update our stored dictionary with these parameters. The only way to fix this turned out to be to add the keys to the 'read only keys' dictionary so that we don't try and send them to the device. I'm not completely sure this is sensible, it isn't obvious to me what these values are for, so I can't be certain that they should become 'read only'. However, its the simplest way to solve this problem. Of course the right way to fix this is to change our horrible setpagedevice code so that it works the way the spec says it should. The fix described above resolves the memory warning for me as well. No differences expected.
* pdfwrite - fix handling of Tx fields in AcroFormsKen Sharp2014-08-253-7/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug #695438 "AcroForm text fields not being rendered" There are multiple parts to this fix. 1) Alter the default of the NeedAppearances key in AcroForms and AcroForm field dictionaries to true so that if its not present we will generate Appearances for fields which have none. (we still won't generate them if the field is present and set to false, though Acrobat does) 2) Fix the Length key of the Form dictionary we generate for Tx fields, previously it was set to 0, so the form wasn't ever executed. 3) If there is no 'V' key in the Field dictionary for a Tx field, use the /DV key instead. If still no key then use an empty string. These changes uncovered some interesting additional problems. 1) Bug687498 has an AcroForm with a Tx field, declared as multiline, where the actual data is an empty string. Now that we actually execute the Form this causes an error. Add a check to treat strings with less than 2 bytes as single line, so that splitstring doesn't throw an error. 2) Bug692477.pdf, now that we default 'NeedAppearances' to true, we discover that this file has a Fields array where every element is the null object, which causes errors trying to extract dictionary key/value pairs from it. Add a check to see that the Field element is a dictionary, and ignore it if it isn't. No differences expected, we don't test with -dShowAcroForm
* Bug 695420: Bad pointer to OutputICCProfile string.Ray Johnston2014-08-201-0/+1
| | | | | | | | | | | | | | | This was caused by the gs_setpd.ps logic having a dictionary that has the OutputICCProfile pointing to dev->icc_struct->device_profile[0]->name, but when ColorConversionStrategy distillerparam is set, it does a rc_decrement on the pdev->icc_struct which frees the entire structure, among those the 'name' (which was allocated in non_gc_memory). Add the OutputICCProfile to the list of .dynamicppkeys in gs_setpd.ps so that the string will always be updated and the dictionary won't have a stale pointer. Having a dict with a string in non_gc_memory is OK I guess, even though we generally "hide" all non_gc_memory elements from the GC.
* Add a missing condition for devices that need tags to pdf14_recreate_device.Ray Johnston2014-08-201-0/+5
| | | | | Customer 532 has done extensive testing and uses tags. This change is in their code.
* pdfwrite - fix a ShadingType 5 with array DataSource and a FunctionKen Sharp2014-08-181-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug #695359 "Wrong gradients after conversion to PDF" The example file is a hand-coded shading of type 5 with the DataSource being an array, but using a function to convert the parametric value at each vertex into a colour value. The PDF specification doesn't support this kind of shading, so we need to convert it. In doing so we write out a Decode array, which needs to contain the minimum and maximum colour values. Ordinarily we get these from the shading dictionary, but when using an array for DataSource this is not present. In the absence of the Decode array we were defaulting to 0 and 1 but the function actually has a range from 0 to 10. This meant we were truncating the colour space. This commit examines the Function (if present) and uses the Domain of the function as the values instead of 0 and 1. This may not be sufficient in the absolute general case, but all mesh shadings are rare in real world files, and mesh shadings using array DataSource are still less common, as are examples with a function which does not have a Domain 0-1. So this will suffice until we see more problems. Note that Acorbat Distiller X produces different output if you run the two shadings in the example file separately instead of consecutively. Also Acrobat X displays the resulting file from both Distiller and Ghostscript incorrectly (Acrobat XI displays them correctly) No differences expected.
* PDF interpreter - read BPC from the JPX stream instead of the resource dictKen Sharp2014-08-181-50/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | Bug #695387 "PDF with jpeg2000 conversion problems" The PDF spec states (table 4.39, BPX on page 340 of the PDF Rerference) that the Bits Per Component value is to be taken from the JPX stream and the image dictionary value should be ignored if present. We were only reading the BPC if either that to the ColorSpace was missing from the image dictionary. In this commit we *always* pare the data out of the JPX stream (which is a small performance penalty). However, this always overwrites the data in the resource dictionary, which is fine for BPX< but not acceptable for the colour space, because Acrobat favours the ColorSpace in the image dictionary over the JPX colour space, and because we set the colour space to be DeviceGray for softmasks. So we save the colour space from the resource dictionary (if present), read the BPC and colour space then, if we had a colour space in the resource dictionary we restore it back again. For some reason this causes problems on the cluster with the test file Bug688845.eps. Since this change only affects JPX images, and PDF files, I can't see any way that the change can be responsible for this. I am unable to reproduce the problem on Windows or Linux locally.
* Bug 694160: Prevent malicious code being injected into the system.Chris Liddell2014-08-152-4/+9
| | | | | | | | | | | | | | | | This is essentially the same patch as committed in: 4fc4b8410d35b193d549558ab212cc727db9460b but that patch was missing white space at the ends of automatically concatenated strings - hence the interpreter saw, for example: ".systemexecend" rather than ".systemexec end". Additionally, to avoid that confusion in the future, I've removed the reliance on the automatic string concatenation. Also removed a spurious additional call to ".uninstallpagedevice". No cluster differences.
* Revert commit 4fc4b8410d35b193d549558ab212cc727db9460bKen Sharp2014-08-152-8/+1
| | | | | | | | | | | | | | See bug #694160 and #695420. Somehow this patch ends up leaving 'quit' undefined at the end of job, which breaks the '-o' switch. It also somehow manages to break at least some pdfwrite incantations, leading to an undefined error with a garbage caller. It kind of looks like the name table is broken or similar. Note that the undefined error on quit occurs when running GS interactively and even when this happens, "systemdict /quit get exec" works, so its not as simple as /quit being undefined. No differences expected.
* Bug 695423: follow up.Chris Liddell2014-08-131-2/+2
| | | | | | Fix the description comments. No cluster differences
* Bug 695423: Add current generation printers to gdevatx.cGerard Belanger2014-08-133-5/+24
| | | | | | Practical Automation printers. No cluster differences.
* ps2write - fix conversion of TrueType fonts with format 0 LOCA tablesKen Sharp2014-08-122-8/+14
| | | | | | | | | | | | | | | | Bug #695417 "gs(ps2write) produce invalid ps from certain LibreOffice print emission" The code in the opdfread prolog for converting TrueType fonts to type 42 fonts was completely broken for fonts with a format 0 LOCA table (16 bit offsets). The offending routine is StringToLoca. The code was reading 32 bits instead of 16, which causes it to exhaust the string data, leaving array members uninitialised, which is the inital cause of the error. However, it also didn't multiply the offsets it did read by 2 (format 0 LOCA offsets are multiplied by 2), and had a 'dup' which resulted in the stack having the wrong value on top on exit. No differences expected
* Bug 694160: Prevent malicious code being injected into the system.Shailesh Mistry2014-08-112-1/+8
|
* remove an unused variable to silence a compiler warningKen Sharp2014-08-081-1/+0
|
* tiffsep - add code to print CMYK equivalents for spot inksKen Sharp2014-08-082-0/+86
| | | | | | | | | | | | Bug #695407 "tiffsep should print out separation equivalent CMYK" Patch supplied by Mateusz Lenik to print out the CMYK equivalents for every ink in the job. Controlled by the new PrintSpotCMYK switch, which is only supported on the tiffsep device, documented in devices.htm. No differences expected.
* Bug 695394: fix TTF glyph encoding generationChris Liddell2014-08-051-4/+7
| | | | | | | | | | | | There was a logical error in the glyph encoding generation for TT fonts, affecting fonts without post tables. When handling the case where the same glyph name references two different glyphs, the index in the glyph encoding we wrote the generated name to was the GID (i.e. the index returned from the cmap table) rather the original index we were handling from the glyph encoding. No cluster differences.
* PDF interpreter - fix Hybrid file parsingKen Sharp2014-08-011-1/+15
| | | | | | | | | | | | | | | | | | | | | | | Bug #695403 "Error ocurred while reading XREF table" The fix for bug #694342 treated an xref section with no entries as an error and caused the xref to be rebuilt. However, if a PDF file is converted into a hybrid file (one with an xref *and* an XrefStrm) by adobe CS 3, then it does this by adding a 'dummy' xref which has a /Prev pointing to the real xref, and a /XrefStrm pointing to the stream. The dummy xref has a section "0 0", is first object 0, no objects defined which falls foul of the test for Bug 694342 and causes the xref to be rebuilt. This commit adds a boolean which is initially false and is set true in the parsing loop for the xref section. When we encounter a /trailer, instead of checking if 0 objects are defined, we now look at that boolean. If its 'true' then we have seen a section entry, and can treat this as valid, even if no objects are yet defined. If we haven't seen a section then we treat it as invalid and force an xref rebuild. This causes sumatra/694313_-_empty_xref.pdf to stop producing errors as well.
* ps2write - fix a bug in the debug codeKen Sharp2014-08-012-2/+7
| | | | | | | | | | | The PrintHex routine assumes that PostScript integers are 32 bits wide. This is no longer guaranteed with GS. This fix ensures that after we do the bit shifting to isolate 4 bits for conversion to hex, we don't have a number > 15, which could occur if the integer was sufficiently large. This prevents the code throwing an error when debugging. No differences expected
* Bug 695397: handle "unknown" glyph names >16 chars longChris Liddell2014-07-301-14/+20
| | | | | | | | | | | | | When creating glyph aliases for a TTF, we check for "formatted" unicode glyph names of the form "uniWXYZ" where "WXYZ" is the glyph code point in base 16. In doing that we use a temporary string which is 16 characters long (since the formatted names we're interested won't be longer that 16). So, check the glyph name is <16 chars long before checking if it's a "uni..." style name. No cluster differences.
* Bug 695380: add a simple sanity check in i_alloc_stringChris Liddell2014-07-301-0/+3
| | | | | | Checks for integer overflow. No cluster differences.
* Bug 695319: Set pdf14 (trans) ctx to NULL on free on errorChris Liddell2014-07-291-0/+6
| | | | | | | | | In the event of an interpreter triggered error during a transparency operation, pdf14_discard_trans_layer() is called to clean up. It frees the context, but didn't set the ctx pointer to NULL - thus we could try to free the already freed context object when the pdf14 compositor device is shut down. No cluster differences.
* Bug 695318: mark memory chunks used for single allocations.Chris Liddell2014-07-292-2/+9
| | | | | | | | | | | | | | | | | | Certain chunks in the memory manager are used to contain only one (o_alone) allocation: "large" allocations and "immovable" allocations specifically. We need to be able to identify those chunks so we don't end up trying to use any empty space in them for later allocations - these chhunks can end up with empty space in them if the original object allocated in them is shrunk. The problem that occurs is when we free an o_alone object, we immediately free the chunk containing it, thus any other allocations in that chunk are also freed. Adding a c_alone flag to the chunk means we can trivially identify and skip those chunks when searching for free memory. No cluster differences.
* Bug 695363: handle TTF with no/empty loca table.Chris Liddell2014-07-251-74/+82
| | | | | | | | | | | A broken TT font could end up with us allocating a zero length array for the for the glyph lengths, then later to attempt to access entries in that array. Thus, avoid allocating the zero length array, and treat a NULL glyph_len array the same as a glyph_len of 0. No cluster differences.
* Add setting buf->backdrop to NULL when knockout is false.Ray Johnston2014-07-241-0/+2
| | | | | Minor issue, but I did find a case where the buf->backdrop was left uninitialized when working on customer 532 issue with fts_25_2526.pdf
* xps: Remove trailing whitespace.Tor Andersson2014-07-227-28/+27
|
* xps: Allow colormapped 1-bit TIFF files.Tor Andersson2014-07-221-1/+9
| | | | Thanks to Norbert Janssen.
* xps: Improve transparency analysis for resource dictionaries.Tor Andersson2014-07-221-2/+10
| | | | Thanks to Norbert Janssen.
* pdfwrite and ps2write - Mimic the -dNOCACHE output of pswriteKen Sharp2014-07-225-5/+20
| | | | | | | | | | | | | | | | | | | | | | | | | This feature is in response to the thread on gs-devel "pswrite and NOPLATFONTS" Normally pdfwrite and ps2write try very hard to maintain fonts from the input as fonts in the output, for reasons of output size, performance and qualiity. It seems that some people are relying on using pswrite with -dNOCACHE in order to produce PostScript output with no fonts at all. (As far as I can see this is to address the limitations of other software). This was never a goal for pswrite, but it seems that it works 'well enough' to be useful. Sadly, despite us flagging the fact that pswrite had been deprecated, nobody gave us any feedback until after (several releases after, in fact) we had removed the device. We are not going to reinstate support for the pswrite device, having spent effort to remove it in order to drop support for it, so this commit adds a new feature which causes pdfwrite and friends to write the glyph description into the content stream as it is used instead of constructing fonts. This is controlled with the new switch NoOutputFonts which defaults to false There are no cluster differences with this commit. Using the switch causes pretty much every test file which contains text to render differently.
* Have pdfwrite/ps2write "flatten" glyphs...Chris Liddell2014-07-221-1/+6
| | | | ...into "normal" marking ops if the glyph cache is disabled.
* Bug 694205: prevent crash rendering unfeasibly large glyphChris Liddell2014-07-211-3/+9
| | | | | | | | | | Initialise the "prev" entry in the top node in the x line list to null and check it isn't null before we use it. If we reach that point, it indicates that a) the current path reaches (and probably passes) the limits of our coordinate space and b) the line list is already in the correct order - as best it can be, anyway. No cluster differences.