[trunk] Make sure when reading POC that number of layers (layer end) is within acceptable bound.

Fixes issue 80
This commit is contained in:
Mathieu Malaterre 2014-03-12 10:10:21 +00:00
parent 59270c39a7
commit 6b51d11d08
1 changed files with 2 additions and 0 deletions

View File

@ -3175,6 +3175,8 @@ static OPJ_BOOL opj_j2k_read_poc ( opj_j2k_t *p_j2k,
opj_read_bytes(p_header_data,&(l_current_poc->compno0),l_comp_room); /* CSpoc_i */
p_header_data+=l_comp_room;
opj_read_bytes(p_header_data,&(l_current_poc->layno1),2); /* LYEpoc_i */
/* make sure layer end is in acceptable bounds */
l_current_poc->layno1 = opj_uint_min(l_current_poc->layno1, l_tcp->numlayers);
p_header_data+=2;
opj_read_bytes(p_header_data,&(l_current_poc->resno1),1); /* REpoc_i */
++p_header_data;