From 51e3764519d77210f8e6bb707fbe009fcf867a87 Mon Sep 17 00:00:00 2001 From: Mathieu Malaterre Date: Wed, 26 Feb 2014 11:22:34 +0000 Subject: [PATCH] [trunk] Import patch from sumatrapdf team. This handle some Part-2 compliant file, by being more tolerant in COLR box. No testcase for now. Fixes issue 247 --- src/lib/openjp2/jp2.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib/openjp2/jp2.c b/src/lib/openjp2/jp2.c index 0af1f960..f8eb907d 100644 --- a/src/lib/openjp2/jp2.c +++ b/src/lib/openjp2/jp2.c @@ -1222,10 +1222,14 @@ OPJ_BOOL opj_jp2_read_colr( opj_jp2_t *jp2, ++p_colr_header_data; if (jp2->meth == 1) { - if (p_colr_header_size != 7) { - opj_event_msg(p_manager, EVT_ERROR, "Bad BPCC header box (bad size)\n"); + if (p_colr_header_size < 7) { + opj_event_msg(p_manager, EVT_ERROR, "Bad COLR header box (bad size: %d)\n", p_colr_header_size); return OPJ_FALSE; } + if (p_colr_header_size > 7) { + /* testcase Altona_Technical_v20_x4.pdf */ + opj_event_msg(p_manager, EVT_WARNING, "Bad COLR header box (bad size: %d)\n", p_colr_header_size); + } opj_read_bytes(p_colr_header_data,&jp2->enumcs ,4); /* EnumCS */ -- 2.40.0