From d189e83e201c7df66e9cb6e84e468d877ecea0ff Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 12 Aug 2014 11:57:30 +0200 Subject: Fix 695411: Catch errors when loading objects in mutool extract. --- source/tools/pdfextract.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'source/tools/pdfextract.c') diff --git a/source/tools/pdfextract.c b/source/tools/pdfextract.c index b46cccbd..0304845f 100644 --- a/source/tools/pdfextract.c +++ b/source/tools/pdfextract.c @@ -166,14 +166,21 @@ static void showobject(int num) if (!doc) fz_throw(ctx, FZ_ERROR_GENERIC, "no file specified"); - obj = pdf_load_object(doc, num, 0); + fz_try(ctx) + { + obj = pdf_load_object(doc, num, 0); - if (isimage(obj)) - saveimage(num); - else if (isfontdesc(obj)) - savefont(obj, num); + if (isimage(obj)) + saveimage(num); + else if (isfontdesc(obj)) + savefont(obj, num); - pdf_drop_obj(obj); + pdf_drop_obj(obj); + } + fz_catch(ctx) + { + fz_warn(ctx, "ignoring object %d", num); + } } int pdfextract_main(int argc, char **argv) -- cgit v1.2.3