diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2017-08-09 11:34:08 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2017-08-09 11:34:08 +0200 |
| commit | ac375ac9f5b4ae47501b60795e905e3d25dd00f8 (patch) | |
| tree | 8652897719b54db0a388fde6efe88d0ab1d72101 /src/lib/openjp2/jp2.c | |
| parent | c38bdbef4f3a5888948903247532fc8cf4284c00 (diff) | |
Partial revert BPC related check of #975 (#979)
PR #975 introduced a check that rejects images that have different bit depth/sign
per compoment in SIZ marker if the JP2 IHDR box has BPC != 255
This didn't work properly if decoding a .j2k file since the new bit added in
opj_cp_t wasn't initialized to the right value.
For clarity, tThis new bit has also been renamed to allow_different_bit_depth_sign
But looking closer at the code, it seems we were already tolerant to inconsistencies.
For example we parsed a JP2 BPCC box even if BPC != 255 (just a warning is emitted)
So failing hard in opj_j2k_read_siz() wouldn't be very inconsistent, and that
alone cannot protect against other issues, so just emit a warning if BPC != 255
and the SIZ marker contains different bit depth/sign per component.
Note: we could also check that the content of JP2 BPCC box is consistant with the one
of the SIZ marker.
Diffstat (limited to 'src/lib/openjp2/jp2.c')
| -rw-r--r-- | src/lib/openjp2/jp2.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/openjp2/jp2.c b/src/lib/openjp2/jp2.c index df35a164..f3ccb997 100644 --- a/src/lib/openjp2/jp2.c +++ b/src/lib/openjp2/jp2.c @@ -619,7 +619,7 @@ static OPJ_BOOL opj_jp2_read_ihdr(opj_jp2_t *jp2, opj_read_bytes(p_image_header_data, &(jp2->IPR), 1); /* IPR */ ++ p_image_header_data; - jp2->j2k->m_cp.bpc_is_255 = (jp2->bpc == 255); + jp2->j2k->m_cp.allow_different_bit_depth_sign = (jp2->bpc == 255); jp2->j2k->ihdr_w = jp2->w; jp2->j2k->ihdr_h = jp2->h; jp2->has_ihdr = 1; |
