summaryrefslogtreecommitdiff
path: root/source
AgeCommit message (Collapse)Author
2014-07-24cbz: Only include each entry once, even if it matches many file suffixes.Tor Andersson
Bug 695377.
2014-07-22Change js_is/touserdata argument order to match MuJS changes.Tor Andersson
2014-07-18fix off-by-one error in fz_unblend_masked_tileSimon Bünzli
fz_image::n is used inconsistently: Sometimes it includes the alpha channel and sometimes it doesn't. At the point where fz_unblend_masked_tile is called, it doesn't.
2014-07-18fix potential memory leak in load-jpx.cSimon Bünzli
2014-07-18allow 1-bit colormaps for TIFF imagesSimon Bünzli
The TIFF specification seems to only allow for 4-bit and 8-bit colormaps. However at least Microsoft's XPS viewer also accepts 1-bit colormaps and our current code handles this case already anyway. See https://code.google.com/p/sumatrapdf/issues/detail?id=2562 for a sample document.
2014-07-18allow to extract text for uncacheable glyphsSimon Bünzli
Certain glyphs such as found in nested Type 3 font can't be cached. Currently, the text extraction device doesn't see these as they're sent only as drawing operations. Sending them also as invisible text fixes potentially missing letters.
2014-07-18report more cases of blending use for pdf_pageSimon Bünzli
pdf_page::transparency is supposed to indicate whether a page uses PDF transparency features. The checks aren't complete, though, which is relevant for devices which require additional handling for transparency (such as SumatraPDF's gdiplus_device). See https://code.google.com/p/sumatrapdf/issues/detail?id=2107 and https://code.google.com/p/sumatrapdf/issues/detail?id=2540 for example documents.
2014-07-18properly decrypt strings in encrypted but broken documentsSimon Bünzli
If a PDF document is encrypted but broken, repairing caches all strings in encrypted form. Clearing the xref after repairing ensures that strings are returned to API callers as expected. Cf. https://code.google.com/p/sumatrapdf/issues/detail?id=2610
2014-07-18fix ZIP64 support in xps-zip.cSimon Bünzli
Per the ZIP specification, ZIP64 values are only used if the original value was -1 (i.e. 0xFFFF for 16-bit and 0xFFFFFFFF for 32-bit values). Microsoft's XPS viewer behaves according to specification and so should MuXPS.
2014-07-18hex-encode UTF-16 strings when writing PDFSimon Bünzli
fmt_obj calculates whether a string is better hex-encoded or written using escapes. Due to a bug, '\0' is considered to be escapable same as '\n' when instead it would have to be written as '\000'. Since UTF-16 strings tend to consist of many '\0' bytes, their octal encoded form is much longer than their hex encoded form. The issue is that the first argument to strchr contains an unintended trailing '\0' which has to be special-cased first.
2014-07-18Bug 695271: fix incremental updates for files without final linebreakSimon Bünzli
PDF documents aren't required to end in a linebreak. Objects however must start on their own line (in particular for broken documents relying on reparation). For this reason, a linebreak must be inserted before starting an incremental update.
2014-07-18prevent buffer overflow in cbz_strnatcmpSimon Bünzli
If the two arguments to cbz_strnatcmp are equal (except for leading zeros), cbz_strnatcmp reads beyond the buffer until it finds differing bytes or enters a non-readable memory page. TODO: Should sorting "test01" and "test1" lead to a stable sort order?
2014-07-17Minor optimization in test_device.Ray Johnston
Don't convert and compare color if we already know the page has color.
2014-07-17Add feature testing device, and call it from mudraw with -T flag.Tor Andersson
Currently only tests for the presence of non-grayscale color.
2014-07-17Improve callback for loading substitute CJK fonts to return TTC index.Tor Andersson
2014-07-07cbz: Use natural string comparison to sort file names.Tor Andersson
Sort case insensitively in this order: page-1.jpg page-2.jpg page-10.jpg
2014-07-02Handle the application/xps mimetype.Matt Holgate
I think this is non-standard, but some applications seem to use it. The email app on Android uses it, despite the fact the original email actually embedded it as application/octet-stream. I guess the email app is looking at the filename.
2014-07-01Remove some trailing space.Matt Holgate
2014-06-30Fix coding style issues and remove C99 mid-block declaration.Matt Holgate
2014-06-26Partially revert "Add missing fz_var() and fix potential memory leak."Matt Holgate
(Revert the fix for potential memory leak - there wasn't a potential memory leak as the device only takes ownership of it's display list if dev->free_user is set). This reverts commit ada560eb015e7b2208c492d47f28da8093733c4a.
2014-06-26Add missing fz_var() and fix potential memory leak.Matt Holgate
2014-06-19Fix compiler warning.Matt Holgate
2014-06-18Fix for bug #694405 - iOS Pdf CrashMatt Holgate
If an iOS app uses too much memory, the OS asks it to free up some space. If it doesn't do so in a timely manner, it will get a second warning before being killed by the OS. In other platforms, where malloc() return NULL in OOM, the store scavenger releases memory when mallocs fail. In iOS, mallocs usually never return NULL because the app is killed before this can happen. Therefore, we need to initiate a scavenge from the low memory notification instead. We evict the store to 50% of its current size when a memory warning occurs when it is in the foreground, and 0% when a memory warning occurs whilst it is in the background. Having said this, I didn't manage to get a background warning to occur, presumably because we don't request background execution Therefore, I think in practice the OS just kills the process. However, this will be useful if we ever add background execution.
2014-06-16Fix a fatal compiler warning when building with the latest version of the ↵Matt Holgate
Android NDK (security issue because a variable is used as a format string with no parameters).
2014-06-10Fix library/header version error message and makefile dependency.Tor Andersson
2014-06-09Bug 695300: Sanitize draw-device stack handling in error cases.Robin Watts
When throwing an error during fz_alpha_from_gray, the stack depth can get confused. Fix this by moving some more code into the appropriate fz_try(). In the course of fixing this bug, I added some new optional debug code to display the stack level as it runs. This is committed here disabled; just change the appropriate #define in draw-device.c to enable it. Also, add some code to run_xobject, to avoid throwing in an fz_always() clause.
2014-06-09Fix 695300: don't throw exception on invalid reference number.Tor Andersson
Return the null object rather than throwing an exception when parsing indirect object references with negative object numbers. Do range check for object numbers (1 .. length) when object numbers are used instead. Object number 0 is not a valid object number. It must always be 'free'.
2014-05-29Fix 694093: add vertical variant of CJK fallback font.Tor Andersson
Replace the DroidSansFallback TTF files with a TTC that has two fonts: The original and a copy where the OpenType 'vert' substitution lookup has been pre-applied by copying the uniXXXX.vert glyph data to uniXXXX.
2014-05-29fix memory leaks during PDF document creationSimon Bünzli
pdf_create_document leaks the trailer and in pdf-device.c many objects are inserted into dictionaries using pdf_dict_puts and leaked instead of using pdf_dict_puts_drop.
2014-05-29Tolerate zero-sized xref sections...Tor Andersson
...like the one Microsoft Word generates.
2014-05-28Further fix for Bug 695260: Cope with out of memory in fz_draw_end_maskRobin Watts
If we hit an out of memory error in fz_draw_end_mask, then pop the stack, and rethrow. Ensure that the generic device code catches this error and sets the error_depth to 1 so that the final pop is ignored.
2014-05-27Fix 693517: Support /SMask/Matte preblended images.Tor Andersson
2014-05-27Bug 695260: Fix error handling in do_xobjectRobin Watts
Various functions (such as fz_begin_group) handle errors internally by use of the error_depth parameter. This means that if we call them, we MUST ensure that we call the appropriate closing function. Similarly, if we don't call them, we should NOT call the closing function. In order to ensure we do this correctly, we introduce a cleanup_state variable that says which ones we tried to call. This cures the original bug.
2014-05-26Fix 695261: separate TM and CTM in outline extraction and stroking steps.Tor Andersson
We used to extract the outline using the combined TM*CTM matrix and use the identity transform for stroking, thus ending up with the wrong line width. If we instead extract using the TM and then stroke with the CTM we get the correct results.
2014-05-23Fix 695041: add special fast case for 8bpp TIFF predictor.Tor Andersson
2014-05-23Bug 695183: Inflate large buffers at a time for speed.Robin Watts
When I changed the stream implementations to use implementation specific buffers, rather than a generic public one in every fz_stream, I changed fz_read_byte to only get a single byte at a time. I noted at the time that the underlying stream was free to decode larger blocks if it wanted too, but I forgot to actually do this for the flate decoder. Fixing this here should solve the speed issues.
2014-05-22Flush pending text on a change of CTM.Robin Watts
Without this, comparefiles/Bug695086 renders the barcode test upside down.
2014-05-22Fix 695222: Treat non-breaking space (U+00A0) as white space for search.Tor Andersson
2014-05-22Fix 695247: Use exponential realloc pattern and qsort for huge paths.Tor Andersson
Grow the edge list using an exponential realloc pattern. Use qsort for huge paths and only fall back to the simple shell sort for small paths.
2014-05-22Load the usecmap directives recursively for builtin CMaps.Tor Andersson
Fixes bug introduced in commit 1679c1e7a89ae62260fd84ce55c6bef376c6e6ba: Optimize UniXXX CMap files.
2014-05-19Remove jmorecfg.h from includes.Chris Liddell
2014-05-19Add an application agnostic memory handler for libjpegChris Liddell
This adds a custom memory management layer between libjpeg and the calling app - in such a way that the code can be shared between mupdf and Ghostscript/PDL.
2014-05-19Fix 694952: Limit Type 3 font glyph bbox size.Tor Andersson
Don't let a glyph's bbox be too much bigger than the font bbox.
2014-05-19Make unresolvable link destinations warnings instead of errors.Tor Andersson
See bug 693314 (file Z23-04.pdf) for an example file.
2014-05-15Fix 695101 and 694114: Use the correct numbers to validate the encryption ↵Tor Andersson
key length. This reverts commit b1ed116091b790223a976eca2381da2875341e10. The key length for V==2 must be 40 <= length <= 128. The key length for V==4 is not taken from the /Length entry.
2014-05-13Use code space ranges when remapping ToUnicode CMaps.Tor Andersson
2014-05-13Fix signedness in cmap interface.Tor Andersson
2014-05-12better buffer underflow protection for ba15a8cd3238a3a3c098ad8b7d96cb0e405fc26fSimon Bünzli
2014-05-12correctly bound image mask clippings in bbox deviceSimon Bünzli
Same as for fz_bbox_fill_image_mask, fz_bbox_clip_image_mask must transform the unit rectangle to get the bounding bbox.
2014-05-12prevent indeterminacy by uninitialized variablesSimon Bünzli
There are two issues where variables may be used unitialized: * extract_exif_resolution fails to set xres and yres for JPEG images if there's no valid resolution unit (mainly affects XPS documents) * xps_measure_font_glyph uses hadv and vadv unitialized if the glyph id isn't valid (i.e. if FT_Get_Advance fails)