diff options
author | Robin Watts <robin.watts@artifex.com> | 2011-11-24 16:10:40 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2011-11-24 16:14:58 +0000 |
commit | 0ab03af67d5e35ab305e5915e38e71e2c7f6306a (patch) | |
tree | 8d65944652bf94408d40bcee706372569079fc62 /pdf | |
parent | 51b43a4230e1317df107e1c877d8599f15e44cfe (diff) | |
download | mupdf-0ab03af67d5e35ab305e5915e38e71e2c7f6306a.tar.xz |
Bug 692506: Improve repairing by accepting broken dictionaries.
Adopt Zenikos patch from bug 692506; if a dict fails to parse, then
create an empty one and continue. The repaired document will be
incomplete, but we may well get something useful out of it.
Diffstat (limited to 'pdf')
-rw-r--r-- | pdf/pdf_repair.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pdf/pdf_repair.c b/pdf/pdf_repair.c index 08adcb99..dc376dc3 100644 --- a/pdf/pdf_repair.c +++ b/pdf/pdf_repair.c @@ -36,7 +36,10 @@ pdf_repair_obj(fz_stream *file, char *buf, int cap, int *stmofsp, int *stmlenp, /* Send NULL xref so we don't try to resolve references */ error = pdf_parse_dict(&dict, NULL, file, buf, cap); if (error) - return fz_rethrow(error, "cannot parse object"); + { + fz_catch(error, "cannot parse object - repair will be incomplete"); + dict = fz_new_dict(2); + } obj = fz_dict_gets(dict, "Type"); if (fz_is_name(obj) && !strcmp(fz_to_name(obj), "XRef")) |