Skip to content

Commit

Permalink
opj_j2k_read_cod: remove check for 'No more than one COD marker per t…
Browse files Browse the repository at this point in the history
…ile' (fixes #1043)

This check was added per daed8cc
to fix #476 , but it does not seem
to be necessary with latest master (issue476.jp2 doesn't cause memory issues),
and breaks reading legit files.
  • Loading branch information
rouault committed Nov 30, 2017
1 parent 936910c commit 98cfdd3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/lib/openjp2/j2k.c
Original file line number Diff line number Diff line change
Expand Up @@ -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] :
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 */
if (l_tcp->cod) {
opj_event_msg(p_manager, EVT_ERROR,
"COD marker already read. No more than one COD marker per tile.\n");
return OPJ_FALSE;
}
#endif
l_tcp->cod = 1;

/* Make sure room is sufficient */
Expand Down
1 change: 0 additions & 1 deletion tests/nonregression/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ set(BLACKLIST_JPEG2000
issue420.jp2 #kdu_jp2info ok
27ac957758a35d00d6765a0c86350d9c.SIGFPE.d25.537.jpc #kdu_jp2info crash
3672da2f1f67bbecad27d7181b4e9d7c.SIGFPE.d25.805.jpc #kdu_jp2info crash
issue476.jp2 #kdu_jp2info ok
issue475.jp2 #kdu_jp2info ok
issue413.jp2 #kdu_jp2info ok
issue823.jp2 #kdu_jp2info ok
Expand Down
1 change: 1 addition & 0 deletions tests/nonregression/md5refs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -316,3 +316,4 @@ ac8f6ab3acc9c692ed7c41bd62a0e1e8 file1.jp2-c0-r1.tif
fbfcf662b6f7549574b2885490fbcf12 file1.jp2-c0-d10_20_30_40.tif
fa7382fd8b2e788b28b807e200dd95b9 file1.jp2-c0-t0.tif
ac8f6ab3acc9c692ed7c41bd62a0e1e8 file1.jp2-c0-t0-r1.tif
f31bcb01c771f829054cdb013575e86a issue1043.png
2 changes: 2 additions & 0 deletions tests/nonregression/test_suite.ctest.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
# 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_NR_PATH@/db11217111510058.jp2 -o @TEMP_PATH@/issue1043.png

0 comments on commit 98cfdd3

Please sign in to comment.