opj_j2k_read_cod: remove check for 'No more than one COD marker per tile' (fixes #1043)

This check was added per daed8cc919
to fix https://github.com/uclouvain/openjpeg/issues/476 , but it does not seem
to be necessary with latest master (issue476.jp2 doesn't cause memory issues),
and breaks reading legit files.
This commit is contained in:
Even Rouault 2017-11-30 14:48:34 +01:00
parent 936910cf7a
commit 98cfdd3134
4 changed files with 8 additions and 1 deletions

View File

@ -2657,12 +2657,17 @@ static OPJ_BOOL opj_j2k_read_cod(opj_j2k_t *p_j2k,
&l_cp->tcps[p_j2k->m_current_tile_number] : &l_cp->tcps[p_j2k->m_current_tile_number] :
p_j2k->m_specific_param.m_decoder.m_default_tcp; p_j2k->m_specific_param.m_decoder.m_default_tcp;
#if 0
/* This check was added per https://github.com/uclouvain/openjpeg/commit/daed8cc9195555e101ab708a501af2dfe6d5e001 */
/* but this is no longer necessary to handle issue476.jp2 */
/* and this actually cause issues on legit files. See https://github.com/uclouvain/openjpeg/issues/1043 */
/* Only one COD per tile */ /* Only one COD per tile */
if (l_tcp->cod) { if (l_tcp->cod) {
opj_event_msg(p_manager, EVT_ERROR, opj_event_msg(p_manager, EVT_ERROR,
"COD marker already read. No more than one COD marker per tile.\n"); "COD marker already read. No more than one COD marker per tile.\n");
return OPJ_FALSE; return OPJ_FALSE;
} }
#endif
l_tcp->cod = 1; l_tcp->cod = 1;
/* Make sure room is sufficient */ /* Make sure room is sufficient */

View File

@ -79,7 +79,6 @@ set(BLACKLIST_JPEG2000
issue420.jp2 #kdu_jp2info ok issue420.jp2 #kdu_jp2info ok
27ac957758a35d00d6765a0c86350d9c.SIGFPE.d25.537.jpc #kdu_jp2info crash 27ac957758a35d00d6765a0c86350d9c.SIGFPE.d25.537.jpc #kdu_jp2info crash
3672da2f1f67bbecad27d7181b4e9d7c.SIGFPE.d25.805.jpc #kdu_jp2info crash 3672da2f1f67bbecad27d7181b4e9d7c.SIGFPE.d25.805.jpc #kdu_jp2info crash
issue476.jp2 #kdu_jp2info ok
issue475.jp2 #kdu_jp2info ok issue475.jp2 #kdu_jp2info ok
issue413.jp2 #kdu_jp2info ok issue413.jp2 #kdu_jp2info ok
issue823.jp2 #kdu_jp2info ok issue823.jp2 #kdu_jp2info ok

View File

@ -316,3 +316,4 @@ ac8f6ab3acc9c692ed7c41bd62a0e1e8 file1.jp2-c0-r1.tif
fbfcf662b6f7549574b2885490fbcf12 file1.jp2-c0-d10_20_30_40.tif fbfcf662b6f7549574b2885490fbcf12 file1.jp2-c0-d10_20_30_40.tif
fa7382fd8b2e788b28b807e200dd95b9 file1.jp2-c0-t0.tif fa7382fd8b2e788b28b807e200dd95b9 file1.jp2-c0-t0.tif
ac8f6ab3acc9c692ed7c41bd62a0e1e8 file1.jp2-c0-t0-r1.tif ac8f6ab3acc9c692ed7c41bd62a0e1e8 file1.jp2-c0-t0-r1.tif
f31bcb01c771f829054cdb013575e86a issue1043.png

View File

@ -623,3 +623,5 @@ opj_decompress -i @INPUT_CONF_PATH@/file1.jp2 -o @TEMP_PATH@/file1.jp2-c0-t0-r1.
!opj_decompress -i @INPUT_CONF_PATH@/file1.jp2 -o @TEMP_PATH@/file1.jp2-c0_0.tif -c 0,0 !opj_decompress -i @INPUT_CONF_PATH@/file1.jp2 -o @TEMP_PATH@/file1.jp2-c0_0.tif -c 0,0
# try to map an invalid component # try to map an invalid component
!opj_decompress -i @INPUT_CONF_PATH@/file1.jp2 -o @TEMP_PATH@/file1.jp2-c10.tif -c 10 !opj_decompress -i @INPUT_CONF_PATH@/file1.jp2 -o @TEMP_PATH@/file1.jp2-c10.tif -c 10
opj_decompress -i @INPUT_NR_PATH@/db11217111510058.jp2 -o @TEMP_PATH@/issue1043.png