Robin Watts [Sun, 7 Aug 2022 16:15:42 +0000 (17:15 +0100)]
Guard against SEGVs when calling archive functions with NULL archive.
As seen with fz_add_css_font_face not having a zip pointer. Thanks
to Harald for spotting the problem.
Sebastian Rasmussen [Mon, 25 Jul 2022 20:04:08 +0000 (22:04 +0200)]
Bug 705681: Enclose code in begin/end operation.
Previously the contents of pdf_set_annot_appearance()
is enclosed in begin/end annotation operation calls, while
pdf_set_annot_appearance_from_display_list() does not.
This causes a problem when a user tries to set an annotation
appearance using a display list that causes a new external
graphics state PDF object to be created in pdf_dev_alpha().
When pdf_add_object() is called without being bracketed by
begin/end operation which it continues to call
pdf_create_object() which ends up calling
pdf_add_journal_fragment(). This function will segfault because
it assumes doc->journal->current being non-NULL, which is not
true unless the call is enclosed by begin/end operation.
This commit fixes the issue by adding calls to being_annot_op()
and end_annot_op() to the top-level function
pdf_set_annot_appearance_from_display_list().
Julian Smith [Wed, 20 Jul 2022 11:57:54 +0000 (12:57 +0100)]
source/pdf/pdf-clean.c: fix segv from incorrect call to fz_drop_pixmap().
When pixmap_cloned is set, we need to drop pixmap only when throwing an
exception. Otherwise later code will be using pixmap after it has been freed.
Sebastian Rasmussen [Wed, 13 Jul 2022 01:45:47 +0000 (03:45 +0200)]
Ensure AndroidDrawDevice is destroyed, even upon exception.
Without this the AndroidDrawDevice and any resources on its draw stack
will remain until the Android JVM decides to garbage collect the
unreferenced AndroidDrawDevice object. This may take a long time, hence
it is prudent to call AndroidDrawDevice.destroy() when one knows that
the device object and its resources will not be used again.
Sebastian Rasmussen [Fri, 8 Jul 2022 17:27:24 +0000 (19:27 +0200)]
Return error, not success when unable to lock native device resource.
Commit
3bd8ce45a9a29c8131deab37df17c24b1ece162b accidentally changed
the return value upon thrown exceptions in the locking function.
This meant that even if the AndroidDrawDevice failed to lock the bitmap
it would set the pixmap sample pointer to NULL, throw an exception
and then return success to the caller. The caller newNativeAndroidDrawDevice()
detects errors based on the return value, because it indicates success
it would proceed to clear the pixmap samples. Since the samples pointer
was set to NULL this would generate a segmentation fault.
By instead indicating failure in the return value the caller will stop
using the pixmap samples, free all resources and propagate the error.
This is implemented in this commit and thus avoids the segmentation fault.
Sebastian Rasmussen [Thu, 30 Jun 2022 01:16:08 +0000 (03:16 +0200)]
Android if unable to lock bitmap samples, return error.
Sebastian Rasmussen [Wed, 29 Jun 2022 23:47:12 +0000 (01:47 +0200)]
Mark variables fz_var that are set in fz_try, and accessed in fz_always/fz_catch.
In xps one variable also needed to be set to a default value in
case an exception is throw early on.
Sebastian Rasmussen [Wed, 29 Jun 2022 01:53:56 +0000 (03:53 +0200)]
Bug 705620: Start journal operation instead of pushing local xref.
Previously two API functions accidentally mixed up pushing a local xref
(necessary when accessing annotation properties) with starting journal
operations (necessary when changing/setting annotation properties).
This meant that e.g. when clearing an annotation inklist the underlying
object was never actually modified, only the transient one in the local
xref.
Sebastian Rasmussen [Tue, 28 Jun 2022 20:29:00 +0000 (22:29 +0200)]
Warn, don't assert, when storing multiple values for same key in PDF store.
It brings release and debug builds into parity, both will warn, neither
will abort. It's the best we can do until MuPDF can consistently handle
repairs interrupting parsing and having both objects from pre and post
repair phases around at the same time.
This fixes oss-fuzz issue 48451.
Tor Andersson [Tue, 14 Jun 2022 12:19:22 +0000 (14:19 +0200)]
Update CHANGES for final 1.20.0 release.
Sebastian Rasmussen [Sun, 12 Jun 2022 19:03:49 +0000 (21:03 +0200)]
Set default button group type for alert dialog boxes.
Fixes Coverity 249353.
Robin Watts [Thu, 9 Jun 2022 16:07:51 +0000 (17:07 +0100)]
Bug 704897: When redacting, redact image softmasks too.
Sebastian Rasmussen [Wed, 8 Jun 2022 16:43:12 +0000 (18:43 +0200)]
Update list of thirdparty libraries.
Sebastian Rasmussen [Wed, 8 Jun 2022 15:16:50 +0000 (17:16 +0200)]
Bug 705467: Add stubs for javasript console in case js is disabled.
Sebastian Rasmussen [Tue, 7 Jun 2022 18:36:38 +0000 (20:36 +0200)]
Bug 705438: At end of unpack_arguments() call, pass NULL instead of 0.
A zero will through integer promotion be of type int, but what
unpack_arguments() actually expects is a pointer. As along as the
sizes of int and pointers are the same this causes no issue. But
on 64-bit platforms where pointers are 64 bits wide and int is
32 bits wide, the argument list will not be initialized fully.
In these situations the unpack_arguments() function will try to read
64 bits despite the trailing 0 only having initialized 32 bits at
the end of the argument list, possibly causing a crash.
Passing NULL will, since it is a void* pointer, will cause all
64 bits to be fully initialized fixing the problem.
Robin Watts [Tue, 7 Jun 2022 16:04:17 +0000 (17:04 +0100)]
Always include tesseract NEON code file in build.
For non-ARMs, or for ARMs without NEON, that file will compile
away to nothing.
For ARMs with tesseract enabled, it will compile, regardless
of whether we have HAVE_NEON. We can have neon and not HAVE_NEON
because __aarch64__ being defined implies the presence of NEON.
Sebastian Rasmussen [Sun, 5 Jun 2022 13:44:02 +0000 (15:44 +0200)]
Fix compilation warning due to mixing code and declarations.
Sebastian Rasmussen [Sat, 4 Jun 2022 16:31:24 +0000 (18:31 +0200)]
Bug 705427: Check for null before trying to allocate java string.
Since the dialog check box is optional, the check box message might
be NULL, which causes NewStringUTF() to throw an exception.
Tor Andersson [Tue, 31 May 2022 11:14:33 +0000 (13:14 +0200)]
Bug 705248: Tweak RLE bomb detection.
MSVC eliminated identical functions, meaning we can't compare the
function pointers to detect whether the RLE defusing function was
installed.
If we make the defusing function publicly visible we can defeat this
optimization, but there is no guarantee another compiler won't
unify even public functions.
So we just force the newly created stream to be at EOF instead.
Sebastian Rasmussen [Tue, 24 May 2022 13:05:45 +0000 (15:05 +0200)]
Bug 705331: Pass checkbox message to event listener, not message string.
Sebastian Rasmussen [Wed, 25 May 2022 15:41:58 +0000 (17:41 +0200)]
Bug 705345: Make it possible to know if a checkbox should be present or not.
Sebastian Rasmussen [Wed, 25 May 2022 15:33:39 +0000 (17:33 +0200)]
Use default checkbox message for alert events if message is not coercible.
Tor Andersson [Tue, 24 May 2022 11:24:08 +0000 (13:24 +0200)]
Use max compression when making tarballs.
Sebastian Rasmussen [Tue, 24 May 2022 15:54:39 +0000 (17:54 +0200)]
Bug 705332: Fix default checkbox state for alert events.
Previously it defaulted to checked, but the spec states that
oCheckbox.bInitialValue should default to false.
Sebastian Rasmussen [Tue, 24 May 2022 13:05:45 +0000 (15:05 +0200)]
Bug 705331: Pass the title to event listener, not the message string.
Robin Watts [Fri, 20 May 2022 15:37:03 +0000 (16:37 +0100)]
Tweak Java classes that provide equals methods.
It's important that equals is an Override, not an Overload
(apparently). Also it's important that if A.equals(B) that
A.hashCode() == B.hashCode().
Sebastian Rasmussen [Fri, 20 May 2022 11:52:28 +0000 (13:52 +0200)]
Throw exception if no xref entry can be found.
This is a band aid for the multitude of cases were it is difficult
to determine if MuPDF can in fact return NULL at that point in the
code.
Sebastian Rasmussen [Fri, 20 May 2022 11:54:25 +0000 (13:54 +0200)]
Bug 705309: When fixing xref entry offsets, handle missing objects.
The xref entry is missing, so pdf_cache_object() must handle missing
objects too.
This bug appears due to pdf_get_xref_entry() starting to return NULL
from commit
57f329ef3.
Sebastian Rasmussen [Fri, 20 May 2022 11:51:23 +0000 (13:51 +0200)]
Bug 705308: Ensure xref stream field width entries are direct objects.
Tor Andersson [Tue, 17 May 2022 11:32:48 +0000 (13:32 +0200)]
Bug 705293: Fix linewidth adjustment for Square and Circle annotations.
Sebastian Rasmussen [Mon, 16 May 2022 12:04:26 +0000 (14:04 +0200)]
Change test to apply both to mingw native and cross-compile builds.
Robin Watts [Thu, 19 May 2022 09:28:15 +0000 (10:28 +0100)]
Tweak fz_recognise_document.
Reinstate fz_recognize_document understanding magic == extension,
such as "pdf".
Tor Andersson [Tue, 17 May 2022 13:06:36 +0000 (15:06 +0200)]
Bug 705302: Make base64 decoding more lenient.
Robin Watts [Tue, 17 May 2022 14:50:39 +0000 (15:50 +0100)]
Tweak makefile for Tesseract flags.
Firstly, make sure that we supply -std=C++11 as a flag when
building tessocr.cpp. gcc on MacOS was defaulting to an older
version. We do this using a TESSERACT_LANGFLAGS variable so
that this can be overridden from the command line if required
(say, because someone is using something other than gcc).
Secondly, ensure that we pass the same set of predefines to
both tessocr.cpp and the tesseract build itself, so that
tesseract headers always see a consistent set of defines.
Tor Andersson [Thu, 12 May 2022 12:09:30 +0000 (14:09 +0200)]
Allow using system LCMS2 libraries without the cmsFLAGS_PREMULT flag.
Sebastian Rasmussen [Thu, 12 May 2022 21:17:53 +0000 (23:17 +0200)]
Bug 705296: Call pdf_cycle() even for non-indirect colorspaces.
Consider when an indexed colorspace array is passed to
pdf_load_colorspace_imp(). In this case pdf_is_indirect() returns
false and boolean short-cutting causes pdf_cycle() not to be called.
Despite pdf_cycle_list remaining uninitialized it is passed to e.g.
load_indexed(), which tries to load the base colorspace, thus calling
pdf_load_colorspace_imp() again. The base colorspace might be an
indirect reference causing pdf_cycle() to be called. When pdf_cycle()
follows pdf_cycle_list->up it will eventually encounter the
uninitialized pdf_cycle_list entry at the top, likely causing the
reported segfault.
Commit
865ee9aa6d5e84eaa09cd997ca9483c3ee449e85 added the call to
pdf_is_indirect(), but doesn't provide any benefit so this commit
removes the check.
Robin Watts [Mon, 9 May 2022 14:09:47 +0000 (15:09 +0100)]
Update .editorconfig with version saved from VS2019.
Sebastian Rasmussen [Thu, 12 May 2022 20:48:24 +0000 (22:48 +0200)]
Return loaded ICC colorspace instead of throwing exception.
commit
169d42e87f8d356f3eba3cbcd577c43bf6967997 removed the
return statement by accident when introducing pdf_cycle detection.
This fixes oss-fuzz 47235.
Tor Andersson [Wed, 11 May 2022 11:11:39 +0000 (13:11 +0200)]
Update CHANGES and bump version to 1.20.0
Tor Andersson [Wed, 11 May 2022 00:01:55 +0000 (02:01 +0200)]
Use lzip and/or zstd instead of xz for release archives.
Use pigz (parallel gzip) and plzip to speed up compression.
Tor Andersson [Tue, 10 May 2022 13:03:29 +0000 (15:03 +0200)]
wasm: Don't use nested WebWorker for the fetch thread.
In Safari, Workers can't create new workers. Move the fetch requests to the
main mupdf-worker thread instead.
This code is simpler because we don't need to pass messages to a separate
fetching thread, but we also run the risk of delaying a prefetch request if the
worker thread is busy when a block finishes fetching. This should not matter
too much in practice.
Tor Andersson [Wed, 4 May 2022 13:35:45 +0000 (15:35 +0200)]
Remove spurious newline printed to stddbg.
Tor Andersson [Wed, 4 May 2022 13:18:41 +0000 (15:18 +0200)]
Only close text input dialog on enter if value is accepted.
Tor Andersson [Tue, 10 May 2022 11:01:15 +0000 (13:01 +0200)]
Bug 705265: Cope with name trees where the Limits are also wrong.
Tor Andersson [Tue, 3 May 2022 14:43:47 +0000 (16:43 +0200)]
Fix to make pdf_mark_list_push balance with pdf_mark_list_pop...
...even when pushing a non-indirect object.
Tor Andersson [Fri, 15 Apr 2022 14:32:38 +0000 (16:32 +0200)]
Add mark bits structure when structures are expected to touch more objects.
Use it in the outline code which often handles very long and deep lists.
Tor Andersson [Fri, 15 Apr 2022 14:16:58 +0000 (16:16 +0200)]
Avoid malloc on short pdf_mark_lists.
Tor Andersson [Fri, 15 Apr 2022 14:13:08 +0000 (16:13 +0200)]
Check object numbers instead of pointers in pdf_mark_list.
This should make it more robust in the face of pdf_repair, and prevent
using stale pre-reparation objects around for comparison.
Tor Andersson [Fri, 15 Apr 2022 13:58:59 +0000 (15:58 +0200)]
Check object numbers instead of pointers in pdf_cycle.
This should make it more robust in the face of pdf_repair, and prevent
using stale pre-reparation objects around for comparison.
Tor Andersson [Mon, 2 May 2022 11:30:30 +0000 (13:30 +0200)]
Mark XObject, ColorSpace, and Resource objects when scanning separations.
Tor Andersson [Mon, 2 May 2022 10:36:27 +0000 (12:36 +0200)]
Mark XObject and Pattern objects when checking transparency.
Don't only mark the Resource dictionary itself as that may not always
be an indirect object.
Tor Andersson [Fri, 29 Apr 2022 16:35:29 +0000 (18:35 +0200)]
Fix doubled cycle recursion checks in colorspace and function loading.
Only check for cycles at the top level and for colorspaces that are
indirect objects.
Tor Andersson [Wed, 13 Apr 2022 13:11:52 +0000 (15:11 +0200)]
Use a linked list on the stack to do PDF cycle detection.
Avoid using the global pdf_obj mark bits, to prevent accidental
collisions between different parts of the code using the same bits
for different purposes. Also allows us to track marked content
without interference from pdf_repair.
Tor Andersson [Thu, 14 Apr 2022 19:33:05 +0000 (21:33 +0200)]
Purge unneccessary recursion detection.
It should be detected long before we arrive here.
Tor Andersson [Thu, 14 Apr 2022 18:04:24 +0000 (20:04 +0200)]
Add Type 3 font recursion guard in pdf_document.
This commit disallows type 3 fonts from referencing any other type 3 fonts.
With a bit of care, we could change the t3_lock field to a stack of type 3
fonts currently being loaded and forbid real cycles instead.
This doesn't seem worth the effort, since type 3 fonts that reference
other type 3 fonts are extremely rare outside of hand crafted examples.
Much of the complications with tracking type 3 font recursion (and other
recursion detection) come from PDF reparation being triggered in the middle
of loading objects. This commit avoids that can of worms entirely for type 3
font loading and rendering.
Tor Andersson [Thu, 28 Apr 2022 13:08:50 +0000 (15:08 +0200)]
wasm: Configure block size and prefetch from URL.
Tor Andersson [Thu, 28 Apr 2022 12:43:07 +0000 (14:43 +0200)]
xps: Only render incomplete pages if there is a cookie to signal it.
Tor Andersson [Thu, 28 Apr 2022 11:58:23 +0000 (13:58 +0200)]
Recognize mime-types with periods, like application/vnd.ms-xpsdocument.
Sebastian Rasmussen [Wed, 20 Apr 2022 22:32:33 +0000 (00:32 +0200)]
Throw exception on malformed base64 input.
Tor Andersson [Tue, 26 Apr 2022 14:03:10 +0000 (16:03 +0200)]
Make CMap parser more robust.
If an error is encountered, skip ahead to the next matching "endxxx"
keyword, or to the next error, or to the end of file.
Olivier FAURE [Tue, 12 Apr 2022 12:39:13 +0000 (14:39 +0200)]
wasm: Rework Makefile for wasm platform
* Small Makefile fixes.
* Add debug profile with faster build times.
* Add .gitignore to ignore build artifacts and sample files.
* Default to release build, include user.make to replace default.
Tor Andersson [Fri, 15 Apr 2022 13:42:09 +0000 (15:42 +0200)]
Use pdf_mark_list in pdf_lookup_page_number_slow and pdf_lookup_page_loc_imp.
Tor Andersson [Fri, 15 Apr 2022 12:01:27 +0000 (14:01 +0200)]
Fix usage message in mudraw: -f does not take an argument.
Sebastian Rasmussen [Wed, 13 Apr 2022 15:26:05 +0000 (17:26 +0200)]
docs: Update the zlib version mentioned in the thirdparty list.
Tor Andersson [Mon, 11 Apr 2022 23:19:34 +0000 (01:19 +0200)]
Fix scoping error in WASM wrapper function: openURL.
Sebastian Rasmussen [Sat, 9 Apr 2022 03:01:51 +0000 (05:01 +0200)]
Make sure that excluded fields are excluded when resetting form.
pdf_reset_form() takes a list of fields and an exlusion flag. If the
exclusion flag is cleared the fields in the list should be reset. If
the exclusion flag is set all fields EXCLUDING those in the list
should be reset.
This should be accomplished by calling specified_fields() which should
return an array of fields to reset. specified_fields() receives the
exclusion flag and the list of fields and will add /Exclude null
entries to field dictionaries that should be ignored.
Later on specified_fields() calls add_field_hierarchy_to_array() to
filter out the fields that should be reset into a resulting array.
This detection consists of looking for the /Exclude null entry in each
field's dictionary. The problem is that since the value of /Exclude is
null then it cannot differentiate between no entry and an /Exclude
null entry.
This is likely a regression from when PDF_NULL became == NULL in
commit
706ed587b875fab178fbfc2b60e1a49527e89b80.
The approach with the /Exclude flag has the drawback that all
PDF field object will have been changed regardless of whether it
has been reset or not.
This commit changes the approach to for each field scan through the
(likely short) list of fields to include/exclude. This avoids
misinterpreting the /Exclude flag and avoids unnecessarily dirtying
PDF field objects.
Sebastian Rasmussen [Mon, 11 Apr 2022 00:18:16 +0000 (02:18 +0200)]
When looking up form field, also match internal fields.
Sebastian Rasmussen [Sat, 9 Apr 2022 02:33:30 +0000 (04:33 +0200)]
Reset radio button to a valid default value, otherwise Off.
Previously when resetting a radio button field group to its default
value all dependent radio button fields would inherit this and set
their value to the default value.
Consider a radio button field group with default value /accepted and
two dependent radio button fields one with the appearance states /Off
and /accepted and the other field with the appearance states /Off and
/declined. When the field group was reset its value changed to
/accepted. This then propagated to both of the dependent fields, but
only one of them has the appearance state /accepted. So setting the
value in both radio button field to /accepted is wrong.
With this commit, a radio button field can only be reset to values
that exist in its normal appearance state dictionary. In the example
above it means that the radio button that lacks the normal appearance
state /accepted will be set to /Off instead.
Sebastian Rasmussen [Sat, 9 Apr 2022 22:24:26 +0000 (00:24 +0200)]
Mark buffer with fz_var() to avoid use of freed pointer.
This fixes OSS-fuzz issue 46541.
Tor Andersson [Fri, 8 Apr 2022 11:43:41 +0000 (13:43 +0200)]
mupdf-gl: Add "layer" panel to hide/show individual layers.
Tor Andersson [Fri, 8 Apr 2022 11:24:54 +0000 (13:24 +0200)]
Add option to enable/disable individual layers in mutool draw.
Tor Andersson [Fri, 8 Apr 2022 11:33:09 +0000 (13:33 +0200)]
Treat label names as text strings in the layer config UI.
Tor Andersson [Wed, 23 Mar 2022 17:57:09 +0000 (18:57 +0100)]
wasm: Progressive loading by fetching HTTP ranges in the background.
Sebastian Rasmussen [Wed, 6 Apr 2022 01:38:18 +0000 (03:38 +0200)]
Only store font descriptor for type 3 fonts once.
When MuPDF is interpreting page contents into a display list and
the contents refer to a type 3 font it loads the font. MuPDF
first queries the store to check if the font descriptor has been
cached. If so it is returned and used during rendering, otherwise
the font descriptor is loaded from the the document file.
When loading the font descriptor, the CharProcs stream for each
glyph in the font is read and interpreted into a display list.
This happens when pdf_load_font() calls pdf_load_type3_glyphs()
which in turn calls fz_prepare_t3_glyph() for each glyph.
Interpretation of the font's CharProcs streams into display lists
is done so that subsequent processing of the page display can
solely rely on the store for font information and avoid having to
re-parse the document file. So caching the font descriptor is
necessary. Once the font descriptor has been loaded, it is
unconditionally inserted into the store.
Type 3 fonts may have cycles which cause problems:
* a CharProcs stream for one glyph recursively referring to
its own glyph.
* and a CharProcs stream for one glyph referring to that of
another glyph in the same font.
The first type causes obvious cylic behaviour when interpreting
the CharProcs stream of the glyph, the second type does not.
MuPDF already handles the first type of cycle by doing two things
in fz_prepare_t3_glyph() and fz_render_t3_glyph_direct():
1) checking whether the CharProcs stream is NULL before trying
to process the glyph,
2) and temporarily setting a glyph's CharProcs stream to NULL
while its stream is being processed.
This breaks cyclic references since the CharProcs stream will be
NULL at the beginning of the nested call, causing the nested
reference not to be rendered. This breaks the cycle for an
individual glyph but is not enough to prevent the type 3 font
from being loaded recursively.
Both types of cycles cause asserts in debug builds due to repeated
caching of font descriptors in the store.
The intial loading of the the type 3 font causes recursive loading of
the type 3 font due a CharProcs stream refering to the font itself.
The font descriptor is first inserted into the store in the nested
call. Once all glyphs have been processed in the top-level call it
will again insert the font descriptor into the store.
In release builds asserts are not enabled, but they are in debug
builds. When inserting objects into the store it asserts that there
must not already be an existing entry. So when type 3 fonts with
cycles of the second type cause the font descriptor to be inserted a
second time this assert is triggered because it already exists.
MuPDF now removes the font descriptor potentially cached in the nested
call. This means that later on when pdf_load_font() tries to insert
the font descriptor again there will not be any existing entry and the
assert is not triggered.
This fixes OSS-fuzz issue 38139.
Sebastian Rasmussen [Wed, 6 Apr 2022 00:19:59 +0000 (02:19 +0200)]
Plug leak of font stream upon exception loading embedded font.
In commit
d0b7a07bde51f27da01573b7e69b4bc2682bebc3 the code to
extract CFF subtable for OpenType fonts was not enclosed by the
fz_try in pdf_load_embedded_font(). This means that the buffer
that is loaded at the beginning of pdf_load_embedded_font() will
leak in case pdf_extract_cff_subtable() throws an exception.
This commit simply moves the OpenType-related code inside the
trailing fz_try block whose fz_always ensures that the buffer is
always dropped.
This fixes OSS-fuzz issue 44050.
Sebastian Rasmussen [Wed, 6 Apr 2022 13:05:26 +0000 (15:05 +0200)]
jni: Keep to JDK 8 specific interfaces.
Avoid interfaces available starting from JDK 9.
InputStream.readAllBytes() is not a good enough
reason to upgrade the JDK requirement.
Sebastian Rasmussen [Wed, 6 Apr 2022 15:28:07 +0000 (17:28 +0200)]
jni: Add interface for reading buffer into output stream.
Also take this opportunity to rename the new APIs for consistency.
Sebastian Rasmussen [Wed, 6 Apr 2022 15:27:37 +0000 (17:27 +0200)]
jni: Fix bug where buffer never read anything into byte array.
Sebastian Rasmussen [Wed, 6 Apr 2022 13:13:23 +0000 (15:13 +0200)]
jni: Fix off by one boundary check when writing to buffer.
Sebastian Rasmussen [Tue, 5 Apr 2022 17:37:18 +0000 (19:37 +0200)]
Throw exception if Size entry in trailer is indirect.
Previously when MuPDF encountered an indirect /Size entry while
parsing the xref it would try to resolve the indirect object before
having fully read the xref causing a crash.
Now MuPDF ensures that the /Size entry is not an indirect object
as this is not allowed according to the PDF specification.
Fixes OSS-fuzz issue 46372.
Sebastian Rasmussen [Fri, 1 Apr 2022 02:11:20 +0000 (04:11 +0200)]
js/jni: Expose APIs to add file specifications to annotations.
Sebastian Rasmussen [Tue, 5 Apr 2022 11:56:01 +0000 (13:56 +0200)]
Add interface to extraction file status change time.
Sebastian Rasmussen [Fri, 1 Apr 2022 18:13:10 +0000 (20:13 +0200)]
jni: Return PDF null object when accessing null as array/dict or resolving null.
Sebastian Rasmussen [Fri, 1 Apr 2022 17:21:18 +0000 (19:21 +0200)]
jni: Fix bug in PDFObject.isNull() that does not recognize PDFObject.Null.
Julian Smith [Sat, 2 Apr 2022 09:57:13 +0000 (10:57 +0100)]
lgtm fixes for python code.
Most of these fix problems introduced when scripts/mupdfwrap.py was split into
separate files in scrits/wrap/.
Also removed scripts/pymupdf-mimic/; was experimental code pushed by mistake a
while ago.
Julian Smith [Wed, 30 Mar 2022 13:34:19 +0000 (14:34 +0100)]
include/: made all headers be self-contained.
E.g. where a header declares a fn that uses fz_context, and the header's
existing #include's did not bring in context.h, added a #include of
mupdf/fitz/context.h.
This can be tested by:
./scripts/mupdfwrap.py --check-headers all
(which runs cc on each header in turn.)
Julian Smith [Wed, 30 Mar 2022 13:27:06 +0000 (14:27 +0100)]
scripts/wrap/__main__.py: added --check-headers.
Checks that MuPDF header files are self contained, i.e. that they #include all
required headers.
Sebastian Rasmussen [Fri, 18 Mar 2022 14:00:01 +0000 (15:00 +0100)]
jni: Rename font encoding constants.
Sebastian Rasmussen [Tue, 22 Feb 2022 17:47:30 +0000 (18:47 +0100)]
java: Remove static core library for make clean target.
Sebastian Rasmussen [Thu, 10 Mar 2022 02:50:45 +0000 (03:50 +0100)]
Output color params in trace device.
Sebastian Rasmussen [Mon, 28 Mar 2022 15:43:53 +0000 (17:43 +0200)]
Update to zlib 1.2.12.
Robin Watts [Mon, 28 Mar 2022 17:48:38 +0000 (18:48 +0100)]
Bug 704874: Overprint separation was always on, even when disabled.
Track overprint similation in the device, rather than purely with
the presence/absence of the fz_separations structure.
Sometimes the fz_separations parameter is not carried forwards, so
we can end up enabling separation simulation even when we had
explicitly turned it off.
Sebastian Rasmussen [Sun, 27 Mar 2022 00:29:03 +0000 (01:29 +0100)]
Only derive missing font bbox if there are glyphs in type 3 font.
In commit
cdac8477d0c41d4df6bfdf151adf9891819d6738 an omission causes
a crash when loading a type 3 font with an invalid font bbox and no
glyphs.
The reason is that pdf_load_type3_glyphs() only called
fz_prepare_t3_glyph() when there is at least one font->t3procs set.
When fz_prepare_t3_glyph() is called, it causes get_git_bbox() to be
called, which populated font->bbox_table. For a font with no glyphs
there are no font->t3procs set, so fz_prepare_t3_glyph() is never
called, therefore get_gid_bbox() is never called, and font->bbox_table
is left being NULL.
A type 3 font without any glyphs may still have the flag invalid_bbox
set, which later causes pdf_load_type3_glyphs() to try to derive the
missing font bbox from the union of all glyph bboxes stored in
font->bbox_table. The omission is that there is no check to ensure
that font->bbox_table is not NULL.
This commit adds this check. From now on if a type 3 font has an
invalid_bbox and no glyphs the font bbox is left as the unit bbox, as
initialized in fz_new_font().
Fixes OSS-fuzz issue 46021.
Julian Smith [Sat, 26 Mar 2022 13:27:56 +0000 (13:27 +0000)]
scripts/pypackage.py: pass --pypi-test value to remotes.
Allows slightly simpler running of tests.
Julian Smith [Sat, 26 Mar 2022 12:05:55 +0000 (12:05 +0000)]
setup.py: fixed link to notion page. minor changes to comments.
Julian Smith [Fri, 25 Mar 2022 10:57:26 +0000 (10:57 +0000)]
scripts/wrap/: fixed SWIG Directors wrapping classes on Windows.
scripts/wrap/cpp.py:
Fixed handling of shallow typedefs.
Added FZ_FUNCTION prefixes to swig directors methods.
scripts/wrap/swig.py:
show diagnostic about --swig-windows-auto on windows if swig not found.
scripts/wrap/__main__.py:
minor.
Julian Smith [Fri, 25 Mar 2022 10:55:21 +0000 (10:55 +0000)]
scripts/jlib.py: improved exception_info().
Optionally handle chained exceptions.
Use same arg names as traceback.* fns.
Added doctests.
Robin Watts [Fri, 25 Mar 2022 11:17:05 +0000 (11:17 +0000)]
Update extract; new expected output due to bbox changes in MuPDF.
Robin Watts [Wed, 16 Mar 2022 16:33:03 +0000 (16:33 +0000)]
Remove font advance cache size limit.
Robin Watts [Wed, 16 Mar 2022 16:20:10 +0000 (16:20 +0000)]
Move fz_font bbox_table to be a 2 layer sparse table.
No longer limited to 4096 entries.