summaryrefslogtreecommitdiff
path: root/source
AgeCommit message (Collapse)Author
2018-02-01Drop JPEG/J2K/JPEG-XR/PNG/TIFF colorspaces even upon exception.Sebastian Rasmussen
For TIFF it was not just the colorspace, but other data as well.
2018-02-01Do not allow out of range object numbers inside object stream.Sebastian Rasmussen
2018-02-01Skip objects inside object streams whose object ids are out of range.Sebastian Rasmussen
2018-02-01Remove redundant seek in stream.Sebastian Rasmussen
2018-02-01Use 64-bit offsets when repairing PDF objects.Sebastian Rasmussen
2018-02-01Bug 698908: Resize object use and renumbering lists after repair.Sebastian Rasmussen
Previously repair might end up increasing xref_len, but the lists were not correspodingly expanded, leading to ASAN complaints.
2018-02-01Bug 698830: Avoid recursion when loading object streams objects.Sebastian Rasmussen
If there were indirect references in the object stream dictionary and one of those indirect references referred to an object inside the object stream itself, mupdf would previously enter recursion only bounded by the exception stack. After this commit the object stream is checked if it is marked immediately after being loaded. If it is marked then we terminate the recursion at this point, if it is not marked then mark it and attempt to load the desired object within. We also take care to unmark the stream object when done or upon exception.
2018-02-01Bug 698830: Don't drop unkept stream if running out of error stack.Sebastian Rasmussen
Under normal conditions where fz_keep_stream() is called inside fz_try() we may call fz_drop_stream() in fz_catch() upon exceptions. The issue comes when fz_keep_stream() has not yet been called but is dropped in fz_catch(). This happens in the PDF from the bug when fz_try() runs out of exception stack, and next the code in fz_catch() runs, dropping the caller's reference to the filter chain stream! The simplest way of fixing this it to always keep the filter chain stream before fz_try() is called. That way fz_catch() may drop the stream whether an exception has occurred or if the fz_try() ran out of exception stack.
2018-01-31Add pdf_debug_obj function to quickly print objects from gdb command line.Tor Andersson
2018-01-31Return error token if strings are unterminated.Tor Andersson
2018-01-31Return PDF_TOK_ERROR when encountering isolated '>' and ')' characters.Tor Andersson
Also return PDF_TOK_ERROR instead of swallowing string opening quotes in pdf_lex_no_string. Also fix the repair code to not skip an extra byte whenever it scans an error token.
2018-01-31Use convenience pdf dictionary/array creation functions.Tor Andersson
2018-01-31Add convenience functions to set dict/array values by primitives.Tor Andersson
2018-01-31Rename confusing fz_stream close callback to drop.Tor Andersson
2018-01-31Fix 698886: Don't try to load non-stream XObjects.Tor Andersson
2018-01-31Don't load an xobject before the stream is final when creating new forms.Tor Andersson
2018-01-31Don't use signed int for parsing binary string into integer.Tor Andersson
2018-01-31Add buffering to fz_output.Tor Andersson
2018-01-31Reduce size of pool allocator blocks to minimize waste.Tor Andersson
A lot of EPUB pool allocated data is much smaller than the default size, leading to a lot of wasted memory.
2018-01-31Bug 698916: Indirect object numbers must be in range.Sebastian Rasmussen
2018-01-29Bug 698908: Plug PDF object leaks when decimating pages in pdfposter.Sebastian Rasmussen
The bug reports a buffer overflow, but after that was fixed this leak was reported by ASAN.
2018-01-29If drawing to one file per page in mudraw, don't use append mode.Sebastian Rasmussen
Opening in append mode was used before commit c4d3a9142761a567fce9f66946a917e087c0de67 when the same file was reopened multiple times for formats that support it. Nowadays the files is only opened once anyway so there is no reason to use append mode.
2018-01-28Bug 698942: Don't complain about external URLs being unknown.Sebastian Rasmussen
2018-01-24Make sure to drop color converter when painting shades, even upon error.Sebastian Rasmussen
2018-01-24Bug 698904: Drop pixmap only once upon error when painting shades.Sebastian Rasmussen
If fz_new_pixmap_with_bbox() threw conv would be NULL and temp would be pointing to a pixmap that would be dropped 2 times. If fz_clone_pixmap_area_with_different_seps() threw temp and conv would be pointing to the same pixmap that would be dropped 3 times.
2018-01-24Bug 698904: Upon error both free color converter and clear its pointer.Sebastian Rasmussen
Without this change future calls to fz_fin_cached_color_converter() will try to dereference the already freed pointer.
2018-01-24Bug 698883: Reset cmap splay tree pointer, handling resized tree.Sebastian Rasmussen
Without this change a resized cmap splay tree leads to using stale pointers.
2018-01-24Assert node range conditions when checking cmap splay trees.Sebastian Rasmussen
2018-01-24Bug 698888: Keep one-to-many state when splitting nodes in cmap splay trees.Sebastian Rasmussen
Thanks to oss-fuzz for reporting this.
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-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-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-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-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.