Merge pull request #1121 from rouault/fix_tnsot_zero

Fix regression in reading files with TNsot == 0 (refs #1120)
This commit is contained in:
Even Rouault 2018-06-20 16:26:24 +02:00 committed by GitHub
commit d2205ba2ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 3 deletions

View File

@ -4094,7 +4094,12 @@ static OPJ_BOOL opj_j2k_merge_ppt(opj_tcp_t *p_tcp, opj_event_mgr_t * p_manager)
/* preconditions */ /* preconditions */
assert(p_tcp != 00); assert(p_tcp != 00);
assert(p_manager != 00); assert(p_manager != 00);
assert(p_tcp->ppt_buffer == NULL);
if (p_tcp->ppt_buffer != NULL) {
opj_event_msg(p_manager, EVT_ERROR,
"opj_j2k_merge_ppt() has already been called\n");
return OPJ_FALSE;
}
if (p_tcp->ppt == 0U) { if (p_tcp->ppt == 0U) {
return OPJ_TRUE; return OPJ_TRUE;
@ -8845,8 +8850,11 @@ OPJ_BOOL opj_j2k_read_tile_header(opj_j2k_t * p_j2k,
/* Current marker is the EOC marker ?*/ /* Current marker is the EOC marker ?*/
if (l_current_marker == J2K_MS_EOC) { if (l_current_marker == J2K_MS_EOC) {
if (p_j2k->m_specific_param.m_decoder.m_state != J2K_STATE_EOC) {
p_j2k->m_current_tile_number = 0;
p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_EOC; p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_EOC;
} }
}
/* FIXME DOC ???*/ /* FIXME DOC ???*/
if (! p_j2k->m_specific_param.m_decoder.m_can_decode) { if (! p_j2k->m_specific_param.m_decoder.m_can_decode) {

View File

@ -317,3 +317,4 @@ 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 f31bcb01c771f829054cdb013575e86a issue1043.png
62bc654c830efddf1b23d6e208447dab tnsot_zero.png

View File

@ -625,3 +625,8 @@ 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-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 opj_decompress -i @INPUT_NR_PATH@/db11217111510058.jp2 -o @TEMP_PATH@/issue1043.png
opj_decompress -i @INPUT_NR_PATH@/tnsot_zero.jp2 -o @TEMP_PATH@/tnsot_zero.png
# try to decompress file with repeated PPT marker
!opj_decompress -i @INPUT_NR_PATH@/oss-fuzz2785.jp2 -o @TEMP_PATH@/oss-fuzz2785.png

View File

@ -45,3 +45,4 @@ NR-DEC-kodak_2layers_lrcp.j2c-31-decode-md5
NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5 NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5
NR-DEC-issue135.j2k-68-decode-md5 NR-DEC-issue135.j2k-68-decode-md5
NR-DEC-db11217111510058.jp2-306-decode-md5 NR-DEC-db11217111510058.jp2-306-decode-md5
NR-DEC-tnsot_zero.jp2-307-decode-md5

View File

@ -45,3 +45,4 @@ NR-DEC-kodak_2layers_lrcp.j2c-31-decode-md5
NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5 NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5
NR-DEC-issue135.j2k-68-decode-md5 NR-DEC-issue135.j2k-68-decode-md5
NR-DEC-db11217111510058.jp2-306-decode-md5 NR-DEC-db11217111510058.jp2-306-decode-md5
NR-DEC-tnsot_zero.jp2-307-decode-md5

View File

@ -45,3 +45,4 @@ NR-DEC-kodak_2layers_lrcp.j2c-31-decode-md5
NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5 NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5
NR-DEC-issue135.j2k-68-decode-md5 NR-DEC-issue135.j2k-68-decode-md5
NR-DEC-db11217111510058.jp2-306-decode-md5 NR-DEC-db11217111510058.jp2-306-decode-md5
NR-DEC-tnsot_zero.jp2-307-decode-md5

View File

@ -43,3 +43,4 @@ NR-DEC-kodak_2layers_lrcp.j2c-31-decode-md5
NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5 NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5
NR-DEC-issue135.j2k-68-decode-md5 NR-DEC-issue135.j2k-68-decode-md5
NR-DEC-db11217111510058.jp2-306-decode-md5 NR-DEC-db11217111510058.jp2-306-decode-md5
NR-DEC-tnsot_zero.jp2-307-decode-md5