diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2016-12-19 01:14:39 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-12-19 11:13:25 +0100 |
commit | feac2335a0c91b32a5d6a4fe2abd4a7788cf06d8 (patch) | |
tree | afa20250201fab14107b7bb2a3230d3af133a89f /source | |
parent | 131da04f4c660feba409117f19613bf97cbdb437 (diff) | |
download | mupdf-feac2335a0c91b32a5d6a4fe2abd4a7788cf06d8.tar.xz |
Fix typo in dictionary entry sorting.
Commit a92f0db5987b408bef0d9b07277c8ff2329e9ce5
introduced a typo causing pdf_sort_dict() to try to
sort non-dict objects. Attempting to do this for
non-dict objects causes a segmentation fault. For
dictionary objects this causes a performance
degradation that has not been noticed.
pdf_sort_dict() is called in two places:
pdf_dict_get_put() and showgrep().
The resson that calling pdf_sort_dict() from
pdf_dict_get_put() does not cause a segmentation fault
is that pdf_dict_get_put() makes sure that the object
is a dictionary before calling pdf_sort_dict(), which
will then decide NOT to sort the dict keys.
showgrep() on the other hand does not make sure that it
is only processing dict objects before calling
pdf_sort_dict() which caused a segmentation fault.
Diffstat (limited to 'source')
-rw-r--r-- | source/pdf/pdf-object.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/source/pdf/pdf-object.c b/source/pdf/pdf-object.c index 51f6a679..8d2e2ae4 100644 --- a/source/pdf/pdf-object.c +++ b/source/pdf/pdf-object.c @@ -1584,7 +1584,7 @@ void pdf_sort_dict(fz_context *ctx, pdf_obj *obj) { RESOLVE(obj); - if (OBJ_IS_DICT(obj)) + if (!OBJ_IS_DICT(obj)) return; if (!(obj->flags & PDF_FLAGS_SORTED)) { |