summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-01-24Allow oversize allocations in pool allocator.Tor Andersson
2018-01-24Fix 698872: Do not trust ICC profile unconditionally in PNG files.Tor Andersson
2018-01-24Fix github issue #5: wrong return type from vec_dot in stext-device.cTor Andersson
2018-01-24Fix failure of non-incremental document saving.Paul Gardiner
An earlier commit changed the mode used to open a file for saving so that it could also be read from. The mode used was rb+ independently of whether the saving mode was incremental or not. Doing so neglected that for non-incemental saves the file may not already exist in which case opening rb+ will fail. This commit arranges that wb+ is used in the non-incremental case.
2018-01-23Take on memory leak fix in lcms2.Robin Watts
2018-01-23Fix cut and paste bug in filter code.Robin Watts
Don't output linewidth as mitrerlimit. This confuses Acrobat.
2018-01-23Bug 698885: When parsing PDF version, make sure to initialize buffer.Sebastian Rasmussen
Thanks to oss-fuzz for reporting this.
2018-01-22Bug 698889: Handle unterminated PDF arrays gracefully.Sebastian Rasmussen
Thanks to oss-fuzz for reporting this.
2018-01-22cbz: Do not ask for page file name/extension unnecessarily.Sebastian Rasmussen
Thanks to malc for spotting this.
2018-01-19Improve signature check failure reportingPaul Gardiner
Because of the structure of openssl's signature checking, we temporarily permit certain errors in the certificate trust stage, so that openssl will continue onto the digest check. That way we can detect special error cases such as the only failure being that a self-signed certificate is present. This commit misses out one of the cases we'd missed.
2018-01-19Fix potential infinite loop when verifying signaturesPaul Gardiner
2018-01-19Perform signature verification via fz_streamPaul Gardiner
Previously, signature verification worked only for file-based documents and the file path had to be passed into the verification function.
2018-01-19Perform document signing via fz_stream and fz_outputPaul Gardiner
This change achieves two goals. It allows signing to be performed even when the document is obtained other than from a disk file. It also reestablishes to a working state signing of file-based documents, a feature that was broken due to complete_signatures being called after certain tables, avaialble via the output options object, had been destroyed.
2018-01-19Add fz_output_as_streamPaul Gardiner
This provides a way for some output streams to also be read, a feature needed for the sake of document signing. Currently this is supported only for file output.
2018-01-19Fix reading of pfx filesPaul Gardiner
We'd neglected to specify binary mode when opening the file. Possibly this affected only running under Windows.
2018-01-19Further changes to signature support related to changes in opensslPaul Gardiner
Reinstate the separate consideration of errors relating to the certificate trust checking phase. Remove the key-usage records from the certificate before signature verification. This is done so that openssl will recognise self signed cerificates. openssl doesn't consider them as such when the key usage doesn't include certificate signing.
2018-01-19Update use of openssl for signature support, from 1.0.1e to 1.1.0gSebastian Rasmussen
The openssl-version check within Makerules has been updated to ensure we include signature support only when 1.0.1u or later is available. 1.0.1u is the version at which the API changes which necessitated this commit were introduced.
2018-01-18Update LCMS2.art with latest LCMS2 changes.Robin Watts
2018-01-15Fix 698865: Warn when failing to load embedded ICC profile in PNG images.Tor Andersson
Do not throw an exception, just ignore the faulty color profile.
2018-01-15Bug 698857: Delete local reference after use.Sebastian Rasmussen
Without deleteing it the local reference table may overflow.
2018-01-15Use C comments instead of C++ comments.Fred Ross-Perry
2018-01-11Only do lock checking if using custom locks.Sebastian Rasmussen
The lock checking functions are always enabled in debug mode, but since they are not thread safe they may not be used in a multi-threaded application. Multi-threaded applications are required to set their own locking functions so the lock checking functions should only be run if the default locking functions are in use.
2018-01-10Handle pixmaps without alpha in fz_tint_pixmap.Tor Andersson
2018-01-10Add colorspace type enum and use it instead of hardcoded checks on N.Tor Andersson
2018-01-10Don't allow reading from a 'dead' fz_stream.Tor Andersson
Once a stream has thrown an exception or reached EOF, don't allow further reading. The EOF flag is reset when fz_seek is invoked.
2018-01-10Handle exceptions in fz_peek_byte the same way as in fz_read_byte.Tor Andersson
2018-01-10Refactor and fix hash lookups when decoding image subarea tiles.Tor Andersson
The subarea rect used for lookups could mismatch the subarea returned by the get_pixmap function due to adjusting to whole bytes. Refactor and use a common subarea adjustment function. Many image formats which do not support subarea tiles will decode and cache the full image, so if a subarea tile cannot be found, look for the full image tile as well.
2018-01-10Fix initializer syntax for VS2005.Tor Andersson
2018-01-05Enable saving of encrypted PDF files.Robin Watts
We need both RC4 and AES encryption. RC4 is a straight reversable stream, and our AES library knows how to encrypt as well as decrypt, so it's "just" a matter of calling them correctly. We therefore expose a generic "encrypt this data" routine (and a matching "how long will the data be once encrypted" routine) within pdf-crypt.c. We then extend our our PDF object output routines to call these. This is enough to get encrypted data preserved over calls to mutool clean. Unfortunately the created files aren't readable, due to 2 further problems, also fixed here. Firstly, mutool clean does not preserve the Encrypt entry in the trailer. This is a simple fix. Secondly, we are required NOT to encrypt the Encrypt entry. This requires us to spot the crypt entry and to special case it.
2018-01-05Fix "being able to search for redacted text" bug.Robin Watts
A customer reports that even after text has been redacted, we can still search for the redacted text. The example file supplied had many instances of the word 'words', and 4 instances of 'apple'. The 'apple' instances were redacted, and the document saved out. 2 such instances were on the first page; when we searched for 'apple' acrobat would find the word after the first removed instance of apple, then find the word 2 after the second removed instance of apple. After much head scratching and cutting down of the file, it appears that the information genuinely isn't in the file. Acrobat is somehow remembering it. It appears to be doing this using the 'ID' entries in the trailer dict. My suspicion is that Acrobat has cached the text extraction from the original document, and is using this on all files that match the IDs. Change the IDs (or remove them) and the problem goes away. The spec says that the ID should be 2 bytestrings in an array. The first is supposed to stay the same in all versions of a file (i.e. it shows the *original* version of the file, and it is the one that is used by encrypt). The second bytestring is supposed to change more often, so here we simply return a new random string on each writing.
2018-01-04Update 'mutool run' man page.Tor Andersson
2018-01-04Bug 698836: Fix build with FZ_ENABLE_JPX=0.Tor Andersson
2018-01-04Add portable pseudo-random number generator based on the lrand48 family.Tor Andersson
2018-01-02Fix thread debugging code to always use ms_clock()Robin Watts
2017-12-29Update LCMS2 with optimisations from GS.Robin Watts
2017-12-20Bug 698827: Correct reference counting when creating pixmap from pixmap.Sebastian Rasmussen
Previously the copy had as many reference counts as the original pixmap which lead to leaks of pixmaps.
2017-12-20Bug 698826: Plug leak of font names when parsing appearance string.Sebastian Rasmussen
Previously if a variable text annotation with a default appearance string had multiple 'Tf' operators all but the last font name would leak.
2017-12-19Bug 698825: Do not drop borrowed colorspaces.Sebastian Rasmussen
Previously the borrowed colorspace was dropped when updating annotation appearances, leading to use after free warnings from valgrind/ASAN.
2017-12-13Initialize generation numbers when saving a new pdf.Tor Andersson
2017-12-13Validate that /Size in trailer is in range.Sebastian Rasmussen
2017-12-13PDF object numbers need not be int64_t, int is sufficient.Sebastian Rasmussen
This is true because they are now limited below PDF_MAX_OBJECT_NUMBER.
2017-12-13Define constant INT64_MAX where int64_t is declared.Sebastian Rasmussen
2017-12-13Move xref section recursion check, simplifying code.Sebastian Rasmussen
2017-12-13Rephrase messages, clarify variable names and remove unused code.Sebastian Rasmussen
2017-12-13Never write negative xref offsets when saving to PDF.Sebastian Rasmussen
2017-12-13Bugs 698804/698810/698811: Keep PDF object numbers below limit.Sebastian Rasmussen
This ensures that: * xref tables with objects pointers do not grow out of bounds. * other readers, e.g. Adobe Acrobat can parse PDFs written by mupdf.
2017-12-13Update MuJS submodule.Tor Andersson
2017-12-13Add 'tar.xz' to "make tarball" script.Tor Andersson
2017-12-13Don't pass -Wdeclaration-after-statement to C++ compiler.Tor Andersson
2017-12-13Parse XML using pool allocator.Tor Andersson
This needs adding a fz_xml_doc type to hold the pool.