[trunk] Add check for number of layers & cblkw/cblkh values (fixes issue 475)
This commit is contained in:
parent
daed8cc919
commit
757f9394bf
|
@ -2462,6 +2462,11 @@ static OPJ_BOOL opj_j2k_read_cod ( opj_j2k_t *p_j2k,
|
|||
}
|
||||
opj_read_bytes(p_header_data,&l_tcp->numlayers,2); /* SGcod (B) */
|
||||
p_header_data+=2;
|
||||
|
||||
if ((l_tcp->numlayers < 1U) || (l_tcp->numlayers > 65535U)) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Invalid number of layers in COD marker : %d not in range [1-65535]\n", l_tcp->numlayers);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
/* If user didn't set a number layer to decode take the max specify in the codestream. */
|
||||
if (l_cp->m_specific_param.m_dec.m_layer) {
|
||||
|
@ -8631,6 +8636,12 @@ OPJ_BOOL opj_j2k_read_SPCod_SPCoc( opj_j2k_t *p_j2k,
|
|||
++l_current_ptr;
|
||||
l_tccp->cblkh += 2;
|
||||
|
||||
if ((l_tccp->cblkw > 10) || (l_tccp->cblkh > 10) || ((l_tccp->cblkw + l_tccp->cblkh) > 12)) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Error reading SPCod SPCoc element, Invalid cblkw/cblkh combination\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
|
||||
opj_read_bytes(l_current_ptr,&l_tccp->cblksty ,1); /* SPcoc (G) */
|
||||
++l_current_ptr;
|
||||
|
||||
|
|
|
@ -73,6 +73,8 @@ set(BLACKLIST_JPEG2000
|
|||
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
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE OPJ_DATA_NR_LIST
|
||||
|
|
|
@ -262,6 +262,8 @@ opj_decompress -i @INPUT_NR_PATH@/issue411-ycc420.jp2 -o @TEMP_PATH@/issue411-yc
|
|||
opj_decompress -i @INPUT_NR_PATH@/issue458.jp2 -o @TEMP_PATH@/issue458.jp2.pgx
|
||||
# issue 476 Multiple COD in MH
|
||||
!opj_decompress -i @INPUT_NR_PATH@/issue476.jp2 -o @TEMP_PATH@/issue476.jp2.pgx
|
||||
# issue 475 Invalid number of layers
|
||||
!opj_decompress -i @INPUT_NR_PATH@/issue475.jp2 -o @TEMP_PATH@/issue475.jp2.pgx
|
||||
|
||||
|
||||
# decode with specific area
|
||||
|
|
Loading…
Reference in New Issue