From: Carl Hetherington Date: Tue, 6 Apr 2021 12:34:23 +0000 (+0200) Subject: Don't try to verify encrypted JPEG2000 bitstreams. X-Git-Tag: v1.8.0~74 X-Git-Url: https://main.carlh.net/gitweb/?p=libdcp.git;a=commitdiff_plain;h=ed20305876e6743246996e8b4d77706d75dc63f8 Don't try to verify encrypted JPEG2000 bitstreams. --- 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 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 j2k_notes; - verify_j2k (frame, j2k_notes); - check_and_add (j2k_notes); + if (!mono_asset->encrypted() || mono_asset->key()) { + vector j2k_notes; + verify_j2k (frame, j2k_notes); + check_and_add (j2k_notes); + } progress (float(i) / duration); } } else if (auto stereo_asset = dynamic_pointer_cast(asset)) { @@ -451,10 +453,12 @@ verify_picture_asset (shared_ptr 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 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 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")} }); }