diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2017-07-27 22:29:17 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2017-07-27 22:29:17 +0200 |
| commit | e03e9474667e5117341351699f0b1dbb06f93346 (patch) | |
| tree | 0a172f54362ea3611d41bd8e61fb9337b6308c51 /src | |
| parent | 820fcfe8bb101a2862c076b02c9b6b636ce39d2f (diff) | |
Avoid undefined shift behaviour if bit depth == 32 (#895)
Fixes openjeg-crashes-2017-07-27/id:000000,sig:11,src:003798,op:ext_AO,pos:128.jp2
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/openjp2/j2k.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c index 9ed8c044..5f1c5575 100644 --- a/src/lib/openjp2/j2k.c +++ b/src/lib/openjp2/j2k.c @@ -2234,9 +2234,9 @@ static OPJ_BOOL opj_j2k_read_siz(opj_j2k_t *p_j2k, /* Avoids later undefined shift in computation of */ /* p_j2k->m_specific_param.m_decoder.m_default_tcp->tccps[i].m_dc_level_shift = 1 << (l_image->comps[i].prec - 1); */ - if (l_img_comp->prec > 32) { + if (l_img_comp->prec > 31) { opj_event_msg(p_manager, EVT_ERROR, - "Invalid values for comp = %d : prec=%u (should be between 1 and 38 according to the JPEG2000 norm. OpenJpeg only supports up to 32)\n", + "Invalid values for comp = %d : prec=%u (should be between 1 and 38 according to the JPEG2000 norm. OpenJpeg only supports up to 31)\n", i, l_img_comp->prec); return OPJ_FALSE; } @@ -6271,9 +6271,9 @@ static OPJ_BOOL opj_j2k_read_cbd(opj_j2k_t *p_j2k, l_comp->sgnd = (l_comp_def >> 7) & 1; l_comp->prec = (l_comp_def & 0x7f) + 1; - if (l_comp->prec > 32) { + if (l_comp->prec > 31) { opj_event_msg(p_manager, EVT_ERROR, - "Invalid values for comp = %d : prec=%u (should be between 1 and 38 according to the JPEG2000 norm. OpenJpeg only supports up to 32)\n", + "Invalid values for comp = %d : prec=%u (should be between 1 and 38 according to the JPEG2000 norm. OpenJpeg only supports up to 31)\n", i, l_comp->prec); return OPJ_FALSE; } |
