From: Mathieu Malaterre Date: Wed, 26 Feb 2014 11:22:34 +0000 (+0000) Subject: [trunk] Import patch from sumatrapdf team. This handle some Part-2 compliant file... X-Git-Tag: version.2.0.1~4^2~211 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=51e3764519d77210f8e6bb707fbe009fcf867a87;p=openjpeg [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 --- 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 */