diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-04-06 14:34:23 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-04-06 14:34:23 +0200 |
| commit | ed20305876e6743246996e8b4d77706d75dc63f8 (patch) | |
| tree | 9e708826b8b6a86fe1ac3e9b9a0eed7567c18673 | |
| parent | d4f883f7e88b93d1ec2d451036f2b85434baff13 (diff) | |
Don't try to verify encrypted JPEG2000 bitstreams.
| -rw-r--r-- | src/verify.cc | 18 | ||||
| -rw-r--r-- | test/verify_test.cc | 6 |
2 files changed, 11 insertions, 13 deletions
diff --git a/src/verify.cc b/src/verify.cc index 17f54e80..382a67ba 100644 --- a/src/verify.cc +++ b/src/verify.cc @@ -441,9 +441,11 @@ verify_picture_asset (shared_ptr<const ReelFileAsset> reel_file_asset, boost::fi for (int64_t i = 0; i < duration; ++i) { auto frame = reader->get_frame (i); biggest_frame = max(biggest_frame, frame->size()); - vector<VerificationNote> j2k_notes; - verify_j2k (frame, j2k_notes); - check_and_add (j2k_notes); + if (!mono_asset->encrypted() || mono_asset->key()) { + vector<VerificationNote> j2k_notes; + verify_j2k (frame, j2k_notes); + check_and_add (j2k_notes); + } progress (float(i) / duration); } } else if (auto stereo_asset = dynamic_pointer_cast<StereoPictureAsset>(asset)) { @@ -451,10 +453,12 @@ verify_picture_asset (shared_ptr<const ReelFileAsset> reel_file_asset, boost::fi for (int64_t i = 0; i < duration; ++i) { auto frame = reader->get_frame (i); biggest_frame = max(biggest_frame, max(frame->left()->size(), frame->right()->size())); - vector<VerificationNote> j2k_notes; - verify_j2k (frame->left(), j2k_notes); - verify_j2k (frame->right(), j2k_notes); - check_and_add (j2k_notes); + if (!stereo_asset->encrypted() || mono_asset->key()) { + vector<VerificationNote> j2k_notes; + verify_j2k (frame->left(), j2k_notes); + verify_j2k (frame->right(), j2k_notes); + check_and_add (j2k_notes); + } progress (float(i) / duration); } diff --git a/test/verify_test.cc b/test/verify_test.cc index e1ab50ce..b4cbc5aa 100644 --- a/test/verify_test.cc +++ b/test/verify_test.cc @@ -2688,8 +2688,6 @@ BOOST_AUTO_TEST_CASE (verify_unsigned_cpl_with_encrypted_content) { { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISMATCHED_CPL_HASHES, encryption_test_cpl_id, canonical(cpl) }, { dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISMATCHED_PKL_ANNOTATION_TEXT_WITH_CPL, encryption_test_pkl_id, canonical(pkl), }, - /* It's encrypted so the J2K validity checks will fail */ - { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_JPEG2000_CODESTREAM, string("missing marker start byte") }, { dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE }, { dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE }, { dcp::VerificationNote::Type::WARNING, dcp::VerificationNote::Code::MISSING_FFOC }, @@ -2719,8 +2717,6 @@ BOOST_AUTO_TEST_CASE (verify_unsigned_pkl_with_encrypted_content) {dir}, { { dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISMATCHED_PKL_ANNOTATION_TEXT_WITH_CPL, encryption_test_pkl_id, canonical(pkl) }, - /* It's encrypted so the J2K validity checks will fail */ - { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_JPEG2000_CODESTREAM, string("missing marker start byte") }, { dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE }, { dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE }, { dcp::VerificationNote::Type::WARNING, dcp::VerificationNote::Code::MISSING_FFOC }, @@ -2807,8 +2803,6 @@ BOOST_AUTO_TEST_CASE (verify_partially_encrypted) {dir}, { {dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::PARTIALLY_ENCRYPTED}, - /* It's encrypted so the J2K validity checks will fail */ - {dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_JPEG2000_CODESTREAM, string("missing marker start byte")} }); } |
