diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-12-21 12:27:06 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-12-21 12:27:09 +0100 |
| commit | 0f2f26d5aad7b22b208fa5b87997ed117621cdd9 (patch) | |
| tree | 79991599d06f4116ba4364ad45dad8ceb2c97783 | |
| parent | e19bc71280c158b193e91decc4ac4aa7969f6953 (diff) | |
Relax the COC component number verification error (DoM #2395).v1.8.47
A DCP is seen in the wild with 1 here and it doesn't seem unreasonable
that there should be a COC for each component.
| -rw-r--r-- | src/verify_j2k.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/verify_j2k.cc b/src/verify_j2k.cc index 7b60034d..86ffb5b4 100644 --- a/src/verify_j2k.cc +++ b/src/verify_j2k.cc @@ -259,7 +259,14 @@ dcp::verify_j2k (shared_ptr<const Data> j2k, vector<VerificationNote>& notes) ptr += L_qcd - 3; } else if (*marker_name == "COC") { get_16(); // length - require_8(0, "invalid COC component number %1"); + auto const coc_component_number = get_8(); + /* I don't know if this is really a requirement, but it seems to make sense that there should only + * be components 0, 1 and 2. DoM bug #2395 is about a DCP with COC component number 1 which seems + * like it should be OK. + */ + if (coc_component_number > 2) { + throw InvalidCodestream(String::compose("invalid COC component number %1", coc_component_number)); + } require_8(1, "invalid coding style %1"); require_8(5, "invalid number of transform levels %1"); require_8(3, "invalid code block width exponent %1"); |
