summaryrefslogtreecommitdiff
path: root/source/fitz/unzip.c
AgeCommit message (Collapse)Author
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.
2017-11-22Use custom allocator everywhere zlib is used.Sebastian Rasmussen
2017-11-01Use int64_t for public file API offsets.Tor Andersson
Don't mess with conditional compilation with LARGEFILE -- always expose 64-bit file offsets in our public API.
2017-09-19Fix 698540: Check name, comment and meta size field signs.Tor Andersson
2017-04-27Use FZ_SEEK_SET macros for fz_seek.Tor Andersson
Don't depend on stdio.h for our own I/O functions.
2017-04-27Include required system headers.Tor Andersson
2017-03-28Rename fz_new_archive to fz_new_derived_archiveRobin Watts
Fits with the rest of the code.
2016-12-27Stylistic cleanups.Tor Andersson
2016-11-14Make fz_buffer structure private to fitz.Robin Watts
Move the definition of the structure contents into new fitz-imp.h file. Make all code outside of fitz access the buffer through the defined API. Add a convenience API for people that want to get buffers as null terminated C strings.
2016-11-03Fix signed/unsigned and size_t/int/fz_off_t warnings.Robin Watts
All seen in MSVC, mostly in 64bit builds.
2016-09-20Avoid signed/unsigned warnings.Robin Watts
2016-09-08Make fz_archive a generic archive type.Sebastian Rasmussen
Previously it was inherently tied to zip archives and directories. Now these are separated out into distinct subclasses. This prepares for support for further archive formats.
2016-08-17zip: Used unpacked entry size, not listed entry size.Sebastian Rasmussen
The size listed in the central directory can be used to allocate an output buffer and inflate can be told to not write more than this number of bytes. The listed size cannot be assumed to be the size of the output data however as the zip file may be corrupted. Instead the size of the output data must be given by inflate and must be less than or equal to the listed size. The same reasoning goes for uncompressed entries and simply reading the uncompressed data from the archive file (which may terminate early). Fixes indeterminism broken_png_image.xps.
2016-06-17Use 'size_t' instead of int as appropriate.Robin Watts
This silences the many warnings we get when building for x64 in windows. This does not address any of the warnings we get in thirdparty libraries - in particular harfbuzz. These look (at a quick glance) harmless though.
2015-12-11Use fz_output instead of FILE* for most of our output needs.Tor Andersson
Use fz_output in debug printing functions. Use fz_output in pdfshow. Use fz_output in fz_trace_device instead of stdout. Use fz_output in pdf-write.c. Rename fz_new_output_to_filename to fz_new_output_with_path. Add seek and tell to fz_output. Remove unused functions like fz_fprintf. Fix typo in pdf_print_obj.
2015-09-14Remove unused functions.Tor Andersson
2015-08-17Patch around INT32_MAX not being present on windows.Robin Watts
It's a C99ism.
2015-07-31Use new fz_read_int functions.Tor Andersson
2015-05-15Support pdf files larger than 2Gig.Robin Watts
If FZ_LARGEFILE is defined when building, MuPDF uses 64bit offsets for files; this allows us to open streams larger than 2Gig. The downsides to this are that: * The xref entries are larger. * All PDF ints are held as 64bit things rather than 32bit things (to cope with /Prev entries, hint stream offsets etc). * All file positions are stored as 64bits rather than 32. The implementation works by detecting FZ_LARGEFILE. Some #ifdeffery in fitz/system.h sets fz_off_t to either int or int64_t as appropriate, and sets defines for fz_fopen, fz_fseek, fz_ftell etc as required. These call the fseeko64 etc functions on linux (and so define _LARGEFILE64_SOURCE) and the explicit 64bit functions on windows.
2015-02-17Remove pointless return value checks when calling fz_open_file.Tor Andersson
fz_open_file does not return NULL on failure -- it throws an exception!
2015-02-17Add ctx parameter and remove embedded contexts for API regularity.Tor Andersson
Purge several embedded contexts: Remove embedded context in fz_output. Remove embedded context in fz_stream. Remove embedded context in fz_device. Remove fz_rebind_stream (since it is no longer necessary). Remove embedded context in svg_device. Remove embedded context in XML parser. Add ctx argument to fz_document functions. Remove embedded context in fz_document. Remove embedded context in pdf_document. Remove embedded context in pdf_obj. Make fz_page independent of fz_document in the interface. We shouldn't need to pass the document to all functions handling a page. If a page is tied to the source document, it's redundant; otherwise it's just pointless. Fix reference counting oddity in fz_new_image_from_pixmap.
2015-02-17Rename fz_close_* and fz_free_* to fz_drop_*.Tor Andersson
Rename fz_close to fz_drop_stream. Rename fz_close_archive to fz_drop_archive. Rename fz_close_output to fz_drop_output. Rename fz_free_* to fz_drop_*. Rename pdf_free_* to pdf_drop_*. Rename xps_free_* to xps_drop_*.
2014-12-12fix memory leaksSimon Bünzli
Commit 5add23c7233c3f34fdfa6387873b1d3bdb93e1d6 and commit 2f4cdd4fd0580e3121773e89a7c6e7a9e1ffa54b introduced three memory leaks which only appear in error cases: * unzip.c leaks if a ZIP archive uses a compression method other than store or Deflate * xps-zip.c leaks if fz_open_archive_with_stream throws for broken ZIP archives * xps-zip.c leaks also if a piece of a split file is missing
2014-12-03Fix leak of directory string in fz_archive.Tor Andersson
2014-12-03Add ZIP file and directory reading module.Tor Andersson