From e78d9e2373d368f71f972d65c85e2ccf1e07c9dc Mon Sep 17 00:00:00 2001 From: John Whitington Date: Thu, 18 Dec 2014 17:58:26 +0000 Subject: [PATCH] Error handling for -revisions with malformed files --- cpdfcommand.ml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 7e411c2..adcd9ee 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -2994,7 +2994,11 @@ let go () = | (StdIn, _, _, _, _, _)::_ -> Pdfio.input_of_channel stdin | _ -> raise (Arg.Bad "Revisions: must be a filename or stdin") in - Printf.printf "%i\n%!" (Pdfread.revisions input) + begin try + Printf.printf "%i\n%!" (Pdfread.revisions input) + with + _ -> soft_error "Malformed XRef table. Cannot determine number of revisions." + end | Some Clean -> begin match args.out with | (File _ | Stdout) ->