summaryrefslogtreecommitdiff
path: root/source/fitz
AgeCommit message (Collapse)Author
2018-08-22Remove the old 'nested depth' tracking.Tor Andersson
This was used to prevent infinite cycles in the Type3 font CharProcs, but the previous commits forbids all cycles in order to prevent memory leaks due to cyclic reference counts.
2018-08-14Bug 699631: Handle unsupported triangle mesh edge flags.Sebastian Rasmussen
There were two issues with the code parsing the triangle mesh's edge flags: * meshes were not require to start with an independent triangle * out of range edge flags caused vertices to be ignored A mesh where the edge flag of the first vertice is out of range, and the edge flag of the second vertex indicates continuation of a prior triangle would result in trying to create a triangle where the third coordinate would be uninitialized. This commit requires the edge flag of the first vertex to indicate a new independent triangle and if out of range edge flags are encountered they are treated as if they indicate a new triangle. Thanks to oss-fuzz for reporting.
2018-08-14Bug 698898: Always pop draw stack in case of exception.Sebastian Rasmussen
When fz_draw_clip_image_mask() calls fz_get_pixmap_from_image() may throw an exception, in this case beacuse a predicted image has an unsupported number of components (1, 2, 4, 8 and 16 are supported, but 6 is not). When this happens the recently pushed stack element is never popped, which later trips an assert() in fz_draw_end_group() at a later stage. By moving the call to fz_get_pixmap_from_image() inside fz_try the stack will be popped, thus avoiding triggering the assert(). This also requires the pixmap variable to be fz_var()ed because it changes inside the fz_try-block.
2018-08-14Bug 698887: Fix leak of device/pixmap when rendering fails.Sebastian Rasmussen
2018-08-10Tweak hexdumped data to increase build portability.Tor Andersson
Follow bin2coff layout for hexdumped data instead of trying to emulate the objcopy layout (which seems to break for the android tools). Only use the basename of the resource in hexdump / bin2coff. Ifdef on HAVE_OBJCOPY instead of _WIN32.
2018-08-10Clean up null/range/endstream filter.Tor Andersson
Use separate functions to keep the code simpler. Use memmem to simplify and optimize search for 'endstream' token. Do not look for 'endobj' since that could cause a false positives in compressed object streams that have duff lengths.
2018-08-10Add fz_memmem function taken from musl libc.Tor Andersson
2018-08-10Preprocessor gluing tokens together causes clang error.Sebastian Rasmussen
2018-08-01Update jbig2dec.Sebastian Rasmussen
2018-07-17Fix memory leaks in document signing functionsPaul Gardiner
2018-07-06Bug 699308: Fix stream reading logic to better cope with duff Lengths.Robin Watts
Always look for the "endstream" marker after a PDF stream to see if we've hit the end. Allow for "endobj" to cope with producers that omit endstream entirely. Avoid slowing down legal files by only checking for the end marker after the specified length has been read.
2018-07-06Fix stray consts.Robin Watts
2018-07-05Add fz_transform_page helper function.Tor Andersson
Create a matrix that transforms a page with resolution and rotation, and grid fits the resulting bounding box.
2018-07-05Silence warning.Tor Andersson
2018-07-05Pass rects by value: device and document interface.Tor Andersson
2018-07-05Pass matrices by value: device and document interface.Tor Andersson
2018-07-05Pass rect and matrix by value in geometry functions.Tor Andersson
Several things irk me about passing values as const pointers: * They can be NULL, which is not a valid value. * They require explicit temporary variables for storage. * They don't compose easily in a legible manner, requiring weird pointer passing semantics where the variable being assigned is hidden as an argument in the innermost function call. * We can't change the value through the pointer, requiring yet more local variables to hold copies of the input value. In the device interface where we pass a matrix to a function, we often find ourselves making a local copy of the matrix so we can concatenate other transforms to it. This copying is a lot of unnecessary busywork that I hope to eventually avoid by laying the groundwork with this commit. This is a rather large API change, so I apologize for the inconvenience, but I hope the end result and gain in legibility will be worth the pain.
2018-07-04Clean up some incomprehensible code.Tor Andersson
2018-07-04Add fz_snap_selection function to snap selection to chars/words/lines.Tor Andersson
Updates the input point coordinates, and also returns a quad with appropriate UI handles.
2018-07-04Add fz_is_point_inside_rect utility function.Tor Andersson
2018-06-22Update base 14 fonts to URW++ release from 2017-07-27.Tor Andersson
The Dingbats and Symbol fonts have not been changed.
2018-06-22Don't pollute namespace with our 'restrict' macro. Use FZ_RESTRICT instead.Tor Andersson
2018-06-22Use fz_quad type in structured text and selection/highlighting.Tor Andersson
2018-06-22Add fz_quad type.Tor Andersson
2018-06-22Remember the md5 digest in the fz_font struct.Tor Andersson
2018-06-22Cache base14 and CJK fonts.Tor Andersson
Do not cache PDF fonts, since they have custom metrics and encodings that cannot be shared. This is primarily to speed up font loading for EPUB, PDF appearance synthesis, and any other uses of default metrics and unicode encoded fonts.
2018-06-22Check pointer for NULL in fz_free before locking.Tor Andersson
2018-06-11Use bin2coff to generate font data blobs object files.Tor Andersson
This is the windows equivalent of objcopy or ld -r binary. We need different bin2coff font object files for 32 and 64 bit builds, so put the font object files in AdditionalDependencies. Revamp Windows builds to use bin2coff. Fix bin2coff to not use '-' in symbol names. Add a new project file to make bin2coff. Add a .rules file to tell MSVC how to call the built version of bin2coff. Update libresources build to use this rules file. Update noto.c to correctly find the symbols we make.
2018-06-02Add a fz_strnlen function (strnlen is not standard C).Tor Andersson
2018-05-16Keep JBIG2 image data compressed in fz_compressed_buffer.Tor Andersson
2018-05-16Purge unused functions.Tor Andersson
2018-05-16Restore Emoji font.Tor Andersson
The Noto symbol font has been split into two. The second symbol font only contains a subset of the emojis, so reinstate the real emoji font and add both symbol fonts to the fallback chain.
2018-05-10Use fz_malloc_no_throw() in JPEG/DCT decoder.Sebastian Rasmussen
Suppose an application that uses MuPDF implements its own allocator that limits the amount of memory that may be allocated. When that condition occurs fz_malloc() will throw an exception, this exception would then be thrown right back to MuPDF without allowing for libjpeg to free any of the memory it has allocated. After this commit fz_malloc_no_throw() is called, which under the same conditions would simply return NULL. allowing for libjpeg to free what ever allocations it has done, and return to MuPDF with an error just like before.
2018-05-07pnm: Remember to always initialize variable.Sebastian Rasmussen
2018-04-27Handle multi-page image formats in muimg document driver.Tor Andersson
Remove the mutiff document type.
2018-04-27Support multipage pnm images.Sebastian Rasmussen
2018-04-25Update Noto fonts.Tor Andersson
Import Source Han Serif 1.001. Use serif fonts in preference for sans.
2018-04-25Update UCDN.Tor Andersson
2018-04-25Don't use WMode as part of CJK font lookup.Tor Andersson
Return TTC subfont index from fz_lookup_noto_font.
2018-04-25Default CJK language to traditional chinese.Tor Andersson
2018-04-25Try other CJK languages to find missing characters.Tor Andersson
2018-04-25Support creating both serif and sans-serif CJK fonts in mutool create.Tor Andersson
Also support Vertical WMode.
2018-04-25Use objcopy to compile font resources.Tor Andersson
2018-04-25Check in generated ICC profiles.Tor Andersson
2018-04-25Check in generated CMap source.Tor Andersson
Created with the 'scripts/runcmapdump.sh' script.
2018-04-23Avoid SEGV when mudrawing to SVG.Robin Watts
Belt and braces: 1) Don't attempt to close a NULL output stream. 2) If an output stream is NULL when we do close it, don't SEGV.
2018-04-19Support CalRGB (and CalGray) as destination color spacesMichael Vrhel
I did not foresee the case where a transparency groups color space could be a Cal color space. I had always thought of them as only be source color spaces not destination color spaces. This commit makes sure that we have the equivalent ICC profile when the destination is a Cal space.
2018-04-11Remove needless #defines in load-jpx.cTor Andersson
2018-04-11Rework how we handle DynaLab tricky fonts in freetype.Tor Andersson
Force the face_flags to include TRICKY if we detect a DynaLab font name instead of trying to force hinting ourselves.
2018-04-06Fix store multi-threading problem.Robin Watts
While running 'ensure_space', we can drop and retake the alloc lock. This can enable other threads to perform store operations, which can trigger reaps. When reaps happen, fz_item's are discarded. This is particularly bad when ensure_space happens to be holding onto a pointer to one (prev). The fix, implemented here, is to move items out of the store list (and hash table), and put them onto a local 'to_be_freed' list. Once on this local list we can be sure that they won't be found by other threads doing store operations, and they can be safely freed from there (dropping/retaking the lock as required).