summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Bug 695027: use a consistent allocator in the FT serverChris Liddell2014-02-131-10/+15
| | | | | | | | | | | | | | | | There was some mixing of memory allocators in the Freetype integration code, most of the code used the chunk allocator instance created during the server initialization, but glyph data allocations were using the allocator from the font object. With two different FAPI servers in place, and with the right combination of events, that could mean we'd lose the allocator pointer when destroying the font object. We're consistent in that all the memory allocations in the FAPI/Freetype code are directed through the chunk allocator created for that purpose. No cluster differences.
* Bug 695024: fix a typoChris Liddell2014-02-131-2/+2
| | | | | | | | In the UFST integration code, we check if the Freetype server is available and if it is, we punt any non-Microtype fonts to that. The typo is that the Freetype server is named "FreeType" - the "T" was lower case. CLUSTER_UNTESTED
* Bug #695034 Improve handling of word spacing with CIDFontaKen Sharp2014-02-132-2/+7
| | | | | | | | | | | | | | | | | | | Bug #695034 "Numbers and words are overlapping" Word spacing does not apply to ti CIDFOnts, *except* for 1-byte mappings where the byte 0x20 has word spacing applied to it. The previous code attempted to check this by using a heuristic to determine a single byte mapping in order to avoid adding more entries to the text enumerator. unfortunately this file defeats that heuristic which meant that it was necessary to calculate the number of bytes decoded when we extract one character, and store that information so that the 'move' routine can apply word spacing if required. This shows two differences with a cluster run. Bug694436.pdf is very subtly different, I'm assuming this is a progression. The Sumatra file 850_-_wrong_default_for_asian_fonts.pdf shows very significant improvements with this commit.
* Bug 695031: don't assume we can read a font fileChris Liddell2014-02-121-6/+14
| | | | | | | | | | | When we scan system fonts, we were assuming fonts found would be in a format Ghostscript understands. This is not necessarily the case. So put the minimal parsing call to get the font's name in a stopped context, so we can skip the file it's not an understandable format. And clean up the stack in the event we try such a file. No cluster differences.
* Don't allow PS CIE color spaces to be used for transparency group color spaces.Michael Vrhel2014-02-114-2/+33
| | | | | | The CIE color spaces are 1-way. In that they map from Device to CIE, not from CIE to Device. A transparency group color space needs to be able to go both directions. This fixes the regression 694774
* Remove final remnants of deprecated CRD code.Henry Stiles2014-02-1110-460/+18
|
* Improve the debug 'cname' for chunk_mem_node_add similar to MEMENTO builds.Ray Johnston2014-02-111-18/+5
| | | | | | | For normal builds use the caller's cname when allocating the chunk if the object is in its own chunk. Previously this only was used for MEMENTO builds. NB: MEMENTO builds put every object in a chunk, so the cname will always be the caller's, never "chunk_mem_node_add".
* Fix bug 694821. Ignore SeparationOrder with the psdcmykog device.Ray Johnston2014-02-111-3/+67
| | | | | | | | | | | | While this is a DeviceN device with some non-standard components that can be painted using Separation or DeviceN colorspaces, this device always outputs all 6 channels and can't deal with a subset of the channels, so return an error (undefined) for SeparationOrder. the separation_map remains constant to avoid color distortion if SeparationOrder is used. Also make sure that we never add separations (NO_AUTO_SPOT_COLORS) from the get_color_comp_index procedure.
* Fix some problems with SeparationOrder handling -- 29-07I.PSRay Johnston2014-02-111-4/+19
| | | | | | | | | | Most importantly, when setting SeparationOrder parameters fail, we need to use param_signal_error. Otherwise, even though the error code is returned, the stack for setpagedevice would be missing the param information and code that caused the error. Also the num_spot and num_spot_changed were improperly updated when ENABLE_AUTO_SPOT_COLORS allowed SeparationOrder to add separations.
* pdfwrite - fix a bug in the font embedding white list detectionKen Sharp2014-02-111-0/+4
| | | | | | | | | | While working on bug #695030 I ran across a bug in the font embedding white list code. If the bisection of the list exactly hits the target string exactly then the bisection would fail to find the string. This commit special cases this and detects the string. No differences expected.
* pdfwrite - alter the example pdfa_def.ps for PDF/A generationKen Sharp2014-02-101-6/+15
| | | | | | | | | | | | The pdfa_def.ps file is incorrect with the new colour handling, and has long had a problem with only handling Gray or CMYK. Its no longer possible to retrieve the ProcessColorModel from systemdict, we must now use the current device dictionary. pdfa_def.ps now supports DevuiceGray, DeviceRGB and DeviceCMYK models. No differences expected
* pdfwrite - new color code. Fix the emission of DeviceIndependent coloursKen Sharp2014-02-101-4/+8
| | | | | | | | | | Bug #694806 "chars and colors lost during PDF/A transformation" If we used the same device independent (ICCBased) colour space, but a different colour, we ended up not writing the new colour. This code fixes that problem. No differences expected
* PS interpreter - Fix rotation problem with EPSFitPageKen Sharp2014-02-101-2/+6
| | | | | | | | | | | | | | | | | | | | | Bug #695016 "Gradient eps file to pdf" When fitting an EPS Bounding Box to a specified page size, the code looks at the width and height of both the page and the EPS file, to see if the EPS will fit 'better' by rotating it. In this particular case the page is square, but there was no special case for this, which mean that landscape pages wold be rotated twice, causing the content to disappear. This commit special cases square media sizes and does not attempt to rotate the EPS, no matter what its orientation, as there is clearly no point in doing so. This prevents the double rotation and resolves the problem. Tested with landscape, portrait and square media and EPS files, in all combinations. No differences expected
* Fix Windows display device -dDisplayFormat=16#a0800 regression.Ray Johnston2014-02-063-4/+18
| | | | | | | | | | | Commit 82fc3bd change to msvc.mak removed setting the GX_COLOR_INDEX_TYPE, and code in base/gxcindex.h set this incorrectly to 'ulong'. Add the code that was removed and also add conditional compile to set this from ARCH_SIZEOF_GX_COLOR_INDEX if it is not defined. Also add a 'compile time assert' that causes the build to fail if the sizeof(GX_COLOR_INDEX_TYPE) is not equal to ARCH_SIZEOF_GX_COLOR_INDEX. Thanks to Robin for finding this trick on the web.
* pdfwrite - improved error handling in pdf_closeKen Sharp2014-02-061-0/+2
| | | | | | | | | | | | | | Bug #695013 " GS not finishing pdf write, creating huge files, when root / partition is full" we weren't checking the error return when trying to find the end of an xref section while writing the xref. Any ioerror would havce caused this problem. While this fixes the specific instance of the problem, I can't guarantee that more subtle problems (eg filling disk while writing the PDF file) don't still exist. No differences expected.
* Update jbig2dec standalone build for Windows.Ken Sharp2014-02-051-6/+22
| | | | | | | Add the missing jbig2_halftone.c file, and make building without libpng the default. CLUSTER_UNTESTED
* Remove strdup in gdevxps.c .Michael Vrhel2014-02-041-1/+5
| | | | | In Windows 8 64 bit builds with VS2012/2013 strdup use resulted in a crash. Replaced with standard strlen/gs_alloc_bytes/strcpy. Note that we need to free this allocation at some point.
* Tweak xpsprint build.Chris Liddell2014-02-036-7/+127
| | | | | | | | | | | | Conflicts: gs/base/msvctail.mak gs/base/winlib.mak gs/devices/vector/gdevxps.c Tweak the xpsprint code to use runtime DLL loading Conflicts: gs/base/msvctail.mak
* Add new code for a 'gsprint' alike which uses the XPS print system onKen Sharp2014-02-032-2/+326
| | | | | | WIndows Add new code for a 'gsprint' on new versions of Windows, using XPS
* Fix writes to freed memory caused by commit 429640.Ray Johnston2014-02-031-3/+3
| | | | | | I had moved the clearing of the ctx to before the gs_malloc_release call, but this function frees the ctx, so we wrote to freed memory. Move it back.
* Fix bug 694994. Gray and CMYK pdf14 clist accumu devices had wrong color_info.Ray Johnston2014-02-011-4/+4
| | | | | In cut and pasting the device structures, I negleccted to change the color info for the macros.
* PDF interpreter - disable Comment parsing for PDF filesKen Sharp2014-02-011-0/+2
| | | | | | | | | | | | | | | | Bug #694987 "PDF metadata messed up for PDF->PDF conversion" This is caused by parsing DSC comments from an embedded font file. Of course the font should not contain DSC comments, but it seems FontForge always embeds such. There is nothing useful to be gained from *PostScript* comments in a PDF file, so the simplest solution is to disable comment parsing for the duration of the PDF file. This will also avoid problems with PostScript XObjects. No differences expected
* Slightly rejig i/o in inkcov device.Chris Liddell2014-01-313-6/+30
| | | | | | | | Tweak so that output directed to stdout or stderr go through the graphics library's own stdout and stderr handlers - that way, it can be seen by integrators using the Ghostscript API with custom stdio handler methods. No cluster differences.
* pdfwrite - colour conversion, consider sRGB to be RGBKen Sharp2014-01-313-6/+7
|
* PDF interpreter - add -dUseBleedBox to complete the quartet of BoxesKen Sharp2014-01-312-1/+16
| | | | Bug #694977 "please provide -dUseBleedBox in analogy to crop- and trimbox"
* pdfwrite - remove 2 unused variablesKen Sharp2014-01-311-2/+0
| | | | silences compiler warnings
* Move final memory (max) usage to gs_malloc_release.Ray Johnston2014-01-302-13/+15
| | | | | Not all systems (e.g. unix) use the gsapi interface, so the debug -Z: didn't print the final memory usage as on Windows.
* pdfwrite - more EMBED pdfmrk changesKen Sharp2014-01-302-4/+9
| | | | | | | | | | | | | commit 3e5ae4ea39655643ae352cf4723702a164c10417 omitted a crucial change which swapped the search order of /FS and /Name. Without that the dict entries are not correctly named. This oversight demonstrated a flaw in the error handling resulting in invalid PDF files being written, which we correct here. If we get an error we close the 'aside' so that we don't end up writing the PDF trailer to a temporary file instead of the real PDF file. No differences expected
* pdfwrite - more work on /EMBED pdfmarkKen Sharp2014-01-303-22/+14
| | | | | | | | | | | | | | As was rather anticipated, commit a91d2576df0e60f6e691a3bd967b51109ae41f22 wasn't sufficient. We were writing an invalid name tree as we were writing /Limits in the root node. For single entries in the Limits array we only wrote the single entry, in fact we should write that entry twice (!). The value associated with each key in the EmbeddedFiles array had the dictionary we needed stored inside another dictionary with a /FS key. EmbeddedFiles were introduced in PDF 1.4, not PDF 1.2. This commit addresses all those problems, Adobe Acrobat Professional can display the list of embedded files and (for embedded PDF files at least) can open the embedded file.
* Fix bug 689805: Use a clist for pages with transparency that need lots of RAMRay Johnston2014-01-2925-589/+842
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Devices that are not gx_device_printer class try to allocate full page bitmaps for the stack of transparency buffers. This can kill performance or result in VMerror during transparency stack pushes. Devices that are gx_device_printer class automatically used clist mode, but other devices did not. Devices that do not internally support clist mode are recognized by the return from gxdso_supports_saved_pages device spec_op. A gx_device_printer device is used to accumulate the page, then when the PDF14_POP_DEVICE is performed, the page is sent to the original device as an image. NB, both the pdf14clist___ device and the pdf14___ device are kept in the device chain since we have to be able to accomodate unwinding the gs_state structure that may point to either as various "restore" ops occur. Unfortunate, but until we come up with a way to fix the chain of compositors, this is the best we can do. Move space_params to gx_device struct in order to allow non-printer devices control over MaxBitmap, BufferSpace, BandBufferSpace, and BandHeight. The x11 device used MaxBitmap somewhat differently, so it now uses the space_params value, and sets the default in its 'open' function, rather than the device prototype. The duplicate 'page_uses_transparency' in space_params is removed, and all devices have this as a parameter. Also, get rid if the nasty hacks for detecting pattern-clist devices based on the device name, and export these for the pdf14 device and other clients. Finally, (unrelated) remove the #if 0 for testing with small memory on large memory machines, and get rid of the the description of the '.' option since this hasn't worked for years, and the command line options can readily be set anyway.
* pdfwrite - enable the EMBED pdfamrkKen Sharp2014-01-297-7/+317
| | | | | | | | | | | | | | | | | | | | | Bug #690043 "Can't create a pdf file with attachment" This turned out to be more complex than I expected. I had planned to lever off the /Dests code, but.... It seems that our Named destinations support is only PDF 1.1. The specification was changed ion PDF 1.2 to use a name tree instead of a simple dictionary and we didn't alter our code. The EmbeddedFiles wasn't supported in PDF 1.1 so it has always needed a name tree. So in addition to adding the EMBED pdfmark, we now also will write a name tree for Dests if the CompatibilityLevel is > 1.1. Note that the 'tree' we write is the simplest possible one and is likely to be sub-optimal, we write all the entries in the root of the tree. However its legal and should work, we can extend this later if needs be. I don't have a good way to test this, but the output looks OK by inspection and we don't get any regressions.
* Fix non gcc DEBUG builds of pcl.Robin Watts2014-01-291-2/+2
| | | | Simple transposition of lines required.
* PDF interpreter - attempt to recover from degenerate text matrix or CTMKen Sharp2014-01-281-2/+11
| | | | | | | | | | | | | | | | | | Some PDF files set a degenerate matrix or text matrix, eg 0 0 0 0 0 0 Tm This causes us a problem with currentpoint and .getpath, both of which need to invert the CTM. If the CTM is all 0 then it (clearly) can't be inverted. The code here emits a warning, in the case of settextposition it simply does not advance the current point (which seems correct, since the text will make no changes). In the case where we attempt to grestore (Q) but preserving the current path, we drop the path and make a new path. This may well not be correct, but its hard to see what would be. No differences expected.
* epsi.ps - change two \r to \nKen Sharp2014-01-231-2/+2
| | | | | | | | Apparently gv has a bug and can't handle \r line endings. Bug #694968 No differences expected.
* vector devices - add a warning message when OutputFile exceeds a limitKen Sharp2014-01-231-1/+3
| | | | | | Bug #694948 No differences expected.
* Bug 694873: bare JPEG2000 images without JP2 header in pdf.Hin-Tak Leung2014-01-231-17/+39
| | | | | | | | | | | | | | | | | | | | | | | | To cope with JPEG2000 images without JP2 headers. This change is essentially the corresponding change in mupdf (https://code.google.com/p/sumatrapdf/issues/detail?id=937 , http://bugs.ghostscript.com/show_bug.cgi?id=691346 , test file 937_-_openjpeg_cannot_decode_JP2_structure.pdf), where one takes a peek at the first few bytes of the stream before setting the decoding parameters; with the caveat that in ghostcript, we need to delay most of the stream initialization - and allocation of resources - until after seeing the first few bytes, and therefore also not necessarily de-allocate at stream close. The cluster test file, openjpeg_166_-_buffer_overflow.pdf, (https://code.google.com/p/openjpeg/issues/detail?id=166) is of the same issue. EXPECTED DIFFERENCES: 937_-_openjpeg_cannot_decode_JP2_structure.pdf openjpeg_166_-_buffer_overflow.pdf (Both are progressions.)
* Set correct portrait/landscape orientation on PCL 5c/e outputTill Kamppeter2014-01-224-2/+32
| | | | Fixes bug #693715.
* pdfwrite - fix xref when eliding duplicate patternsKen Sharp2014-01-202-2/+19
| | | | | | | | | | | | | commit fe99ca5fd2e3b191a76c7f7d791b72f3603e9fea detected duplicate shading patterns, and did not emit them into the PDF file, instead using the first definition. Unfortunately, due to a mis-understanding of the existing code the xref entry remained assigned, which led to invalid xref tables being written. This commit fixes the xref, and adds some (hopefully useful) comments to the relevant functions to try and avoid a repetition. No differences expected
* Fix 694951 - No output produced.Henry Stiles2014-01-171-0/+1
| | | | | Allow the HPGL/2 command "PG" to initialize the GL/2 parser at the beginning of a job.
* Bug 694893: prevent overflow in opj_int_ceildivpow2Simon Bünzli2014-01-171-1/+1
| | | | | | | | | This can be seen e.g. in: 4241ac039aba57e6a9c948d519d94216_asan_heap-oob_14650f2_7469_602.pdf Thanks to Mateusz Jurczyk and Gynvael Coldwind of the Google Security Team for providing the example files.
* Bug 694880: fix write access violation in opj_j2k_add_tlmarkerSimon Bünzli2014-01-171-1/+1
| | | | | | | | | | | | | A tile_index' current_tpsno may be far larger than the number of tile parts because opj_j2k_read_sot increases that number just by 10 instead of growing it to the actually required size. This can be seen e.g. in: 147af3f1083de4393666b7d99b01b58b_signal_sigsegv_130c531_6155_5136.pdf Thanks to Mateusz Jurczyk and Gynvael Coldwind of the Google Security Team for providing the example files.
* Bug 694949: prevent denial of service with arithmetic decodingSimon Bünzli2014-01-174-1/+21
| | | | | | | | | | | | | | | | | | Badly constructed Jbig2 images using arithmetic decoding may result in a denial of service attack by causing huge images to be created and initialized from no data at all (at EOS, the arithmetic decoder always returns the same values instead of failing). Two cases are prevented with this patch: * huge generic regions with barely any data to decode it from * a huge list of height classes with no data at all to decode it from This can be seen e.g. in: b534b5caad95dd405735ec9a079fd43b_asan_heap-oob_14bf3ce_6977_5690.pdf Thanks to Mateusz Jurczyk and Gynvael Coldwind of the Google Security Team for providing the example files.
* PDF interpreter - Don't set UseCIEColor unless actually required.Ken Sharp2014-01-172-1/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The PDF specification says that if a PDF file contains a page which uses a ColorSpace Resource of DefautlGray, DefaultRGB or DefaultCMYK then this should be regarded as a "request that such colors be systematically transformed (remapped) into device-independent CIE-based color spaces.". Essentially the PDF equivalent of UseCIEColor. This does rather beg the question of why not specify the colours in a device-independent space in the first place..... In any event, in order to achieve this the PDF interpreter pulls some tricks. We start by defining the Default* resources as the equivalent Device* spaces and *always* define UseCIEColor to true. Thus whenever we set a device color space the colour machinery tries to use instead the appropriate Device* space. Because the color space machinery has an optimisation to jump straight out when the requested space is the same as the current space, this means that the UseCIEColor transformation should have no effect. However, pdfwrite now emits a warning if UseCIEColor is true, so we want to avoid unconditionally setting UseCIEColor (I also find it horrifying that we do this terrible hackery). This commit borrows code used to set the Default* spaces if they exist on a page, and uses it to detect such spaces before we call setpagedevice for each page. We now only set UseCIEColor if the page actually uses one of the Default* spaces and therefore requires it. I did consider trying to substitute the defined colour space with the Default* space whenever a colour space definition takes place and a Default* space is defined, but gave up as there were simply too many places where color spaces could be defined. This code does (somewhat unexpectedly) produce some differences. These are either progressions or very tiny differences, and I feel that *not* setting UseCIEColor should be preferable anyway. (The real puzzle is why some PostScript files seem to differ, but they only differ when sent to pdfwrite and the PDF is then interpreed. Looks like UseCIEColor has some strange behaviour with ICCBased spaces). with pdfwrite: altona_technical_1v2_x3.pdf - very minor colour shift altona_technical_v20_x4 - progression on page 7 09-31.ps - difference in gray ramp in CIE space 09-34.ps - indetectable differences in some CIE colours all devices: Bug692783.pdf - indetectable shits in background Catx5720.pdf - slight colour shifts in 3 graphics 1021_-_transparency-issue.pdf - tiny colour shifts 1141_-_background_shading_cropped.pdf - tiny colour shifts
* Bug 694871: move libjpeg away from gc memoryChris Liddell2014-01-158-88/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the libjpeg interface code to use a chunk allocator instead of garbage collected, "unstable" memory. Previously, the libjpeg integration used "Postscript" memory, that is, memory that is subject to garbage collection and save/restore operations. This means that Postscript like: /In (file) (r) file /DCTDecode filter def save << ... /ImageSource In ... >> image restore In closefile would almost certainly cause a crash, since the memory allocated by libjpeg during the decoding for the "image" operator would be freed by the "restore" operator, *before* the "closefile" destroyed the filter stream and the libjpeg context. If we opt to always wrap the "default" heap allocator in a chunk allocator then we should probably remove the chunk allocator instances created specifically for libjpeg. No cluster differences.
* Have DSC parser use GS memory handlingChris Liddell2014-01-151-1/+21
| | | | | | | | | | | | | The DSC parser was using it's own default memory alloc/free functions which just called the libc malloc/free. This tweaks our integration code so the parser will use the Ghostscript memory management functions. There are no changes to the parser code, the changes are entirely confined to integrating the parser with our PS interpreter. No cluster differences.
* make opj_stream_set_user_data accept a NULL streamSimon Bünzli2014-01-131-0/+4
| | | | ... for consistency with opj_stream_set_* which does so.
* prevent assertion under MSVC on impossibly large allocationsSimon Bünzli2014-01-131-3/+6
| | | | | | | | | | MSVC's debug CRT asserts that arguments to malloc and realloc aren't impossibly large (close to (size_t)-1) which makes testing fuzzed files impossible with assertions enabled. Problem found in a test file, 2236.pdf.asan.40.1376 supplied by Mateusz "j00ru" Jurczyk and Gynvael Coldwind of the Google Security Team using Address Sanitizer. Many thanks!
* don't define lrintf for MSVC 2013 (fix compilation breakage)Simon Bünzli2014-01-131-2/+2
|
* fix error message in opj_jp2_read_colrSimon Bünzli2014-01-131-5/+5
|
* tweak commit 66d9c0aa17a5abcecd6590e63f0620f7aa51634cSimon Bünzli2014-01-131-7/+9
| | | | | | | | | | The fix for testcase 1336.pdf.asan.47.376 for bug 694311 was slightly too strict: The access violation only happens during the MCT decoding step which might be skipped for some images. This patch moves the test into opj_tcd_mct_decode to only apply when it's actually required (which should allow j2kp4-file3-ycc-8bpc.pdf to be read without errors inside openjpeg itself and leaves handling of components of different sizes to the calling application/library).