diff options
| author | Matthieu Darbois <mayeut@users.noreply.github.com> | 2014-12-19 22:56:00 +0000 |
|---|---|---|
| committer | Matthieu Darbois <mayeut@users.noreply.github.com> | 2014-12-19 22:56:00 +0000 |
| commit | dde788b59e92a0d89593335119e17fd96b5e2b5e (patch) | |
| tree | e37af77b39bef3f03e5854fe990085242216cffa /src/lib | |
| parent | 58fc86452dbe0ebfd62077c0d8ec3db688417d3a (diff) | |
[trunk] Updated checks regarding number of decomposition levels when compressing
Update issue 215
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/openjp2/j2k.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c index cf4114d7..56077659 100644 --- a/src/lib/openjp2/j2k.c +++ b/src/lib/openjp2/j2k.c @@ -7074,21 +7074,20 @@ OPJ_BOOL opj_j2k_encoding_validation ( opj_j2k_t * p_j2k, /* make sure a validation list is present */ l_is_valid &= (p_j2k->m_validation_list != 00); - /* ISO 15444-1:2004 states between 1 & 33 (0 -> 32) */ - /* 33 (32) would always fail the 2 checks below (if a cast to 64bits was done) */ - /* 32 (31) would always fail the 2 checks below (if a cast to 64bits was done) */ - /* FIXME Shall we change OPJ_J2K_MAXRLVLS to 31 ? */ - if ((p_j2k->m_cp.tcps->tccps->numresolutions <= 0) || (p_j2k->m_cp.tcps->tccps->numresolutions > 31)) { + /* ISO 15444-1:2004 states between 1 & 33 (0 -> 32) */ + /* 33 (32) would always fail the check below (if a cast to 64bits was done) */ + /* FIXME Shall we change OPJ_J2K_MAXRLVLS to 32 ? */ + if ((p_j2k->m_cp.tcps->tccps->numresolutions <= 0) || (p_j2k->m_cp.tcps->tccps->numresolutions > 32)) { opj_event_msg(p_manager, EVT_ERROR, "Number of resolutions is too high in comparison to the size of tiles\n"); return OPJ_FALSE; } - if ((p_j2k->m_cp.tdx) < (OPJ_UINT32) (1 << p_j2k->m_cp.tcps->tccps->numresolutions)) { + if ((p_j2k->m_cp.tdx) < (OPJ_UINT32) (1 << (p_j2k->m_cp.tcps->tccps->numresolutions - 1U))) { opj_event_msg(p_manager, EVT_ERROR, "Number of resolutions is too high in comparison to the size of tiles\n"); return OPJ_FALSE; } - if ((p_j2k->m_cp.tdy) < (OPJ_UINT32) (1 << p_j2k->m_cp.tcps->tccps->numresolutions)) { + if ((p_j2k->m_cp.tdy) < (OPJ_UINT32) (1 << (p_j2k->m_cp.tcps->tccps->numresolutions - 1U))) { opj_event_msg(p_manager, EVT_ERROR, "Number of resolutions is too high in comparison to the size of tiles\n"); return OPJ_FALSE; } |
