summaryrefslogtreecommitdiff
path: root/gpdl
Commit message (Collapse)AuthorAgeFilesLines
* Coverity 384816: Remove logically dead code in tifftop.cRobin Watts2023-05-101-2/+0
| | | | | | "planar" can either be PLANAR_CONTIG or PLANAR_SEPARATE. We've checked for PLANAR_CONTIG earlier, so no point in checking we're not PLANAR_SEPARATE later.
* gpdl: Support Multipage TIFFs.Robin Watts2023-05-081-7/+24
| | | | | | | | | | | This supports the common form of Multipage TIFFs, whereby a single TIFF has multiple IFDs. We do not yet support the (much rarer) form of multipage TIFFs whereby we have a single IFD with sub-ifd's in it. Those are supposedly used for strange things like multiple subsamplings of the same image, so are probably not actually what we want anyway.
* gpdl: Refactor tiff image decoding into subroutine.Robin Watts2023-05-081-483/+489
| | | | | | Hopefully no change in behaviour. This opens the way for multi-image support.
* GPDL Tiff: Fix alpha blending.ghostpdl-10.01.1-gse-10174Robin Watts2023-04-061-9/+32
| | | | Improve error messages.
* GPDL: Fix endian issues with 16bpc tiffs.Robin Watts2023-04-061-0/+28
|
* gpdl: tiff handler; fix leak.Robin Watts2023-04-051-3/+7
| | | | Seen with the second tiff from bug 706539.
* Bug 706539: Fix crash seen when decoding 2 tiffs in a row.Robin Watts2023-04-051-0/+3
| | | | | | | | After decoding the first tiff, we free the buffer used to hold the tiff, but forgot to reset the size of the buffer. This meant that on trying to read the second tiff, we'd attempt to use an empty buffer, and crash.
* GPDL Tiff: Rework alpha support for planar.Robin Watts2023-04-051-18/+108
| | | | This stops the crash seen in Bug 706534.
* Update postal address in file headersChris Liddell2023-04-0412-33/+33
|
* Remove stray duplicated file.Robin Watts2023-02-281-715/+0
|
* Fix memory leak seen in apitest using gpdl.Robin Watts2023-02-221-4/+5
| | | | | | | | | | | A C parameter list leaks when used in gpdl. Presumably this is not seen in gs operation because of garbage collection. We already have a function to allocate a C parameter list (gs_c_param_list_alloc). We've always been releasing this (gs_c_param_list_release), but that just releases the contents not the list itself. Add a new function (gs_c_param_list_free) that both releases and frees, and call this as appropriate.
* Fix SEGV seen in overnights with oxford.tif.Robin Watts2023-02-091-1/+5
| | | | | | | For PLANARCONFIG_SEPARATE things, we need to get the 3 components one after another. We were overrunning the end of the buffer. gs -sDEVICE=png16m -o out.png ../tests_private/tiff/oxford.tif
* Avoid warnings in GPDL with stream init.Robin Watts2023-02-061-3/+2
| | | | Use the stream init functions.
* Bug 706265 (Continued): Fix previous GPDL tiff decoder fix.Robin Watts2023-02-061-6/+8
| | | | | | | The previous fix to avoid integer overflow was monumentally broken. Less monumentally broken code here.
* Bug 706270: Avoid palette access overrun in gpdl tiff handler.Robin Watts2023-01-101-1/+6
|
* Bug 706265: Guard against uint32_t overflows in GPDL Tiff handler.Robin Watts2023-01-101-12/+79
|
* Bug 706048: Detect overflow in gpdl png handling.Robin Watts2022-11-221-0/+7
| | | | Give an error, rather than setting ourselves up to fail later.
* Fix leaking PNG data from gpdl.Robin Watts2022-11-221-0/+9
|
* Fix buffer handling in ASCII code in txt handling.Robin Watts2022-10-211-2/+1
|
* Add text file interpreter for gpdl.Robin Watts2022-10-212-0/+855
| | | | | | | Spots ascii/utf8/utf16 and feeds to PCL interpreter. May need further tweaking with both text file spotting and font selection, but it's a decent start.
* Bug 705931: Avoid double encoding filenames with gs under gpdl.Robin Watts2022-10-041-0/+7
| | | | | | | | | | | | | When the postscript interpreter is run by itself, it has to cope with decoding arguments supplied on the command line into our internal format of utf8. For windows, this means that it has to cope with converting from 'local' encoding to utf8. When we run gs under gpdl this decoding is done under the pl level, so it's important that gs does not do such decoding otherwise it will 'double decode'. Accordingly, disable the decoding in the psitop.c layer.
* Update GPDL SO target.Robin Watts2022-09-271-2/+9
| | | | Link with an external SO lib, rather than calling out to an exe.
* Add gpdl support for SmartOffice integration.Robin Watts2022-09-191-1/+14
| | | | | No actual SmartOffice code here, just the framework for adding the (private) "SO" interpreter.
* Bug 705075: gpdl - Avoid unintended side effect of -dNODISPLAYChris Liddell2022-03-171-1/+1
| | | | | | | | | | | We need to initialise Ghostscript with the nullpage device when calling it via gpdl (so we can later replace the nulldevice with the "real" output device). Using the "shortcut" of "-dNODISPLAY" to install the nulldevice as the initial device ends up disabling the interactive prompt between pages. This just changes things specify "-sDEVICE=nullpage" explicitly, avoiding that problem.
* gpdl: Fix overrun while looking for UEL in various gpdl interpreters.Robin Watts2022-01-197-13/+13
| | | | | Spotted by valgrinding the file/command line from bug 704692. Sadly, this doesn't fix the actual problem though.
* Add pdfi to gpdlChris Liddell2021-12-071-0/+1
| | | | | Means extending the pdf_detect_language() to check the first five (rather than two) bytes in the input.
* Fix for setting of PageSpotColors Bug 704660Michael Vrhel2021-11-051-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | plmain.c should not be setting the PageSpotColors value. This should be set by the individual interpreters on a per page basis. This change fixes a crash (Bug 704660) reduces the number of closing and opening times of the device with pdfi and pdfi renders more than 4 spots to the separation devices just fine. Also for gpdl with HEAD, the subsequent execution of a PS file following a PCL file did not properly reset the PageSpotColors to -1 as is required for PS files, resulting in improper output when going to a separation device. This commit includes a fix for that. Tested with command line gpdl -sDEVICE=psdcmyk -r72 -o ./myoutputs/pdl_input_%d.psd ./myinputs/owl.pcl ./myinputs/Ad_InDesign.ps ./myinputs/spots_multi_page.pdf ./myinputs/input.xps ./myinputs/deviceNImage.eps ./myinputs/DeviceN_20Colors.pdf ./myinputs/page_spots/Ad_InDesign.ps to verify that the number of spots was getting properly set with each interpreter and page (when applicable) change.
* Remove redundant entries from pl_interp_characteristics_tChris Liddell2021-08-259-31/+0
| | | | | | | | | The manufacturer, version and build date entries in the pl_interp_characteristics_t were never really used except for version, which was just set to the GS_VERSION. Remove the pointless entries, and use a more direct approach to version reporting.
* Commit pdfi to master.Robin Watts2021-08-122-0/+1573
| | | | | | | | | | | This is a commit of the pdfi branch to master, eliminating the traditional merge step. The full history of the pdfi branch can be seen in the repo, and that branch is effectively frozen from this point onwards. This commit actually differs from pdfi in a small number of whitespace changes (trailing spaces etc).
* Add -dRESETRESOURCES option for gpdl.Robin Watts2021-08-107-7/+14
| | | | | | | | | | | | | | | | | | In this instance 'RESOURCES' means fonts, macros, symbol sets etc. This applies to PCL (and maybe others), but not Postscript resources. Default (and setting this to 0) gives the behaviour where resources are never reset based upon job language changes. Setting this to 1 causes resources to be reset between jobs (whenever we return to PJL). Setting this to 2 causes resources to be reset whenever we "change language". For this setting, we do not count returning to PJL and reentering the same language as being a language change. (Includes fixes and code from Henry Stiles).
* Update copyright to 2021Chris Liddell2021-03-1510-10/+10
|
* Remove Luratech integration code/makefilesChris Liddell2021-02-222-209/+0
|
* Bug 703336: Fix GPL crash with jpg input on 64bit windows.Robin Watts2021-01-142-8/+60
| | | | | | | | | | | | | | | | | | | The Jpeg code uses setjmp/longjmp for error handling. On Windows at least, in 64bit builds, jmpbufs need to be 16 byte aligned. This is generally achieved by malloc blocks being 16 byte aligned, and structures have their offsets calculated so that their contents lie at appropriate positions. Unfortunately, our malloc routines only align to 8 byte aligned. We therefore bend the jpgtop.c code to align the jmpbuf manually. Similar tricks are required in the pngtop.c code, which also uses setjmp/longjmp, but a slightly different approach has to be taken as the png routine allocates the structure with the callback in itself, so we don't get to align just that. Instead, we modify the allocation routines that we provide to pnglib so that blocks are correctly padded.
* Fix GhostPDL TIFF reader to be able to handle tiff32nc output.Ray Johnston2021-01-121-0/+2
| | | | | | The PHOTOMETRIC_SEPARATED case would only handle num_comps == 3, but the tiff32c device creates 4 component images with PHOTOMETRIC_SEPARATED. Allowing 3 or 4 components works.
* Change order of compiler options for third party libsChris Liddell2020-10-061-1/+4
| | | | | | | | | | | | | Move the compiler parameters around so the third party lib specific -I options come first - hopefully meaning we'll favor any included headers over those in the system include path(s). This assumes the compiler searched include directives given on the command line left to right. Apparently this used to be a problem, I've not found a recent compiler that breaks that assumption (yet!). This applies to: expat, freetype, ijs, jbig2dec, jpeg, jpegxr, openjpeg, png tiff and zlib
* gsapi_set_param improvements.Robin Watts2020-08-031-4/+2
| | | | | | | | | | | | | | | | | | | | | Allow for a 'parsed' param type; this leverages the functions in gsparaml.c to parse an input string into a param list, coping with dictionaries and arrays. We update those functions to improve behaviour on more exotically formed numbers ("- 0.3e-10" etc), on 'tricksy' inputs (e.g. "<< /Foo (>>) >>" etc) and to cope without relying on whitespace (e.g. "<</Foo/Bar/Baz[1 0]/Fizz<1234>/Bang(A)>>" etc). Update pl_implementation set_param entrypoint so that the language interface itself is based upon param lists, rather than typed params. Update both implementations of gsapi_set_params so that if we are too early in the setup process stuff goes into the list and is held until we have devices/languages to pass it to. Also add a flag to allow for 'more to come' so that we can effectively set multiple params at once.
* Extend gpdl to cope with being fed PDFs via run_string.Robin Watts2020-07-071-1/+59
| | | | | | | | | | | | | | | | | | | | | | | | | More generally, we can now cope with any language implementation requesting that data being fed in via run_string should be buffered up and then fed in via run_file instead, so formats that require seeking can cope. We add a new gs_error_NeedFile error code. If a run_string implementation returns this, the calling gpdl layers captures the unused incoming data into an internal "buffered_file" object. When we reach run_string_end, we then register a new filing system with gs_add_fs() to allow this buffered file to be found. We then run that file using the standard run_file mechanism. Then we remove that filing system, and free the buffered file. The only implementation that currently uses this is the postscript one, which is amended to skip over leading whitespace and comments, looking for a PDF header. XPS already has a mechanism in it for collating data into a file using run_string, but this was broken (due to process_eof not being called). Fixed here, but still using its own mechanism rather than gs_error_NeedFile for now.
* Remove unused remnants from gpdl/pngtop.cRobin Watts2020-06-251-61/+0
|
* GPDL: Remove "min_input_size" from pl_interp_characteristics_tRobin Watts2020-06-257-14/+7
| | | | Never used.
* lgtm.com fixes: gpdl tweaks.Robin Watts2020-05-104-16/+10
|
* Update copyright to 2020Chris Liddell2020-04-1010-10/+10
|
* Fix shared libtiff and libjpeg buildChris Liddell2020-03-312-6/+12
| | | | | When building with shared libs, we should not try to include our custom libjpeg memory management context into the TIFF reader implementation context.
* jbig2dec: Pass segment numbers as unsigned values to error callback.Sebastian Rasmussen2020-03-201-1/+1
| | | | | | | | | | | | | According to the JBIG2 specification segments numbers are 32 bit unsigned integer. Previously any segment numbers larger than INT32_MAX would be passed as negative numbers. Some parts of the decoder do not yet know, or do not have access to the currently decoded segment number, and this needs to be specially indicated. Therefore jbig2dec appropriates the unlikely segment number 0xffffffff to indicate an unknown segment number. This is a change of the public API.
* Squash some unused variable warnings.Robin Watts2020-02-241-1/+0
|
* Alternative fix for leaks after error in gs_main_init_with_args01()Robin Watts2020-02-141-0/+1
| | | | | | | | | | | | | | | | When memory squeezing gpdl, Julian found leaks in the gpdl startup of the postscript interpreter when allocations failed in gs_main_init_with_args01(). Here, we fix the problem by making the psitop.c layer within gpdl call the appropriate shutdown code when we catch the error. This moves gpdl to being consistent with other users of the gs_main layer. Memento memory squeezing around the point of failure (event 2035) now shows this to be OK. MEMENTO_SQUEEZEAT=2034 ./membin/gpdl -sDEVICE=bit -o /dev/null examples/tiger.eps
* Fixed segv after alloc failure in ps_impl_allocate_interp_instance() (found ↵Julian Smith2020-02-101-1/+3
| | | | | | | by memento). Fixes: MEMENTO_FAILAT=2017 LD_LIBRARY_PATH=../libbacktrace/.libs ./membin/gpdl -sDEVICE=bit -o /dev/null examples/tiger.eps
* gpdl: Update j2k reading code to spot modified header.Robin Watts2020-01-281-4/+2
| | | | | | | The JP2K spec says we should spot "jP ", where previously we'd only been spotting "jP\1a\1a". No idea where that latter one came from, but presumably we've been seeing it in some files. Make the code cope with both.
* Support for YCbCr, LogL, LOGLUV and paletted TIFFs.Robin Watts2019-12-121-26/+217
| | | | | YCbCr TIFFs have to use TIFFRGBAImage as for the old JPEG encapsulation.
* Further fixes for GPDL TIFF.Robin Watts2019-12-122-23/+131
| | | | | | | | | | Support JPEG encoded TIFFs (both old and new formats). Old JPEG format requires the whole image to be decoded to an RGBAImage in memory at once; looks like that's just a limitation of libtiff. This is particularly annoying because it looks like the internals of libtiff are prepared to do scanline extraction as you'd hope, but aren't exposed to the outside world.
* Fixes for GPDL TIFF support.Robin Watts2019-12-121-21/+54
| | | | | Support tiled TIFFs, planar TIFFs, and TIFFs where the resolution isn't properly specified.