opj_j2k_read_cod: remove check for 'No more than one COD marker per tile' (fixes...
authorEven Rouault <even.rouault@spatialys.com>
Thu, 30 Nov 2017 13:48:34 +0000 (14:48 +0100)
committerEven Rouault <even.rouault@spatialys.com>
Thu, 30 Nov 2017 13:48:34 +0000 (14:48 +0100)
This check was added per https://github.com/uclouvain/openjpeg/commit/daed8cc9195555e101ab708a501af2dfe6d5e001
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.

src/lib/openjp2/j2k.c
tests/nonregression/CMakeLists.txt
tests/nonregression/md5refs.txt
tests/nonregression/test_suite.ctest.in

index e283884faab86c6d88096562f346d4fd315ffd54..6e9cf8ce0a330041a91ac6816cb69ee9a86bbc2e 100644 (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] :
             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 */
index 677f96cd282977115eb6fc4403f3e6e09463a17f..82eff3c3e25019fecbe0dcd4d51252e95991047d 100644 (file)
@@ -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
index 6076538bad1a54728081437007ffcf7a1e84acbb..903566d627b20b172c3b00068bca806deabefe11 100644 (file)
@@ -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
\ No newline at end of file
index 31ae777b8f288eef558cdd26b95514c538ec0665..9fe4bc0bb76887bedc6f82aed63084c5be9d0278 100644 (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
 # 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