From 80b59185030368fecf38d9abe13ffb0302a60c2a Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 15 Jan 2018 15:38:05 +0100 Subject: Fix 698865: Warn when failing to load embedded ICC profile in PNG images. Do not throw an exception, just ignore the faulty color profile. --- source/fitz/load-png.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source/fitz/load-png.c b/source/fitz/load-png.c index daa0814a..2fe58700 100644 --- a/source/fitz/load-png.c +++ b/source/fitz/load-png.c @@ -354,15 +354,16 @@ png_read_icc(fz_context *ctx, struct info *info, const unsigned char *p, unsigne stm = fz_open_memory(ctx, p + n + 2, size - n - 2); stm = fz_open_flated(ctx, stm, 15); fz_try(ctx) + { cs = fz_new_icc_colorspace_from_stream(ctx, (const char *)p, stm); + /* drop old one in case we have multiple ICC profiles */ + fz_drop_colorspace(ctx, info->cs); + info->cs = cs; + } fz_always(ctx) fz_drop_stream(ctx, stm); fz_catch(ctx) - fz_rethrow(ctx); - - /* drop old one in case we have multiple ICC profiles */ - fz_drop_colorspace(ctx, info->cs); - info->cs = cs; + fz_warn(ctx, "cannot read embedded ICC profile"); } static void -- cgit v1.2.3