diff options
Diffstat (limited to 'source/pdf/pdf-parse.c')
-rw-r--r-- | source/pdf/pdf-parse.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source/pdf/pdf-parse.c b/source/pdf/pdf-parse.c index aaa45c0d..66e0fbe7 100644 --- a/source/pdf/pdf-parse.c +++ b/source/pdf/pdf-parse.c @@ -496,7 +496,7 @@ pdf_parse_stm_obj(pdf_document *doc, fz_stream *file, pdf_lexbuf *buf) pdf_obj * pdf_parse_ind_obj(pdf_document *doc, fz_stream *file, pdf_lexbuf *buf, - int *onum, int *ogen, int *ostmofs) + int *onum, int *ogen, int *ostmofs, int *try_repair) { pdf_obj *obj = NULL; int num = 0, gen = 0, stm_ofs; @@ -508,17 +508,29 @@ pdf_parse_ind_obj(pdf_document *doc, tok = pdf_lex(file, buf); if (tok != PDF_TOK_INT) + { + if (try_repair) + *try_repair = 1; fz_throw(ctx, FZ_ERROR_GENERIC, "expected object number"); + } num = buf->i; tok = pdf_lex(file, buf); if (tok != PDF_TOK_INT) + { + if (try_repair) + *try_repair = 1; fz_throw(ctx, FZ_ERROR_GENERIC, "expected generation number (%d ? obj)", num); + } gen = buf->i; tok = pdf_lex(file, buf); if (tok != PDF_TOK_OBJ) + { + if (try_repair) + *try_repair = 1; fz_throw(ctx, FZ_ERROR_GENERIC, "expected 'obj' keyword (%d %d ?)", num, gen); + } tok = pdf_lex(file, buf); |