summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove stray param_signal_error call from gdevpdfimg.cRobin Watts2022-03-031-3/+0
| | | | Looks like a cut/paste error.
* PDF interpreter - fix FitPageKen Sharp2022-03-031-3/+1
| | | | | | | | | When rewriting FitPage for the new interpreter I seem to have left part of the debugging code in place, which led to two incorrect values on the stack when we calculated the scale factor. I general these values were zero, leading to a scale factor of 0 and nothing being drawn. Fixed here by removing the extraneous values.
* Overprint simulation and OutputIntent interactionMichael Vrhel2022-03-037-77/+178
| | | | | | | | | | | | | | | | | In cases where -dOverprint=/simulate and -dUsePDFX3Profile are used, if the page has overprint and no transparency push the pdf14 device and render the page to a transparency buffer to the Output intent color space. If the target device has a different ICC profile than the output intent (specified with something like -sOutputICCProfile="Fogra39.icc") then convert the output intent rendered buffer to the target device color space. Also make sure that the tiff device do not use the wrong profile in the header. Additionally, a problem was found where the pdf14 device was setting up color conversions using the perceptual rendering intent. Those transforms should be using the colorimetric rendering intent.
* If simulate overprint, make sure patterns use transparencyMichael Vrhel2022-03-031-0/+19
| | | | | | | | | | Thanks to Ken Sharp for providing the solution for this. If we are doing pattern simulation with the pdf14 device then the patterns should also do this. Otherwise we can get seg faults. For example: -sDEVICE=bitrgbtags -dNEWPDF=false -dOverprint=/simulate -r72 -o output.ppm -f tests_private/comparefiles/Bug693541.pdf
* Old PDF interpreter - improved CMap handlingKen Sharp2022-03-031-3/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | The file supplied for this came from a customer who asked that we delete the file after working on it, so there is no bug report and no reproducer for this. The problem is that the PDF file has a font using a CMap, and that CMap uses /UseCMap (and the usecmap operator) to read a different (Horizontal) CMap and then modify it with Vertical glyph positions. The CMap does not have a begincodespacerange, it simply inherits the ranges from the child CMap. This causes the code added to work around Bug 690737 to read off the end of the CMap in read_CMap_stream. Since there is nothing left to process, this causes errors in the CMap processing. Following a suggestion from Chris this commit first attempts the same 'discard up to the begincodespacerange) hackery, then checks to see if the stream has any bytes left. If it does we proceed as before. If there are no bytes left, then we have discarded all of the content. So we rewind the stream to the point we were at before we tried to discard the header, impose a different SubFileDecode, looking this time for a 'begincmap' and then attempt to process the CMap as normal.
* Date for 9.56.0 RC1ghostpdl-9.56.0rc1Chris Liddell2022-03-022-2/+2
|
* * Fix mismatch of page group push and pop conditionMichael Vrhel2022-03-021-2/+2
| | | | | | | | | | | | | | Thanks to Ken for finding this. If we are pushing the pdf14 device we may be doing this if we are doing overprint simulation or if there is transparency. Only push the page group if we have Transparency on the page (there are files which may have a page group but never use transparency op_all.pdf is an example of one). Match the conditions for pushing and popping the page group. Here we only will push the group if one exists, we have transparency on the page and we need the pdf14 device (and the device push and group push were successful).
* Squash unused variable error in pdf/pdf_image.cRobin Watts2022-03-021-1/+0
|
* Add yet another version of nmake.Robin Watts2022-03-022-0/+10
|
* Corrections to release notes.Chris Liddell2022-03-022-12/+12
|
* Fix minor rendering problems with simulate overprintghostpdl-9.56.0rc1_release_tests_002Michael Vrhel2022-03-011-11/+25
| | | | | | | | The spot colors were not being handled properly for devices that did not support spot colors. Example issues could be seen with -sDEVICE=tiff24nc -dNEWPDF=false -dOverprint=/simulate -r72 -o ./myoutputs/testout_rgb.tif -f ./myinputs/op_all.pdf
* Fix segfault issues with simulate overprintMichael Vrhel2022-03-018-17/+50
| | | | | | | | | | | | | | | | | | | | | When simulate overprint is set for a sep device, there is no need to do a simulation as the device already supports spot color overprinting. This will change in the future for cases dealing with rendering to the output intent but the target device uses a different ICC profile. This issue occurred only with pdfi. There was also a problem with the use of patterns in the case where we are doing overprint simulation. If the pattern accumulator target is the pdf14 device and we are doing overprint simulation, then it is necessary that the pattern accumulator uses transparency. This problem occurs for the old PDF interpreter and pdfi. This commit fixes the issue for pdfi. The old PDF interpreter needs an additional fix. Example command line with issues -sDEVICE=bitrgbtags -dMaxBitmap=10000000000 -dNEWPDF=true/false -dOverprint=/simulate -r72 -o testout.ppm -f Bug693541.pdf
* Update release notes: thread safety PSD/ICC profilesChris Liddell2022-02-282-0/+20
|
* pdfi with Ghostscript - normalise 'Box' arrays before use.Ken Sharp2022-02-281-1/+24
| | | | | | | | | | | | After we retrieve a 'Box' from the PDF file we use it to setup the device PageSize. However we were assuming the Box array was always in the 'normal' format of bottom left corner and top right corner. The spec is quite clear that any opposite pair is acceptable, so in this commit we 'normalise' the two corners before we process the array for the PageSize. Also remove a commented out left over piece of debug printing.
* Bug 705015: Improve handling of device references from PostscriptChris Liddell2022-02-284-35/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Ghostscript has multiple memory management models, of particular interest here are the mark, sweep and relocate garbage collection, and reference counting. Postscript objects rely on garbage collection, most internal objects utilize reference counting. In this case, Ghostscript devices are reference counted but also allocated in garbage collected memory - so are subject to both models. A problem arises when Ghostscript device objects are referenced by Postscript, previously such references were not reference counted where internal references are. So Postscript like "gsave nulldevice currentdevice grestore setdevice" would crash because the "nulldevice" created after the gsave was freed (by reference count) by the grestore, despite a remaining reference from the Postscript operand stack. This modifies the approach so Postscript references a "device container" object, and the container object references the device. The container object is garbage collected, and the device is reference counted. The device container object has a finalize method, so just before it is freed, the finalize can decrement the reference count of the device. That allows us to maintain the consistency of the device reference count, even through the Postscript interpreter. Also remove the solution for a previous, related problem, which this fix makes redundant.
* OSS-fuzz #45030Ken Sharp2022-02-281-2/+6
| | | | | | | | | | | | | | | The code to retrieve a page dictionary was assuming that, if we reached a node in the pages tree which contained a dictionary that it was a page dictionary. This file, however, has a node in the Pages tree which has a Kids array, containing a reference back to a dictionary which is the Root pf the Pages tree. This commit checks the dictionary to see if it is already in the loop detection array, if it is then we've already visited it, so this must be a circular reference. Also removed a couple of unused variables that were causing compiler warnings.
* oss-fuzz 45085: Validate the FDarray index before returning itChris Liddell2022-02-281-3/+7
|
* Coverity ID 376533Ken Sharp2022-02-281-1/+4
| | | | | | | | Recent changes in the txtwrite and docxwrite devices tipped the Coverity heuristic because we now check the return code more often than we don't. We obviously should have been checking the return code before, so let's do that here.
* GhostPDL - Alter the way annotations are resolvedKen Sharp2022-02-281-41/+145
| | | | | | | | | | | | | | | | | | | | | | | Previously we made a decision to preserve all the keys in an annotation, even non-standard ones. However this has led to continual problems with circular references; for example one file from Bugzilla has an annotation with a /BookmarkPtr entry, and the object pointed to has a /AnnotPtr key which points back to the original annotation. In addition corrupted /Parent keys (various OSS-fuzz issues) have resulted in the key/value pair not being stripped (because this is an obvious circular reference). So instead this commit adds code which only preserves keys from an annotation if they match a standard key name. This resolves both the problems noted above. I still believe that more work will be needed here, as it is potentially possible that a valid key can contain a reference to an object which has a circular reference back to the original annotation. We don't check the values associated with keys. However, we do have some mitigation in place already, and this additional may prove sufficient.
* Fix building with "local" cups sourcesChris Liddell2022-02-247-12/+30
| | | | | | Also cups device: Ignore deprecated function warnings Using gcc pragmas
* Maintain icc_profile_cache reference count....Chris Liddell2022-02-241-0/+2
| | | | | | When switching graphics states between Postscript and pdfi. Found when fixing oss-fuzz 44994.
* oss-fuzz 44994: Deal with partially initialized TTF hiting contextChris Liddell2022-02-241-0/+15
| | | | | | | | | | | | An out of memory error can leave the FT TTF hinting context in a partially initialized state. Meaning bad things can happen if we try to render another glyph using the same context. Ideally this would be handled by FT internally, but that means some implications for supporting out of spec fonts, and performance. By destroying, recreating and resetting the FT size, it invalidates the (possibly corrupt) hinting context, and ensures a fresh start in any subsequent call.
* oss-fuzz 44976: Check length of array before accessingChris Liddell2022-02-241-2/+2
|
* OSS-fuzz #44983 - Apply limits to decryption /LengthKen Sharp2022-02-243-8/+18
| | | | | | | | | | | | | We were using the /Length value supplied in the Encrypt dictionary even for encryption types where that is not valid. This commit fixes the KeyLen value for those encryption types for which it is not a variable (most of them), checks the minimum/maximum and multiple of 8 for the on really variable type, and flags warnings if the /Length is supplied for an inappropriate filter. It's possible we will see a load of files encrypted with V 3-6 which supply a /Length where they technically shouldn't, and will raise a warning. We might want to not do that in future if it proves irksome.
* devices/vector/gdevtxtw.c: fixes to work with pdfi.Julian Smith2022-02-241-1/+24
| | | | | | | txtwrite_process_plain_text(): apply part of commit 9f637a543b06 (devices/vector/gdevdocxw.c) to similar code in devices/vector/gdevtxtw.c:txtwrite_process_plain_text() to handle TEXT_REPLACE_WIDTHS; this fixes the calculation of glyph widths.
* Fix GS_PRODUCT string (missing space)ghostpdl-9.56.0rc1_release_tests_001Chris Liddell2022-02-231-1/+1
|
* Update copyright year in doc files.Chris Liddell2022-02-2229-29/+29
|
* Update strings, dates and versions for 9.56.0 release branchChris Liddell2022-02-2249-170/+88
| | | | And initial changelog/news entries
* Coverity 375685: Init the entire gs_text_params_t structure.Chris Liddell2022-02-221-2/+1
|
* Tweak pdfi repair code for ObjStrms.Robin Watts2022-02-221-4/+3
| | | | | | | | | The existing code would drop out after sucessfully reading the first object from a stream. Fix that by hoisting the code == 0 check before code > 0 check. Also, eliminate the need to assign code = 0 by modifying a code == 0 check to be a code >= 0 check.
* GhostPDF - Fix Outlines processingKen Sharp2022-02-211-81/+0
| | | | | | | | | | | | | | | | | | In a fir of mis-naming by Adobe, the /Count parameter of an Outline does not tell you how many descendants a given outline node has, it tells you how many open items there are at all levels for the initial node (or missing if there are no open outline items). For descendant nodes this is either the number of open outlines at all levels below this one (if the item is open) or the number of descendants which would appear if the item were opened if it is closed, the latter expressed as a negative value. The code was counting the total number of descendant items and using that as the /Count value, which is simply wrong. We cannot realistically determine what the correct value should be, we just have to accept whatever was sent to us. So this is just a case of deleting lots of code.
* GhostPDF - Performance enhancement don't cache type 3 sub-functionsKen Sharp2022-02-217-36/+92
| | | | | | | | | | | | | | | | | | | | | | The test file /tests_private/pdf/pdf_1.7_ATS/WWTW61EC_file.pdf exhibits a marked performance problem on page 2. This is because it has many shadings, each of which use one of a small number of functions. We cache the functions, as with all objects, so would expect these to be processed efficiently. However, the functions are type 3 stitching functions and each one has 255 sub-functions. This means that as we process the function array we eject every cached item (and then some of the sub-functions), which means that we lose the benefit of the cache. This commit adds 'nocache' options to the derefrencing code, and new options in array and dictionary handling to retrieve objects without adding them to the cache. We only actually use the nocaching array routine, but it seems worth having a matching dictionary version available. This improves the performance of the file in question by a factor > 10.
* Ignore return value from replace_cache_entry() for fontsChris Liddell2022-02-214-17/+6
| | | | | Even if we cannot cache the instantiated font object, we can still use it, so don't treat a failure to cache as a "hard" error.
* oss-fuzz 44855: Don't ignore Freetype error codeChris Liddell2022-02-211-0/+4
| | | | | | In one of the "in extremis" fallback cases, the return code from Freetype wasn't being acted upon, leaving a partially initialised glyph bitmap, that we subsequently attempt to use, resulting in a crash.
* oss-fuzz 44903: Rearrange error cleanup for Type1C/CFF fontsChris Liddell2022-02-211-14/+10
| | | | To avoid potential double free.
* Bug 703013: Fix color_info for buffered/wrapped X11 devicesChris Liddell2022-02-211-3/+3
| | | | | | | When I rejigged the buffered mode for the X11 devices when using a color depth that we have to "hide" from the rest of Ghostcript, I got the "color_info" and the "orig_color_info" logic reversed when setting up the memory buffer device.
* "cups" output device: Support for Apple Raster (URF) outputTill Kamppeter2022-02-203-1/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apple Raster (aka URF) output: With -sDEVICE=appleraster or -sDEVICE=urf (instead of -sDEVICE=cups) the output is in the Apple Raster format and not in CUPS Raster format. The format is used by Apple's AirPrint which allows printing from iOS devices. Due to this practically all modern printers understand this format and so providing it allows easy, driverless printing. Before, in order to output Apple Raster, the gstoraster filter of cups-filters had used the "cups" output device of Ghostscript to produce CUPS Raster and after that the rastertopwg filter of CUPS had to turn this into Apple Raster. With this commit a future version of cups-filters can let gstoraster (the ghostscript() filter function) directly output Apple Raster and this way save one filter step. Outputting Apple Raster instead of PWG Raster (which we could already do via -sDEVICE=pwgraster) is trivial. One has only to tell the cupsRasterOpen() function of libcups to write Apple Raster headers instead of PWG Raster headers by a simple flag, so this commit consists mainly of the definition of the output device names "appleraster" and "urf" and make the output device set said flag when one of these device names is used. I have defined two device names for exactly the same thing, as I am not really sure which one is the better or if one could cause any problems. We could remove one later if needed. The output is absolutely identical for both. Apple Raster support was introduced to libcups in CUPS 2.2.2, so the CUPS 2.2 API does not contain it necessarily, therefore the 2.3 CUPS API is the minimum requirement by the ./configure script to build Ghostscript with Apple Raster/URF output support. The libcups which is included with the Ghostscript source is too old, and when you build with it (--with-local-cups) you will not get Apple Raster support. But remember that this build option is only for development and debugging and not for production. The commit also contains a bug fix: devs.mak hard-coded -I./cups/libs/ in the compilation command line of gdevcups.c, making always the included cups/raster.h being used instead of the system's one and so always having a too old cups/raster.h which suggests that Apple Raster is not supported. This I have fixed by removing the -I./cups/libs/, --with-local-cups works also without.
* OSS_fuzz #44852 - copy/paste error in pdfi_o_BDCKen Sharp2022-02-191-1/+1
| | | | | | | | The object type check for the properties was checking the wrong object (almost certainly a copy/paste from the top of function). Not a problem for well-formed files, but the test file had an integer instead of a name, trying to access the 'data' property of the name led to a read from random memory.
* Coverity 375485: Initialise variable.Robin Watts2022-02-183-0/+5
| | | | | Technically, probably not actually required, as no one ever uses total_in, but this doesn't hurt.
* Coverity 375663: Avoid uninited fields.Robin Watts2022-02-181-0/+1
| | | | Probably unnecessary, but this is cleaner.
* Change pdfi_apply_SubFileDecode_filter terminator string.Robin Watts2022-02-184-23/+6
| | | | | Don't make it take a pdf_obj, let it take a raw string. This avoids callers needing to allocate/free an object each time.
* Coverity 375685 (redux): Init offset values before count characters.Chris Liddell2022-02-181-1/+1
| | | | | | Same as 1f2e9b2a9f54af7645bb2641ff7e716f93eb5d30 but for delta_space entries. Benign problem as the glyphs aren't rendered, but safer.
* Coverity IDs 374941, 375552, 375572 (redux)Ken Sharp2022-02-181-4/+5
| | | | | There were obviously duplicate cases of these which I missed because I find the Coverity web interface hard to use. Fixed them here.
* OSS-fuzz #44781 - Don't try to set colour space name if creation failsKen Sharp2022-02-181-4/+6
| | | | | | | | | Says it all really. We store the colour space name for named spaces, so we can spot attempts to change colour space using the existing current space. But if we fail to create/set the space, then it doesn't exist, so we can't apply the name to it.
* Coverity ID 375475 - uninitialised variableKen Sharp2022-02-181-10/+10
| | | | | | | | | | In practice I think this is not actually possible to hit, but it's easy to solve, so let's make certain. Simply pass a NULL instead of &gnstr, the function already deals with a NULL parameter. Also fixed a number of comments that had somehow had whitespace changes.
* Coverity 375564: Avoid uninitialised variable.Robin Watts2022-02-171-2/+2
| | | | | | | | When we call zscreen_enum_init with a screen that doesn't set spot_function it can get copied into the graphics state. I couldn't satisfy myself that this never actually matters, so I settled for initing everything to zero for clarity. This is not speed critical code.
* Coverity IDs 374941, 375491, 375506, 375529, 375552, 375572Ken Sharp2022-02-171-7/+16
| | | | | | | | Set the client_color 'pattern' member to 0 before calling gs_setcolor. Make sure we can't try to call gs_setcolor without initialising at least one paint value, by checking the number of components in the space is at least 1.
* Coverity 372811 and 372839.Julian Smith2022-02-171-2/+2
|
* Coverity 375568: Tweak initialisation of px_args_t.Robin Watts2022-02-171-2/+1
| | | | | | | | Because args.pv[1] is non-zero, and all the rest are zero, pxSetHalftoneMethod won't access args.source, but Coverity can't see this. For clarity, we update the init of args to clear the whole lot.
* Coverity 375614: Initialise pixinfo.id to gx_no_bitmap_id.Robin Watts2022-02-171-0/+1
| | | | Certainly shouldn't hurt, and may genuinely be a bug.